Debugging-related changes in the Mach language and passes #2303
This pull request contains the changes necessary to the Mach language and its associated passes for gdb support. I'm fairly pleased with these changes insofar as they have, in the end, worked out to be fairly modest in scale.
The main thing here is the introduction of a new type,
The interface for creating Mach instructions has been reworked a little. I think the new version provides an improvement in readability. It also incorporates the new types; and, crucially, stops creating instructions that have empty debugging information fields. (The forthcoming patch to
In the new world, we need every instruction to have non-empty debugging information, as far as is reasonably possible. The reason is that we track an approximation to lexical scopes right through from the
This visibility control is important since, in OCaml programs, the entirety of a function often contains a large number of variables. If they all appear at all program points within such function in the debugger, with of course many of them showing as unavailable, it becomes unmanageable.
If a given instruction lacks debugging information, it will be assigned to the toplevel lexical block of the enclosing function, which means that when the user lands on that instruction in the debugger local variables may suddenly become invisible.
The changes to the Mach passes themselves are straightforward; with one exception, these are just coping with the interface change.
The exception relates to the insertion of spill instructions. As noted in the code, we need to ensure that spill instructions do not get positioned in the wrong place relative to the
Apart from that, there is the introduction of a field to carry phantom let information on function declarations; correction of one spelling mistake; and I think that's all. There are probably some "dangling" references to things not yet merged in some of the comments, but those will resolve themselves once the remainder of the gdb support is in.
I forgot one thing: we also need to generalise the "
Edit: This is now #2316 .
@xavierleroy Without asking you to read the whole patch, could you confirm whether you are happy with the changes to the