[llvm] 48232a4 - [DebugInfo] Report the format of address tables [4/10]

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 2 03:57:10 PDT 2020


Author: Igor Kudrin
Date: 2020-06-02T17:55:30+07:00
New Revision: 48232a4858b4219b4ab09a698da57de407664877

URL: https://github.com/llvm/llvm-project/commit/48232a4858b4219b4ab09a698da57de407664877
DIFF: https://github.com/llvm/llvm-project/commit/48232a4858b4219b4ab09a698da57de407664877.diff

LOG: [DebugInfo] Report the format of address tables [4/10]

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

Added: 
    

Modified: 
    llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
    llvm/test/DebugInfo/X86/debug_addr.ll
    llvm/test/tools/llvm-dwarfdump/X86/debug_addr.s
    llvm/test/tools/llvm-dwarfdump/X86/debug_addr_64bit_address.s
    llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_mismatch.s
    llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf64.s
    llvm/test/tools/llvm-dwarfdump/X86/debug_addr_rela.s
    llvm/test/tools/llvm-dwarfdump/X86/debug_addr_unsupported_version.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
index e0f4a3bcd9d5..dcf2aefeb39f 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
@@ -138,11 +138,13 @@ void DWARFDebugAddrTable::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const {
   if (DumpOpts.Verbose)
     OS << format("0x%8.8" PRIx64 ": ", Offset);
   if (Length) {
-    int LengthFieldWidth = (Format == dwarf::DwarfFormat::DWARF64) ? 16 : 8;
-    OS << format("Address table header: length = 0x%0*" PRIx64
-                 ", version = 0x%4.4" PRIx16 ", addr_size = 0x%2.2" PRIx8
-                 ", seg_size = 0x%2.2" PRIx8 "\n",
-                 LengthFieldWidth, Length, Version, AddrSize, SegSize);
+    int OffsetDumpWidth = 2 * dwarf::getDwarfOffsetByteSize(Format);
+    OS << "Address table header: "
+       << format("length = 0x%0*" PRIx64, OffsetDumpWidth, Length)
+       << ", format = " << dwarf::FormatString(Format)
+       << format(", version = 0x%4.4" PRIx16, Version)
+       << format(", addr_size = 0x%2.2" PRIx8, AddrSize)
+       << format(", seg_size = 0x%2.2" PRIx8, SegSize) << "\n";
   }
 
   if (Addrs.size() > 0) {

diff  --git a/llvm/test/DebugInfo/X86/debug_addr.ll b/llvm/test/DebugInfo/X86/debug_addr.ll
index a9efba0d1bc8..1f56e5880167 100644
--- a/llvm/test/DebugInfo/X86/debug_addr.ll
+++ b/llvm/test/DebugInfo/X86/debug_addr.ll
@@ -38,7 +38,7 @@
 ; DWARF5: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000000 ".text")
 ; DWARF5: DW_AT_call_return_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000000018 ".text")
 ; DWARF5: .debug_addr contents:
