summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2019-05-24 01:05:52 +0000
committerDavid Blaikie <dblaikie@gmail.com>2019-05-24 01:05:52 +0000
commit79872a88a0662ee91cdb194a8ea477c79a824e9f (patch)
tree7fc6776b6c6d3c2e891e9e86f1a3add0f65bb1b8 /llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
parent052f87ae36163cbd2033617eba655af7f1438733 (diff)
downloadbcm5719-llvm-79872a88a0662ee91cdb194a8ea477c79a824e9f.tar.gz
bcm5719-llvm-79872a88a0662ee91cdb194a8ea477c79a824e9f.zip
dwarfdump: Add a bit more DWARF64 support
This test case was incorrect because it mixed DWARF32 and DWARF64 for a single unit (DWARF32 unit referencing a DWARF64 str_offsets section). So fix enough of the unit parsing for DWARF64 and make the test valid. (not sure if anyone needs DWARF64 support though - support in libDebugInfoDWARF has been added piecemeal and LLVM doesn't produce it at all) llvm-svn: 361582
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
index 65b118f6091..7bc52215490 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -242,16 +242,20 @@ bool DWARFUnitHeader::extract(DWARFContext &Context,
if (!IndexEntry && Index)
IndexEntry = Index->getFromOffset(*offset_ptr);
Length = debug_info.getU32(offset_ptr);
- // FIXME: Support DWARF64.
- unsigned SizeOfLength = 4;
FormParams.Format = DWARF32;
+ unsigned SizeOfLength = 4;
+ if (Length == 0xffffffff) {
+ Length = debug_info.getU64(offset_ptr);
+ FormParams.Format = DWARF64;
+ SizeOfLength = 8;
+ }
FormParams.Version = debug_info.getU16(offset_ptr);
if (FormParams.Version >= 5) {
UnitType = debug_info.getU8(offset_ptr);
FormParams.AddrSize = debug_info.getU8(offset_ptr);
- AbbrOffset = debug_info.getU32(offset_ptr);
+ AbbrOffset = debug_info.getRelocatedValue(FormParams.getDwarfOffsetByteSize(), offset_ptr);
} else {
- AbbrOffset = debug_info.getRelocatedValue(4, offset_ptr);
+ AbbrOffset = debug_info.getRelocatedValue(FormParams.getDwarfOffsetByteSize(), offset_ptr);
FormParams.AddrSize = debug_info.getU8(offset_ptr);
// Fake a unit type based on the section type. This isn't perfect,
// but distinguishing compile and type units is generally enough.
OpenPOWER on IntegriCloud