};
dwarf::Form Form; /// Form for this value.
+ dwarf::DwarfFormat Format =
+ dwarf::DWARF32; /// Remember the DWARF format at extract time.
ValueType Value; /// Contains all data for the form.
const DWARFUnit *U = nullptr; /// Remember the DWARFUnit at extract time.
const DWARFContext *C = nullptr; /// Context for extract time.
Ctx = &CU->getContext();
C = Ctx;
U = CU;
+ Format = FP.Format;
bool Indirect = false;
bool IsBlock = false;
Value.data = nullptr;
raw_ostream &AddrOS = DumpOpts.ShowAddresses
? WithColor(OS, HighlightColor::Address).get()
: nulls();
+ int OffsetDumpWidth = 2 * dwarf::getDwarfOffsetByteSize(Format);
switch (Form) {
case DW_FORM_addr:
dumpSectionedAddress(AddrOS, DumpOpts, {Value.uval, Value.SectionIndex});
break;
case DW_FORM_strp:
if (DumpOpts.Verbose)
- OS << format(" .debug_str[0x%8.8" PRIx64 "] = ", UValue);
+ OS << format(" .debug_str[0x%0*" PRIx64 "] = ", OffsetDumpWidth, UValue);
dumpString(OS);
break;
case DW_FORM_line_strp:
if (DumpOpts.Verbose)
- OS << format(" .debug_line_str[0x%8.8" PRIx64 "] = ", UValue);
+ OS << format(" .debug_line_str[0x%0*" PRIx64 "] = ", OffsetDumpWidth,
+ UValue);
dumpString(OS);
break;
case DW_FORM_strx:
break;
case DW_FORM_sec_offset:
- AddrOS << format("0x%08" PRIx64, UValue);
+ AddrOS << format("0x%0*" PRIx64, OffsetDumpWidth, UValue);
break;
default:
# CHECK: seg_select_size: 0
# CHECK: prologue_length: 0x00000044
# CHECK: max_ops_per_inst: 1
-# CHECK: include_directories[ 0] = .debug_str[0x00000028] = "Directory5a"
-# CHECK: include_directories[ 1] = .debug_str[0x00000034] = "Directory5b"
+# CHECK: include_directories[ 0] = .debug_str[0x0000000000000028] = "Directory5a"
+# CHECK: include_directories[ 1] = .debug_str[0x0000000000000034] = "Directory5b"
# CHECK-NOT: include_directories
# CHECK: file_names[ 0]:
# CHECK-NEXT: name: "File5a"
# CHECK: Compile Unit:
# CHECK-NOT: Compile Unit:
# CHECK: DW_TAG_compile_unit
-# CHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x00000014)
-# CHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x00000024
+# CHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000000000014)
+# CHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x0000000000000024
# CHECK-NEXT: [0x00000014, 0x0000001e) ".text"
# CHECK-NEXT: [0x0000002a, 0x00000034) ".text")
# CHECK: Compile Unit:
# CHECK-NOT: Compile Unit:
# CHECK: DW_TAG_compile_unit
-# CHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x00000014)
+# CHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000000000014)
# CHECK-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1) rangelist = 0x00000034
# CHECK-NEXT: [0x0000002a, 0x00000034) ".text")
# COMMON: DW_TAG_compile_unit
# COMMON-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer")
# COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_2")
-# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000038)
+# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000000000000038)
# COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU2")
#
# The type unit
# COMMON: DW_TAG_compile_unit
# COMMON-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer")
# COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_2")
-# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000038)
+# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000000000000038)
# COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU2")
#
# The split CU
testing::Values(DumpValueParams{DW_FORM_strp, DumpTestSample32, DWARF32,
" .debug_str[0x00112233] = "},
DumpValueParams{DW_FORM_strp, DumpTestSample64, DWARF64,
- " .debug_str[0x11223344556677] = "},
+ " .debug_str[0x0011223344556677] = "},
DumpValueParams{DW_FORM_line_strp, DumpTestSample32,
DWARF32, " .debug_line_str[0x00112233] = "},
DumpValueParams{DW_FORM_line_strp, DumpTestSample64,
DWARF64,
- " .debug_line_str[0x11223344556677] = "},
+ " .debug_line_str[0x0011223344556677] = "},
DumpValueParams{DW_FORM_sec_offset, DumpTestSample32,
DWARF32, "0x00112233"},
DumpValueParams{DW_FORM_sec_offset, DumpTestSample64,
- DWARF64, "0x11223344556677"}), );
+ DWARF64, "0x0011223344556677"}), );
} // end anonymous namespace