[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
This commit is contained in:
Igor Kudrin 2020-05-19 13:35:31 +07:00
parent 0db1684b74
commit c9122b8f70
3 changed files with 9 additions and 6 deletions

View File

@ -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)

View File

@ -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"

View File

@ -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