This is an archive of the discontinued LLVM Phabricator instance.

[DWARF/AccelTable] Remove getDIESectionOffset for DWARF v5 entries
ClosedPublic

Authored by labath on Jun 11 2018, 4:35 AM.

Details

Summary

This method was not correct for entries in DWO files as it assumed it
could just add up the CU and DIE offsets to get the absolute DIE offset.
This is not correct for the DWO files, as here the CU offset will
reference the skeleton unit, whereas the DIE offset will be the offset
in the full unit in the DWO file.

Unfortunately, this means that we are not able to determine the absolute
DIE offset using the information in the .debug_names section alone,
which means we have to offload some of this work to the users of this
class.

To demonstrate how this can be done, I've added/fixed the ability to
lookup entries using accelerator tables in DWO files in llvm-dwarfdump.
To make this happen, I've needed to make two extra changes in other
classes:

  • made the DWARFContext method to lookup a CU based on the section offset public. I've needed this functionality to lookup a CU, and this seems like a useful thing in general.
  • made DWARFUnit::getDWOId call extractDIEsIfNeeded. Before this, the DWOId was filled in only if the root DIE happened to be parsed before we called the accessor. Since the lazy parsing is supposed to happen under the hood, calling extractDIEsIfNeeded seems appropriate.

Diff Detail

Event Timeline

labath created this revision.Jun 11 2018, 4:35 AM
dblaikie accepted this revision.Jun 11 2018, 3:35 PM

Seems good to me

lib/DebugInfo/DWARF/DWARFVerifier.cpp
1267

Generally I'd suggest just using [&] (capture all by reference) when using a lambda that doesn't escape its scope - as it doesn't tend to add a lot of value to enumerate the specific variables used within a lambda (in the same way that other local scopes in C++ (if/while/for/etc) don't enumerate which variables will be used within them)

This revision is now accepted and ready to land.Jun 11 2018, 3:35 PM
This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.