llvm-project/llvm/lib/DebugInfo/DWARF
Pavel Labath 47c3472c41 [DebugInfo/AccelTable] Fix inconsistency in getDIEOffset implementations
Summary:
Even though the getDIEOffset offset function was common for the two
accelerator table implementations, it was doing two different things:
for the Apple tables, it was returning the die offset relative to the
start of the section, whereas for DWARF v5 tables, it was relative to
the start of the CU.

I resolve this by renaming the function to getDIESectionOffset to make
it obvious what the function returns, and change the DWARF
implementation to return the section offset. I also keep the CU-relative
accessor, but only in the DWARF implementation (there is no way to get
this information for the Apple tables). This was not caught by existing
tests because the hand-written inputs also erroneously used section
offsets instead of CU-relative ones.

While looking at this, I noticed that the Apple implementation was not
fully correct either -- the header contains a DIEOffsetBase field, which
should be added to offsets encoded with the DW_FORM_ref*** family, but
this was not being used. This went unnoticed because all current writers
set this field to zero anyway. I fix this as well and add a hand-written
test which demonstrates the issue.

Reviewers: JDevlieghere, dblaikie

Subscribers: aprantl, llvm-commits

Differential Revision: https://reviews.llvm.org/D44202

llvm-svn: 327116
2018-03-09 11:58:59 +00:00
..
CMakeLists.txt [Support] Move syntax highlighting into support 2018-03-09 09:56:24 +00:00
DWARFAbbreviationDeclaration.cpp [DWARFv5] Support DW_FORM_strp in the .debug_line header. 2017-11-07 19:57:12 +00:00
DWARFAcceleratorTable.cpp [DebugInfo/AccelTable] Fix inconsistency in getDIEOffset implementations 2018-03-09 11:58:59 +00:00
DWARFAddressRange.cpp [DWARF v5] Support for verbose dumping of .debug_rnglist entries 2018-03-08 20:52:35 +00:00
DWARFCompileUnit.cpp llvm-dwarfdump: implement --recurse-depth=<N> 2017-09-20 17:44:00 +00:00
DWARFContext.cpp [DWARF v5] Support for verbose dumping of .debug_rnglist entries 2018-03-08 20:52:35 +00:00
DWARFDataExtractor.cpp Reland "[DebugInfo] Support DWARF expressions in eh_frame" 2018-03-08 00:46:53 +00:00
DWARFDebugAbbrev.cpp dwarfdump: Delay parsing abbreviations until they're needed 2017-09-19 15:13:55 +00:00
DWARFDebugArangeSet.cpp [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
DWARFDebugAranges.cpp [DebugInfo] Use shrink_to_fit to simplify code. NFCI. 2017-08-01 14:38:08 +00:00
DWARFDebugFrame.cpp Reland "[DebugInfo] Support DWARF expressions in eh_frame" 2018-03-08 00:46:53 +00:00
DWARFDebugInfoEntry.cpp [DWARF] NFC: DWARFDataExtractor combines relocs with DataExtractor. 2017-06-29 16:52:08 +00:00
DWARFDebugLine.cpp [DWARF] Don't attempt to parse line tables at invalid offsets 2018-03-08 10:53:34 +00:00
DWARFDebugLoc.cpp [DebugInfo] Unify dumping of address ranges 2018-01-16 11:17:57 +00:00
DWARFDebugMacro.cpp [Support] Move syntax highlighting into support 2018-03-09 09:56:24 +00:00
DWARFDebugPubTable.cpp llvm-dwarfdump: Factor out the printing of the section header (NFC) 2017-09-15 17:39:50 +00:00
DWARFDebugRangeList.cpp [DWARF v5] Add limited support for dumping .debug_rnglists 2018-02-02 12:35:52 +00:00
DWARFDebugRnglists.cpp [DebugInfo] Move RangeListEntries instead of copying. 2018-03-08 21:31:10 +00:00
DWARFDie.cpp [Support] Move syntax highlighting into support 2018-03-09 09:56:24 +00:00
DWARFExpression.cpp Reland "[DebugInfo] Support DWARF expressions in eh_frame" 2018-03-08 00:46:53 +00:00
DWARFFormValue.cpp [Support] Move syntax highlighting into support 2018-03-09 09:56:24 +00:00
DWARFGdbIndex.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
DWARFTypeUnit.cpp llvm-dwarfdump: implement --recurse-depth=<N> 2017-09-20 17:44:00 +00:00
DWARFUnit.cpp Revert "Rewrite the cached map used for locating the most precise DIE among inlined subroutines for a given address." 2018-02-13 01:52:30 +00:00
DWARFUnitIndex.cpp dwarfdump/symbolizer: Avoid loading unneeded CUs from a DWP 2017-09-19 18:36:11 +00:00
DWARFVerifier.cpp [Support] Move syntax highlighting into support 2018-03-09 09:56:24 +00:00
LLVMBuild.txt [dwarfdump] Pretty print location expressions and location lists 2017-08-29 21:41:21 +00:00