[llvm] 675c4be - [DebugInfo] Do not dump header field for pre-DWARFv5 address tables.

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 22:36:21 PST 2020


Author: Igor Kudrin
Date: 2020-02-12T13:33:00+07:00
New Revision: 675c4bebaffc0c6b28ac85602b278677c07e03e5

URL: https://github.com/llvm/llvm-project/commit/675c4bebaffc0c6b28ac85602b278677c07e03e5
DIFF: https://github.com/llvm/llvm-project/commit/675c4bebaffc0c6b28ac85602b278677c07e03e5.diff

LOG: [DebugInfo] Do not dump header field for pre-DWARFv5 address tables.

As there is no header in pre-DWARFv5 address tables, and we fill
the class data members with some artificial values, we should not
dump them as that might be misleading.

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

Added: 
    

Modified: 
    llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
    llvm/test/DebugInfo/X86/debug_addr.ll
    llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf4.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
index ba2c17749091..591c35b8532f 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
@@ -138,11 +138,12 @@ Error DWARFDebugAddrTable::extract(DWARFDataExtractor Data,
 void DWARFDebugAddrTable::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const {
   if (DumpOpts.Verbose)
     OS << format("0x%8.8" PRIx32 ": ", HeaderOffset);
-  OS << format("Addr Section: length = 0x%8.8" PRIx32
-               ", version = 0x%4.4" PRIx16 ", "
-               "addr_size = 0x%2.2" PRIx8 ", seg_size = 0x%2.2" PRIx8 "\n",
-               HeaderData.Length, HeaderData.Version, HeaderData.AddrSize,
-               HeaderData.SegSize);
+  if (HeaderData.Length)
+    OS << format("Address table header: length = 0x%8.8" PRIx32
+                 ", version = 0x%4.4" PRIx16 ", "
+                 "addr_size = 0x%2.2" PRIx8 ", seg_size = 0x%2.2" PRIx8 "\n",
+                 HeaderData.Length, HeaderData.Version, HeaderData.AddrSize,
+                 HeaderData.SegSize);
 
   if (Addrs.size() > 0) {
     const char *AddrFmt = (HeaderData.AddrSize == 4) ? "0x%8.8" PRIx64 "\n"

diff  --git a/llvm/test/DebugInfo/X86/debug_addr.ll b/llvm/test/DebugInfo/X86/debug_addr.ll
index 1fa797efd5fb..a9efba0d1bc8 100644
--- a/llvm/test/DebugInfo/X86/debug_addr.ll
+++ b/llvm/test/DebugInfo/X86/debug_addr.ll
@@ -22,7 +22,6 @@
 ; DWARF4: DW_TAG_GNU_call_site
 ; DWARF4:   DW_AT_low_pc [DW_FORM_GNU_addr_index] (indexed (00000002) address = 0x0000000000000018 ".text")
 ; DWARF4: .debug_addr contents:
-; DWARF4-NEXT: 0x00000000: Addr Section: length = 0x00000000, version = 0x0004, addr_size = 0x04, seg_size = 0x00
 ; DWARF4-NEXT: Addrs: [
 ; DWARF4-NEXT: 0x00000000
 ; DWARF4-NEXT: 0x00000010
@@ -39,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: Addr Section: length = 0x00000010, version = 0x0005, addr_size = 0x04, seg_size = 0x00
+; DWARF5-NEXT: 0x00000000: Address table header: length = 0x00000010, 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_dwarf4.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf4.s
index 57e9dd3c5193..ff6364dab70c 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf4.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf4.s
@@ -2,7 +2,6 @@
 # RUN: llvm-dwarfdump --debug-addr %t.o | FileCheck %s
 
 # CHECK: .debug_addr contents
-# CHECK-NEXT:     length = 0x00000000, version = 0x0004, addr_size = 0x04, seg_size = 0x00
 # CHECK-NEXT:     Addrs: [
 # CHECK-NEXT:     0x00000000
 # CHECK-NEXT:     0x00000001


        


More information about the llvm-commits mailing list