]> granicus.if.org Git - llvm/commitdiff
llvm-dwarfdump: Print the section name/number for addr_index attributes
authorDavid Blaikie <dblaikie@gmail.com>
Sat, 22 Dec 2018 08:33:55 +0000 (08:33 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sat, 22 Dec 2018 08:33:55 +0000 (08:33 +0000)
(addr attributes coming shortly)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349996 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/DebugInfo/DWARF/DWARFFormValue.h
lib/DebugInfo/DWARF/DWARFFormValue.cpp
test/DebugInfo/X86/debug_addr.ll

index d6801b513a709e192482219e0f6cfb777ec6b90e..ed34d3c21dec1323a9c48772c0b8468c1643388f 100644 (file)
@@ -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);
 
index c24782f12a21f712d83804ee71db4d8e1112923b..90e8794c9d8a4648aa9058a121a9f075d83936e4 100644 (file)
@@ -331,6 +331,14 @@ bool DWARFFormValue::extractValue(const DWARFDataExtractor &Data,
   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 &OS, DIDumpOptions DumpOpts) const {
     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;
   }
index b50428a282cf856bce395eac4282cea6c799e5b6..64a79549fb1c464b51af17b1e4036a089adb438e 100644 (file)
@@ -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: [