[llvm] r220466 - [dwarfdump] Dump DW_AT_ranges values inline in the debug_info dump.
Frederic Riss
friss at apple.com
Wed Oct 22 21:08:34 PDT 2014
Author: friss
Date: Wed Oct 22 23:08:34 2014
New Revision: 220466
URL: http://llvm.org/viewvc/llvm-project?rev=220466&view=rev
Log:
[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
Modified:
llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp
llvm/trunk/test/DebugInfo/Inputs/gmlt.ll
llvm/trunk/test/DebugInfo/X86/fission-ranges.ll
llvm/trunk/test/DebugInfo/dwarfdump-ranges.test
llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s
Modified: llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp?rev=220466&r1=220465&r2=220466&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp Wed Oct 22 23:08:34 2014
@@ -88,12 +88,27 @@ static void dumpApplePropertyAttribute(r
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::dumpAtt
} 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";
Modified: llvm/trunk/test/DebugInfo/Inputs/gmlt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/gmlt.ll?rev=220466&r1=220465&r2=220466&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Inputs/gmlt.ll (original)
+++ llvm/trunk/test/DebugInfo/Inputs/gmlt.ll Wed Oct 22 23:08:34 2014
@@ -14,7 +14,7 @@
; describes those subprograms
; CHECK: DW_TAG_compile_unit
-; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000)
+; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
; CHECK-NOT: {{DW_TAG|NULL}}
; Omitting the subprograms without inlined subroutines is not possible
Modified: llvm/trunk/test/DebugInfo/X86/fission-ranges.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/fission-ranges.ll?rev=220466&r1=220465&r2=220466&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/fission-ranges.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/fission-ranges.ll Wed Oct 22 23:08:34 2014
@@ -16,7 +16,7 @@
; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[E:0x[0-9a-z]*]])
; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[B:0x[0-9a-z]*]])
; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[D:0x[0-9a-z]*]])
-; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000)
+; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
; CHECK: .debug_loc contents:
; CHECK-NOT: Beginning address offset
; CHECK: .debug_loc.dwo contents:
Modified: llvm/trunk/test/DebugInfo/dwarfdump-ranges.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-ranges.test?rev=220466&r1=220465&r2=220466&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarfdump-ranges.test (original)
+++ llvm/trunk/test/DebugInfo/dwarfdump-ranges.test Wed Oct 22 23:08:34 2014
@@ -1,5 +1,19 @@
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test4.elf-x86-64 | FileCheck %s
+CHECK: .debug_info contents:
+CHECK: DW_TAG_compile_unit
+CHECK-NOT: TAG
+CHECK: DW_AT_ranges [DW_FORM_data4] (0x00000000
+CHECK-NEXT: [0x000000000000062c - 0x0000000000000637)
+CHECK-NEXT: [0x0000000000000637 - 0x000000000000063d))
+
+CHECK: DW_TAG_compile_unit
+CHECK-NOT: TAG
+CHECK: DW_AT_ranges [DW_FORM_data4] (0x00000030
+CHECK-NEXT: [0x0000000000000640 - 0x000000000000064b)
+CHECK-NEXT: [0x0000000000000637 - 0x000000000000063d))
+
+
CHECK: .debug_ranges contents:
CHECK-NEXT: 00000000 000000000000062c 0000000000000637
CHECK-NEXT: 00000000 0000000000000637 000000000000063d
Modified: llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s?rev=220466&r1=220465&r2=220466&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s (original)
+++ llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s Wed Oct 22 23:08:34 2014
@@ -25,7 +25,7 @@ b:
// DWARF: .debug_info contents:
// DWARF: 0x{{[0-9a-f]+}}: DW_TAG_compile_unit [1]
// CHECK-NOT-DWARF: DW_TAG_
-// DWARF: DW_AT_ranges [DW_FORM_data4] (0x00000000)
+// DWARF: DW_AT_ranges [DW_FORM_data4] (0x00000000
// DWARF: 0x{{[0-9a-f]+}}: DW_TAG_label [2] *
// DWARF-NEXT: DW_AT_name [DW_FORM_string] ("a")
More information about the llvm-commits
mailing list