[llvm] r349996 - llvm-dwarfdump: Print the section name/number for addr_index attributes
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 22 00:33:55 PST 2018
Author: dblaikie
Date: Sat Dec 22 00:33:55 2018
New Revision: 349996
URL: http://llvm.org/viewvc/llvm-project?rev=349996&view=rev
Log:
llvm-dwarfdump: Print the section name/number for addr_index attributes
(addr attributes coming shortly)
Modified:
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp
llvm/trunk/test/DebugInfo/X86/debug_addr.ll
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h?rev=349996&r1=349995&r2=349996&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h Sat Dec 22 00:33:55 2018
@@ -75,6 +75,8 @@ public:
bool isFormClass(FormClass FC) const;
const DWARFUnit *getUnit() const { return U; }
void dump(raw_ostream &OS, DIDumpOptions DumpOpts = DIDumpOptions()) const;
+ void dumpSectionedAddress(raw_ostream &OS, DIDumpOptions DumpOpts,
+ SectionedAddress SA) const;
static void dumpAddressSection(const DWARFObject &Obj, raw_ostream &OS,
DIDumpOptions DumpOpts, uint64_t SectionIndex);
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp?rev=349996&r1=349995&r2=349996&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp Sat Dec 22 00:33:55 2018
@@ -331,6 +331,14 @@ bool DWARFFormValue::extractValue(const
return true;
}
+void DWARFFormValue::dumpSectionedAddress(raw_ostream &OS,
+ DIDumpOptions DumpOpts,
+ SectionedAddress SA) const {
+ OS << format("0x%016" PRIx64, SA.Address);
+ dumpAddressSection(U->getContext().getDWARFObj(), OS, DumpOpts,
+ SA.SectionIndex);
+}
+
void DWARFFormValue::dumpAddressSection(const DWARFObject &Obj, raw_ostream &OS,
DIDumpOptions DumpOpts,
uint64_t SectionIndex) {
@@ -365,9 +373,10 @@ void DWARFFormValue::dump(raw_ostream &O
AddrOS << format(" indexed (%8.8x) address = ", (uint32_t)UValue);
if (U == nullptr)
OS << "<invalid dwarf unit>";
- else if (Optional<SectionedAddress> A = U->getAddrOffsetSectionItem(UValue))
- AddrOS << format("0x%016" PRIx64, A->Address);
- else
+ else if (Optional<SectionedAddress> A =
+ U->getAddrOffsetSectionItem(UValue)) {
+ dumpSectionedAddress(AddrOS, DumpOpts, *A);
+ } else
OS << "<no .debug_addr section>";
break;
}
Modified: llvm/trunk/test/DebugInfo/X86/debug_addr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug_addr.ll?rev=349996&r1=349995&r2=349996&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/debug_addr.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/debug_addr.ll Sat Dec 22 00:33:55 2018
@@ -32,7 +32,7 @@
; DWARF5-NOT: DW_TAG_{{.*}}
; DWARF5: DW_AT_GNU_dwo_name{{.*}}test.dwo
; DWARF5: DW_AT_addr_base{{.*}}0x00000008
-; DWARF5: DW_AT_low_pc [DW_FORM_addrx] ( indexed (00000000) address = 0x0000000000000000)
+; DWARF5: DW_AT_low_pc [DW_FORM_addrx] ( indexed (00000000) address = 0x0000000000000000 ".text")
; DWARF5: .debug_addr contents:
; DWARF5-NEXT: 0x00000000: Addr Section: length = 0x0000000c, version = 0x0005, addr_size = 0x04, seg_size = 0x00
; DWARF5-NEXT: Addrs: [
More information about the llvm-commits
mailing list