-; DWARF5-NEXT: 0x00000000: Address table header: length = 0x00000010, version = 0x0005, addr_size = 0x04, seg_size = 0x00
+; DWARF5-NEXT: 0x00000000: Address table header: length = 0x00000010, format = DWARF32, version = 0x0005, addr_size = 0x04, seg_size = 0x00
 ; DWARF5-NEXT: Addrs: [
 ; DWARF5-NEXT: 0x00000000
 ; DWARF5-NEXT: 0x00000010

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr.s
index b0ee8be29544..47123f24c9e4 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr.s
@@ -3,12 +3,12 @@
 
 # CHECK:          .debug_addr contents
 
-# CHECK-NEXT:     length = 0x0000000c, version = 0x0005, addr_size = 0x04, seg_size = 0x00
+# CHECK-NEXT:     length = 0x0000000c, format = DWARF32, version = 0x0005, addr_size = 0x04, seg_size = 0x00
 # CHECK-NEXT:     Addrs: [
 # CHECK-NEXT:     0x00000000
 # CHECK-NEXT:     0x00000001
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     length = 0x00000004, version = 0x0005, addr_size = 0x04, seg_size = 0x00
+# CHECK-NEXT:     length = 0x00000004, format = DWARF32, version = 0x0005, addr_size = 0x04, seg_size = 0x00
 # CHECK-NOT:      {{.}}
 
 	.section	.debug_abbrev,"", at progbits

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_64bit_address.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_64bit_address.s
index 616d726d6575..b1e3b2a04553 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_64bit_address.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_64bit_address.s
@@ -2,7 +2,7 @@
 # RUN: llvm-dwarfdump -debug-addr %t.o | FileCheck %s
 
 # CHECK:          .debug_addr contents
-# CHECK-NEXT:     length = 0x00000014, version = 0x0005, addr_size = 0x08, seg_size = 0x00
+# CHECK-NEXT:     length = 0x00000014, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
 # CHECK-NEXT:     Addrs: [
 # CHECK-NEXT:     0x0000000100000000
 # CHECK-NEXT:     0x0000000100000001

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_mismatch.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_mismatch.s
index d5fdf5dc3d88..442059fb122d 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_mismatch.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_mismatch.s
@@ -6,11 +6,11 @@
 # WARN-NOT: {{.}}
 
 # CHECK: .debug_addr contents
-# CHECK-NEXT:     length = 0x0000000c, version = 0x0005, addr_size = 0x08, seg_size = 0x00
+# CHECK-NEXT:     length = 0x0000000c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
 # CHECK-NEXT:     Addrs: [
 # CHECK-NEXT:     0x0000000100000000
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     length = 0x0000000c, version = 0x0005, addr_size = 0x04, seg_size = 0x00
+# CHECK-NEXT:     length = 0x0000000c, format = DWARF32, version = 0x0005, addr_size = 0x04, seg_size = 0x00
 # CHECK-NEXT:     Addrs: [
 # CHECK-NEXT:     0x00000000
 # CHECK-NEXT:     0x00000001

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf64.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf64.s
index 6c97ae81909d..d894c21b4782 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf64.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf64.s
@@ -5,6 +5,7 @@
 # CHECK:      .debug_addr contents:
 # CHECK-NEXT: Address table header:
 # CHECK-SAME: length = 0x000000000000000c,
+# CHECK-SAME: format = DWARF64,
 # CHECK-SAME: version = 0x0005,
 # CHECK-SAME: addr_size = 0x04,
 # CHECK-SAME: seg_size = 0x00

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_rela.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_rela.s
index f0058b95475b..aa9efece4ff5 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_rela.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_rela.s
@@ -8,7 +8,7 @@
 ## a RELA relocation to recover the real value.
 
 # CHECK:      .debug_addr contents
-# CHECK-NEXT: length = 0x0000000c, version = 0x0005, addr_size = 0x08, seg_size = 0x00
+# CHECK-NEXT: length = 0x0000000c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
 # CHECK-NEXT: Addrs: [
 # CHECK-NEXT: 0x000000000000002a
 # CHECK-NEXT: ]

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_unsupported_version.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_unsupported_version.s
index dec91fe073fc..7398182fd891 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_unsupported_version.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_unsupported_version.s
@@ -7,7 +7,7 @@
 # ERR-NOT: {{.}}
 
 # CHECK: .debug_addr contents
-# CHECK-NEXT:     length = 0x0000000c, version = 0x0005, addr_size = 0x04, seg_size = 0x00
+# CHECK-NEXT:     length = 0x0000000c, format = DWARF32, version = 0x0005, addr_size = 0x04, seg_size = 0x00
 # CHECK-NEXT:     Addrs: [
 # CHECK-NEXT:     0x00000002
 # CHECK-NEXT:     0x00000003


        


More information about the llvm-commits mailing list