Draft Review: ⚙ D152708 [RFC][Draft] Enable primitive support for Two-Level Line Tables in LLVM
We (Sony) have created a small implementation of the Two-Level Line Tables (TLLT) proposal[0] in LLVM, adding basic support for printing and parsing TLLT to llc, llvm-dwarfdump, and lldb. This was done as an experiment to see whether it would be possible to do so and whether it would provide any immediate benefits. With these changes, we are able to compile a simple single-source C program containing an inlined function call, and with llvm-dwarfdump we can see inlined callsites in the line table and each inlined instruction displaying a reference to the callsite it was inlined at. In addition, in LLDB we are able to set a breakpoint on the line of the inlined call, resulting in the debugger stepping onto the first inlined instruction of the function. Our implementation is simple, narrow, and comprises of many hacks to get the minimum functioning input and output, particularly in LLDB (which we have no real experience with).
This is not intended as a proposal for our patch to be merged into LLVM as-is, and we do not currently have any plans to implement a complete version of the TLLT proposal in LLVM. However, as there may be developers who have some interest in this proposal for one reason or another, we have decided to make our brief experiment available to provide a concrete example of TLLT as this patch is, to my knowledge, the only opensource implementation of the current TLLT proposal. Currently, I am of the opinion that TLLT is not necessary for improved breakpoint and attribution behaviour, as other line table extensions (such as Location View Numbering[1]) could achieve the same results and more. If there is any specific desire for a complete TLLT implementation however, then this post and the accompanying patch should be a good starting point for further discussion.
[0] DWARF Issue: Two-Level Line Tables
[1] DWARF Issue: Location View Numbering