More debugging information in Cmm terms#2308
Conversation
|
It looks like some changes to Apart from that, this looks good to me. It's an almost entirely mechanical change. Is it definitely OK to change all of the temporary variable names from For the record: as the author of |
|
Ah, you are right, I forgot to do the other architectures. Will do that this morning. Regarding the identifiers: I should have pointed out this change specifically in the comment above, my apologies. Adding the asterisks follows an existing convention in the compiler and ensures that internally-generated variables can be identified. (I would like to have a proper flag on I don't think any of the Cmm variable names with asterisks will be lifted to symbols, but presumably names with asterisks from the front end might be. In this case I don't think there will be a problem because we escape symbols before emitting them into assembly files. |
stedolan
left a comment
There was a problem hiding this comment.
(I was surprised that this change makes the code ~300 lines longer, but most of these new lines seem to be caused by dbg parameters pushing lines over the 80-char limit and causing new linebreaks)
|
I've added a |
Following on from GPR#851 and GPR#873, this pull request further enhances debugging information in Cmm terms. This was driven both by manually examining the debugger's behaviour and also by a report received from a user regarding substandard DWARF location information.
Some parts of this pull request will hook into future pull requests, in particular:
It relies on some debugging information coming from
Clambdawhich isn't yet there.It relies on the
Switchmodule providing an interface that includes the transmission of more debugging information; see GPR#2294.It features stub "placeholder debugging information" functions which will be filled in later. Using a trick, the gdb support provides the ability to debug at the Cmm level as well as the OCaml source level, in the initial instance for terms that had no OCaml source representation. This is useful for examining module initialisation functions, currying and partial application wrappers, etc. (In fact, when I demonstrated this work to some people at POPL, one well-known researcher said that this arguably seemed the most interesting feature.) The way the trick works is that the placeholder functions generate dummy
Debuginfo.tvalues that are distinct from each other. The Cmm code of the startup file is formatted, with formatter hooks being used to retrieve the source location of the various subterms within the file. TheDebuginfo.tvalues are then rewritten to use these locations.There was a missing copyright header on the AFL instrumentation interface file which I took the liberty of adding here along with the other changes.
@chambart or @lthls : perhaps one of you could look at this, since @lthls has done a lot of work in the
Cmmarea recently and @chambart did GPR#873.I strongly recommend using
patdiffto review these changes. This will turn a big and scary diff into a relatively small and straightforward one---and, in particular, it provides obvious highlighting when there's an actual "real" change (which might indicate an error).