This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Don't put compile unit name into the support file list and support DWARF5 line tables
ClosedPublic

Authored by labath on Dec 3 2019, 4:23 AM.

Details

Summary

Lldb's "format-independent" debug info made use of the fact that DWARF
(<=4) did not use the file index zero, and reused the support file index
zero for storing the compile unit name.

While this provided some convenience for DWARF<=4, it meant that the PDB
plugin needed to artificially remap file indices in order to free up
index 0. Furthermore, DWARF v5 make file index 0 legal, which meant that
similar remapping would be needed in the dwarf plugin too.

What this patch does instead is remove the requirement of having the
compile unit name in the index 0. It is not that useful since the name
can always be fetched from the CompileUnit object. Remapping code in the
pdb plugin(s) has been removed or simplified.

DWARF plugin has started inserting an empty FileSpec at index 0 to
ensure the indices keep matching up (in case of DWARF<=4). For DWARF5,
we insert the file 0 from the line table.

I add a test to ensure we can correctly lookup line table entries
referencing file 0, and in particular the case where the file 0 is also
duplicated in another file entry, as this is how clang produces line
tables in some circumstances (see pr44170). Though this is probably a
bug in clang, this is not forbidden by DWARF, and lldb already has
support for that in some (but not all) cases -- this adds a test for the
code path which was not fixed in this patch.

Diff Detail

Event Timeline

labath created this revision.Dec 3 2019, 4:23 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: aprantl. · View Herald Transcript

This seems to break Shell/SymbolFile/DWARF/debug-types-address-ranges.s on my machine: https://teemperor.de/pub/D70954.log

labath planned changes to this revision.Dec 3 2019, 4:49 AM

It seems one dwarf5 test is failing with this change (or rather, it was accidentally passing before as it picked up the fake line 0 entry). Since this patch is not that big, I'll just fold the dwarf5 followup into it. Planning changes == I need to come up with a test.

labath updated this revision to Diff 231904.Dec 3 2019, 7:00 AM

Add the dwarf5 part + a test.

labath retitled this revision from [lldb] Don't put compile unit name into the support file list to [lldb] Don't put compile unit name into the support file list and support DWARF5 line tables.Dec 3 2019, 7:01 AM
labath edited the summary of this revision. (Show Details)
clayborg accepted this revision.Dec 3 2019, 10:01 AM
This revision is now accepted and ready to land.Dec 3 2019, 10:01 AM
This revision was automatically updated to reflect the committed changes.