// the segment selectors are omitted from all tuples, including
// the terminating tuple.
- dwarf::DwarfFormat format;
Error Err = Error::success();
- std::tie(HeaderData.Length, format) = data.getInitialLength(offset_ptr, &Err);
+ std::tie(HeaderData.Length, HeaderData.Format) =
+ data.getInitialLength(offset_ptr, &Err);
HeaderData.Version = data.getU16(offset_ptr, &Err);
- HeaderData.CuOffset =
- data.getUnsigned(offset_ptr, dwarf::getDwarfOffsetByteSize(format), &Err);
+ HeaderData.CuOffset = data.getUnsigned(
+ offset_ptr, dwarf::getDwarfOffsetByteSize(HeaderData.Format), &Err);
HeaderData.AddrSize = data.getU8(offset_ptr, &Err);
HeaderData.SegSize = data.getU8(offset_ptr, &Err);
if (Err) {
// Perform basic validation of the header fields.
uint64_t full_length =
- dwarf::getUnitLengthFieldByteSize(format) + HeaderData.Length;
+ dwarf::getUnitLengthFieldByteSize(HeaderData.Format) + HeaderData.Length;
if (!data.isValidOffsetForDataOfSize(Offset, full_length))
return createStringError(errc::invalid_argument,
"the length of address range table at offset "
}
void DWARFDebugArangeSet::dump(raw_ostream &OS) const {
+ int OffsetDumpWidth = 2 * dwarf::getDwarfOffsetByteSize(HeaderData.Format);
OS << "Address Range Header: "
- << format("length = 0x%8.8" PRIx64 ", ", HeaderData.Length)
+ << format("length = 0x%0*" PRIx64 ", ", OffsetDumpWidth, HeaderData.Length)
<< format("version = 0x%4.4x, ", HeaderData.Version)
- << format("cu_offset = 0x%8.8" PRIx64 ", ", HeaderData.CuOffset)
+ << format("cu_offset = 0x%0*" PRIx64 ", ", OffsetDumpWidth,
+ HeaderData.CuOffset)
<< format("addr_size = 0x%2.2x, ", HeaderData.AddrSize)
<< format("seg_size = 0x%2.2x\n", HeaderData.SegSize);
# CHECK: Address Range Header: length = 0x0000001c,
.L2version:
.short 2 # Version
- .long 0x11223344 # Debug Info Offset
+ .long 0x112233 # Debug Info Offset
.byte 4 # Address Size
.byte 0 # Segment Selector Size
# CHECK-SAME: version = 0x0002,
-# CHECK-SAME: cu_offset = 0x11223344,
+# CHECK-SAME: cu_offset = 0x00112233,
# CHECK-SAME: addr_size = 0x04,
# CHECK-SAME: seg_size = 0x00
.space 4 # Padding
# CHECK: Address Range Header: length = 0x0000002c,
.L3version:
.short 2 # Version
- .long 0x22334455 # Debug Info Offset
+ .long 0x112233 # Debug Info Offset
.byte 8 # Address Size
.byte 0 # Segment Selector Size
# CHECK-SAME: version = 0x0002,
-# CHECK-SAME: cu_offset = 0x22334455,
+# CHECK-SAME: cu_offset = 0x00112233,
# CHECK-SAME: addr_size = 0x08,
# CHECK-SAME: seg_size = 0x00
.space 4 # Padding
## Case 4: Check that 64-bit DWARF format is supported.
.long 0xffffffff # DWARF64 mark
.quad .L4end - .L4version # Length
-# CHECK: Address Range Header: length = 0x0000001c,
+# CHECK: Address Range Header: length = 0x000000000000001c,
.L4version:
.short 2 # Version
- .quad 0x1234567899aabbcc # Debug Info Offset
+ .quad 0x123456789abc # Debug Info Offset
.byte 4 # Address Size
.byte 0 # Segment Selector Size
# CHECK-SAME: version = 0x0002,
-# CHECK-SAME: cu_offset = 0x1234567899aabbcc,
+# CHECK-SAME: cu_offset = 0x0000123456789abc,
# CHECK-SAME: addr_size = 0x04,
# CHECK-SAME: seg_size = 0x00
# No padding