Source information
No source information is currently preserved.
My idea so far is to associate a breakpoint ID with every expression/statement where the debugger could conceivably stop, and a side table will associate breakpoint IDs with exact source file locations.
Instead of a breakpoint id, could we have a canonical ID to refer to any node in the kernel ir? this could be based on the AST structure, so I hope we wont need to add anything in the file format to support this.
Two reasons behind this request:
- for error reporting we'll probably need source-info in all source nodes, not just breakable nodes. As an example, when detecting an invalid override we'll need to report an error message showing the override and the original declaration, to do so we'll need source-information for all declarations.
- It would be great to use the same mechanism to attach any other data to nodes as a side-table. For example, if we later wanted to add any results of a local or whole-program program analysis that doesn't map into type-information (e.g. escape analysis, effects, etc).
Classes and members should have source information as well (I just didn't think I would have to write that down).
My point was that some expressions might not deserve their own breakpoint. For a let expression, let x = e1 in e2, the expressions e1 and e2 might have breakpoints, but not the let. Stopping before "let" and then before "e1" doesn't make sense since nothing happened in-between.
In contrast, associating an absolute start/end offset with every tree node wouldn't work, because transformations can't preserve information at that detail. But transformations can certainly make decisions about where to put breakable points and what source locations to associate with them, given that the original nodes had similar information on them.
As for the attaching data in side tables: yes that sounds reasonable, we should be able to use the preorder index to associate data with tree nodes.