return Header.getDwarfOffsetByteSize();
}
uint64_t getLength() const { return Header.getLength(); }
+ dwarf::DwarfFormat getFormat() const { return Header.getFormat(); }
uint8_t getUnitType() const { return Header.getUnitType(); }
bool isTypeUnit() const { return Header.isTypeUnit(); }
uint64_t getNextUnitOffset() const { return Header.getNextUnitOffset(); }
using namespace llvm;
void DWARFCompileUnit::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
+ int OffsetDumpWidth = 2 * dwarf::getDwarfOffsetByteSize(getFormat());
OS << format("0x%08" PRIx64, getOffset()) << ": Compile Unit:"
- << " length = " << format("0x%08" PRIx64, getLength())
+ << " length = " << format("0x%0*" PRIx64, OffsetDumpWidth, getLength())
<< " version = " << format("0x%04x", getVersion());
if (getVersion() >= 5)
OS << " unit_type = " << dwarf::UnitTypeString(getUnitType());
void DWARFTypeUnit::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
DWARFDie TD = getDIEForOffset(getTypeOffset() + getOffset());
const char *Name = TD.getName(DINameKind::ShortName);
+ int OffsetDumpWidth = 2 * dwarf::getDwarfOffsetByteSize(getFormat());
if (DumpOpts.SummarizeTypes) {
OS << "name = '" << Name << "'"
<< " type_signature = " << format("0x%016" PRIx64, getTypeHash())
- << " length = " << format("0x%08" PRIx64, getLength()) << '\n';
+ << " length = " << format("0x%0*" PRIx64, OffsetDumpWidth, getLength())
+ << '\n';
return;
}
OS << format("0x%08" PRIx64, getOffset()) << ": Type Unit:"
- << " length = " << format("0x%08" PRIx64, getLength())
+ << " length = " << format("0x%0*" PRIx64, OffsetDumpWidth, getLength())
<< " version = " << format("0x%04x", getVersion());
if (getVersion() >= 5)
OS << " unit_type = " << dwarf::UnitTypeString(getUnitType());
# CHECK: .debug_info.dwo contents:
# CHECK: 0x00000000: Compile Unit:
-# CHECK-SAME: length = 0x00000018
+# CHECK-SAME: length = 0x0000000000000018
# CHECK-SAME: version = 0x0004
# CHECK-SAME: abbr_offset = 0x0000
# CHECK-SAME: addr_size = 0x04
DI_4_64_start:
.long 0xffffffff # DWARF64 mark
.quad DI_4_64_end - DI_4_64_version # Length of Unit
-# CHECK-SAME: length = 0x0000000f
+# CHECK-SAME: length = 0x000000000000000f
DI_4_64_version:
.short 4 # DWARF version number
# CHECK-SAME: version = 0x0004
TU_4_64_start:
.long 0xffffffff # DWARF64 mark
.quad TU_4_64_end-TU_4_64_version # Length of Unit
-# CHECK-SAME: length = 0x00000021
+# CHECK-SAME: length = 0x0000000000000021
TU_4_64_version:
.short 4 # DWARF version number
# CHECK-SAME: version = 0x0004
TU_5_64_start:
.long 0xffffffff # DWARF64 mark
.quad TU_5_64_end-TU_5_64_version # Length of Unit
-# CHECK-SAME: length = 0x00000022
+# CHECK-SAME: length = 0x0000000000000022
TU_5_64_version:
.short 5 # DWARF version number
# CHECK-SAME: version = 0x0005