llvm.org GIT mirror llvm / 9970b0f
[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 Frederic Riss 5 years ago
5 changed file(s) with 36 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
8787 OS << ")";
8888 }
8989
90 static void dumpRanges(raw_ostream &OS, const DWARFAddressRangesVector& Ranges,
91 unsigned AddressSize, unsigned Indent) {
92 if (Ranges.empty())
93 return;
94
95 for (const auto &Range: Ranges) {
96 OS << '\n';
97 OS.indent(Indent);
98 OS << format("[0x%0*" PRIx64 " - 0x%0*" PRIx64 ")",
99 AddressSize*2, Range.first,
100 AddressSize*2, Range.second);
101 }
102 }
103
90104 void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS,
91105 DWARFUnit *u,
92106 uint32_t *offset_ptr,
93107 uint16_t attr, uint16_t form,
94108 unsigned indent) const {
95 OS << " ";
109 const char BaseIndent[] = " ";
110 OS << BaseIndent;
96111 OS.indent(indent+2);
97112 const char *attrString = AttributeString(attr);
98113 if (attrString)
148163 } else if (attr == DW_AT_APPLE_property_attribute) {
149164 if (Optional OptVal = formValue.getAsUnsignedConstant())
150165 dumpApplePropertyAttribute(OS, *OptVal);
166 } else if (attr == DW_AT_ranges) {
167 dumpRanges(OS, getAddressRanges(u), u->getAddressByteSize(),
168 sizeof(BaseIndent)+indent+4);
151169 }
152170
153171 OS << ")\n";
1313 ; describes those subprograms
1414
1515 ; CHECK: DW_TAG_compile_unit
16 ; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000)
16 ; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
1717 ; CHECK-NOT: {{DW_TAG|NULL}}
1818
1919 ; Omitting the subprograms without inlined subroutines is not possible
1515 ; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[E:0x[0-9a-z]*]])
1616 ; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[B:0x[0-9a-z]*]])
1717 ; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[D:0x[0-9a-z]*]])
18 ; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000)
18 ; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
1919 ; CHECK: .debug_loc contents:
2020 ; CHECK-NOT: Beginning address offset
2121 ; CHECK: .debug_loc.dwo contents:
0 RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test4.elf-x86-64 | FileCheck %s
1
2 CHECK: .debug_info contents:
3 CHECK: DW_TAG_compile_unit
4 CHECK-NOT: TAG
5 CHECK: DW_AT_ranges [DW_FORM_data4] (0x00000000
6 CHECK-NEXT: [0x000000000000062c - 0x0000000000000637)
7 CHECK-NEXT: [0x0000000000000637 - 0x000000000000063d))
8
9 CHECK: DW_TAG_compile_unit
10 CHECK-NOT: TAG
11 CHECK: DW_AT_ranges [DW_FORM_data4] (0x00000030
12 CHECK-NEXT: [0x0000000000000640 - 0x000000000000064b)
13 CHECK-NEXT: [0x0000000000000637 - 0x000000000000063d))
14
115
216 CHECK: .debug_ranges contents:
317 CHECK-NEXT: 00000000 000000000000062c 0000000000000637
2424 // DWARF: .debug_info contents:
2525 // DWARF: 0x{{[0-9a-f]+}}: DW_TAG_compile_unit [1]
2626 // CHECK-NOT-DWARF: DW_TAG_
27 // DWARF: DW_AT_ranges [DW_FORM_data4] (0x00000000)
27 // DWARF: DW_AT_ranges [DW_FORM_data4] (0x00000000
2828
2929 // DWARF: 0x{{[0-9a-f]+}}: DW_TAG_label [2] *
3030 // DWARF-NEXT: DW_AT_name [DW_FORM_string] ("a")