[lldb-dev] Question about building line tables

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Mon Mar 7 15:31:54 PST 2016

> On Mar 7, 2016, at 3:21 PM, Zachary Turner <zturner at google.com> wrote:
> Does DWARF not store this information?  Because it seems like it could be efficiently stored in an interval tree, the question is just whether it is efficient to convert what DWARF stores into that format.

No it stores it just like we do, but in a compressed format that is useless for searching.

> PDB returns line entries in the format I described, with a start address and a byte length, so to determine whether something is a terminal entry I have to add them to some kind of data structure that collapses ranges and then manually scan through for breaks in the continuity of the range.
> Is there some way we can make this more generic so that it's efficient for both DWARF and PDB?

We need an efficient memory format that LLDB can use to search things, which is how things currently are done: all plug-ins are expected to parse debug info and make a series of lldb_private::LineTable::Entry structs.

We could defer this functionality into the plug-ins directly where you always must say "hey SymbolFile, here is a section offset address, please get me the lldb_private::LineEntry:

SymbolFile::GetLineEntryForAddress (const lldb_private::Address &addr, lldb_private::LineEntry &line_entry);

The thing I don't like about this approach where we don't supply the format we want the line tables to be in is this does make it quite painful to iterate over all line table entries for a compile unit. You would need to get the address range for all functions in a compile unit, then make a loop that would iterate through all addresses and try to lookup each address to find the lldb_private::LineEntry for that address. Right now we just get the LineTable from the compile unit and say "bool LineTable::GetLineEntryAtIndex(uint32_t idx, LineEntry &line_entry);". 

More information about the lldb-dev mailing list