[dwarfdump] Dump DW_AT_ranges values inline in the debug_info dump.

The output looks like that:
                      DW_AT_ranges [FORM_data4]    (0x00000000
                         [0x00000001000024a0 - 0x00000001000024c2)
                         [0x0000000100002505 - 0x000000010000268b))

Differential Revision: http://reviews.llvm.org/D5712

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220466 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Frederic Riss
2014-10-23 04:08:34 +00:00
parent bdc3a5b99a
commit 9970b0fcaa
5 changed files with 36 additions and 4 deletions

View File

@ -88,12 +88,27 @@ static void dumpApplePropertyAttribute(raw_ostream &OS, uint64_t Val) {
OS << ")";
}
static void dumpRanges(raw_ostream &OS, const DWARFAddressRangesVector& Ranges,
unsigned AddressSize, unsigned Indent) {
if (Ranges.empty())
return;
for (const auto &Range: Ranges) {
OS << '\n';
OS.indent(Indent);
OS << format("[0x%0*" PRIx64 " - 0x%0*" PRIx64 ")",
AddressSize*2, Range.first,
AddressSize*2, Range.second);
}
}
void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS,
DWARFUnit *u,
uint32_t *offset_ptr,
uint16_t attr, uint16_t form,
unsigned indent) const {
OS << " ";
const char BaseIndent[] = " ";
OS << BaseIndent;
OS.indent(indent+2);
const char *attrString = AttributeString(attr);
if (attrString)
@ -149,6 +164,9 @@ void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS,
} else if (attr == DW_AT_APPLE_property_attribute) {
if (Optional<uint64_t> OptVal = formValue.getAsUnsignedConstant())
dumpApplePropertyAttribute(OS, *OptVal);
} else if (attr == DW_AT_ranges) {
dumpRanges(OS, getAddressRanges(u), u->getAddressByteSize(),
sizeof(BaseIndent)+indent+4);
}
OS << ")\n";