[PATCH] D74195: [DebugInfo] Do not dump header field for pre-DWARF5 address tables.
Igor Kudrin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 6 22:42:47 PST 2020
ikudrin created this revision.
ikudrin added reviewers: dblaikie, probinson, aprantl, jhenderson.
ikudrin added projects: LLVM, debug-info.
Herald added a subscriber: hiraditya.
As there is no header in pre-DWARF5 address tables, and we fill the class data members with some artificial values, we should not dump them as that might be misleading.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74195
Files:
llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
llvm/test/DebugInfo/X86/debug_addr.ll
llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf4.s
Index: llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf4.s
===================================================================
--- llvm/test/tools/llvm-dwarfdump/X86/debug_addr_dwarf4.s
+++ 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
Index: llvm/test/DebugInfo/X86/debug_addr.ll
===================================================================
--- llvm/test/DebugInfo/X86/debug_addr.ll
+++ 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
Index: llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
@@ -141,11 +141,12 @@
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"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74195.243080.patch
Type: text/x-patch
Size: 2824 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200207/54d24f11/attachment.bin>
More information about the llvm-commits
mailing list