From 6715b1eee1b9bd7578f54f8f70b28ed1b5083981 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 17 Nov 2015 22:39:23 +0000 Subject: [PATCH] dwarfdump: support indexed string dumping in dwp based on the STR_OFFSETS component of the index git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253392 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/DebugInfo/DWARF/DWARFUnit.cpp | 6 +++++- test/DebugInfo/dwarfdump-dwp.test | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/DebugInfo/DWARF/DWARFUnit.cpp b/lib/DebugInfo/DWARF/DWARFUnit.cpp index 51c6c090eb3..53a149b1b23 100644 --- a/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -37,7 +37,11 @@ DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFSection &Section, const DWARFUnitSectionBase &UnitSection, const DWARFUnitIndex::Entry *IndexEntry) : Context(DC), InfoSection(Section), Abbrev(DA), RangeSection(RS), - LineSection(LS), StringSection(SS), StringOffsetSection(SOS), + LineSection(LS), StringSection(SS), StringOffsetSection([&]() { + if (const auto *C = IndexEntry->getOffset(DW_SECT_STR_OFFSETS)) + return SOS.slice(C->Offset, C->Offset + C->Length); + return SOS; + }()), AddrOffsetSection(AOS), isLittleEndian(LE), UnitSection(UnitSection), IndexEntry(IndexEntry) { clear(); diff --git a/test/DebugInfo/dwarfdump-dwp.test b/test/DebugInfo/dwarfdump-dwp.test index e766cbc2bd9..af5de5067e6 100644 --- a/test/DebugInfo/dwarfdump-dwp.test +++ b/test/DebugInfo/dwarfdump-dwp.test @@ -17,8 +17,7 @@ RUN: llvm-dwarfdump %p/Inputs/dwarfdump-dwp.x86_64.o | FileCheck %s ; CHECK-SAME: abbr_offset = 0x0043 ; CHECK: DW_TAG_compile_unit ; CHECK-NOT: DW_TAG -; FIXME: Implement str_offsets support so we find b.cpp here \/ -; CHECK: DW_AT_name {{.*}} "a.cpp" +; CHECK: DW_AT_name {{.*}} "b.cpp" ; Verify that abbreviations are decoded using the abbrev offset in the index ; CHECK: DW_TAG_structure_type -- 2.34.1