[llvm] c9122b8 - [DebugInfo] Dump length in .debug_line according to the DWARF format (4/8).

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Mon May 18 23:40:03 PDT 2020


Author: Igor Kudrin
Date: 2020-05-19T13:35:31+07:00
New Revision: c9122b8f7002a257e160a1422e19265343ae8133

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

LOG: [DebugInfo] Dump length in .debug_line according to the DWARF format (4/8).

The patch changes dumping of unit_length and header_length fields in
headers in .debug_line sections so that they are printed as 16-digit hex
values if the contribution is in the DWARF64 format.

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

Added: 
    

Modified: 
    llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
    llvm/test/DebugInfo/X86/dwarfdump-header-64.s
    llvm/test/tools/llvm-dwarfdump/X86/debug_line_dwarf64_large_table.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index 6fec697941b5..ce59d731ac58 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -106,15 +106,18 @@ void DWARFDebugLine::Prologue::dump(raw_ostream &OS,
                                     DIDumpOptions DumpOptions) const {
   if (!totalLengthIsValid())
     return;
+  int OffsetDumpWidth = 2 * dwarf::getDwarfOffsetByteSize(FormParams.Format);
   OS << "Line table prologue:\n"
-     << format("    total_length: 0x%8.8" PRIx64 "\n", TotalLength)
+     << format("    total_length: 0x%0*" PRIx64 "\n", OffsetDumpWidth,
+               TotalLength)
      << format("         version: %u\n", getVersion());
   if (!versionIsSupported(getVersion()))
     return;
   if (getVersion() >= 5)
     OS << format("    address_size: %u\n", getAddressSize())
        << format(" seg_select_size: %u\n", SegSelectorSize);
-  OS << format(" prologue_length: 0x%8.8" PRIx64 "\n", PrologueLength)
+  OS << format(" prologue_length: 0x%0*" PRIx64 "\n", OffsetDumpWidth,
+               PrologueLength)
      << format(" min_inst_length: %u\n", MinInstLength)
      << format(getVersion() >= 4 ? "max_ops_per_inst: %u\n" : "", MaxOpsPerInst)
      << format(" default_is_stmt: %u\n", DefaultIsStmt)

diff  --git a/llvm/test/DebugInfo/X86/dwarfdump-header-64.s b/llvm/test/DebugInfo/X86/dwarfdump-header-64.s
index 1df8e0620ac9..549374c100c4 100644
--- a/llvm/test/DebugInfo/X86/dwarfdump-header-64.s
+++ b/llvm/test/DebugInfo/X86/dwarfdump-header-64.s
@@ -153,11 +153,11 @@ LH_5_end:
 
 # CHECK-LABEL: .debug_line contents:
 # CHECK: Line table prologue:
-# CHECK: total_length: 0x00000050
+# CHECK: total_length: 0x0000000000000050
 # CHECK: version: 5
 # CHECK: address_size: 8
 # CHECK: seg_select_size: 0
-# CHECK: prologue_length: 0x00000044
+# CHECK: prologue_length: 0x0000000000000044
 # CHECK: max_ops_per_inst: 1
 # CHECK: include_directories[  0] = .debug_str[0x0000000000000028] = "Directory5a"
 # CHECK: include_directories[  1] = .debug_str[0x0000000000000034] = "Directory5b"

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_line_dwarf64_large_table.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_line_dwarf64_large_table.s
index a66ac7ab65ae..7194010e3eb3 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug_line_dwarf64_large_table.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_line_dwarf64_large_table.s
@@ -8,9 +8,9 @@
 # CHECK: debug_line[0x00000000]
 # CHECK-NEXT: warning: line table program with offset 0x00000000 has length 0xfffffffc but only 0x0000003a bytes are available
 # CHECK-NEXT: Line table prologue:
-# CHECK-NEXT:     total_length: 0xfffffff0
+# CHECK-NEXT:     total_length: 0x00000000fffffff0
 # CHECK-NEXT:          version: 4
-# CHECK-NEXT:  prologue_length: 0x00000016
+# CHECK-NEXT:  prologue_length: 0x0000000000000016
 
 # CHECK:      0x000000000badbeef      1      0      1   0             0  is_stmt end_sequence
 


        


More information about the llvm-commits mailing list