forked from OSchip/llvm-project
[DebugInfo] Dump fields in .debug_aranges according to the DWARF format (1/8).
The patch changes dumping of unit_length and debug_info_offset fields in an address range header 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:
parent
04e005009a
commit
69dfa07b4c
|
@ -25,6 +25,8 @@ public:
|
|||
/// The total length of the entries for that set, not including the length
|
||||
/// field itself.
|
||||
uint64_t Length;
|
||||
/// The DWARF format of the set.
|
||||
dwarf::DwarfFormat Format;
|
||||
/// The offset from the beginning of the .debug_info section of the
|
||||
/// compilation unit entry referenced by the table.
|
||||
uint64_t CuOffset;
|
||||
|
|
|
@ -60,12 +60,12 @@ Error DWARFDebugArangeSet::extract(DWARFDataExtractor data,
|
|||
// 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) {
|
||||
|
@ -77,7 +77,7 @@ Error DWARFDebugArangeSet::extract(DWARFDataExtractor data,
|
|||
|
||||
// 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 "
|
||||
|
@ -157,10 +157,12 @@ Error DWARFDebugArangeSet::extract(DWARFDataExtractor data,
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
# 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
|
||||
|
@ -48,11 +48,11 @@
|
|||
# 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
|
||||
|
@ -67,14 +67,14 @@
|
|||
## 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
|
||||
|
|
Loading…
Reference in New Issue