[llvm] 92c45e4 - llvm-dwarfdump: Add support for DW_RLE_startx_endx
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 4 17:56:42 PDT 2020
Author: David Blaikie
Date: 2020-10-04T17:50:43-07:00
New Revision: 92c45e4ee2511399484e8af26b66ba37ad0ed8e7
URL: https://github.com/llvm/llvm-project/commit/92c45e4ee2511399484e8af26b66ba37ad0ed8e7
DIFF: https://github.com/llvm/llvm-project/commit/92c45e4ee2511399484e8af26b66ba37ad0ed8e7.diff
LOG: llvm-dwarfdump: Add support for DW_RLE_startx_endx
Added:
Modified:
llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp
llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists.s
llvm/test/tools/llvm-dwarfdump/X86/tombstone.s
Removed:
################################################################################
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp
index cc806739e19e..d12acca1962e 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp
@@ -37,12 +37,9 @@ Error RangeListEntry::extract(DWARFDataExtractor Data, uint64_t *OffsetPtr) {
break;
}
case dwarf::DW_RLE_startx_endx:
- consumeError(C.takeError());
- return createStringError(
- errc::not_supported,
- "unsupported rnglists encoding DW_RLE_startx_endx at "
- "offset 0x%" PRIx64,
- Offset);
+ Value0 = Data.getULEB128(C);
+ Value1 = Data.getULEB128(C);
+ break;
case dwarf::DW_RLE_startx_length: {
Value0 = Data.getULEB128(C);
Value1 = Data.getULEB128(C);
@@ -150,6 +147,19 @@ DWARFAddressRangesVector DWARFDebugRnglist::getAbsoluteRanges(
E.HighPC = E.LowPC + RLE.Value1;
break;
}
+ case dwarf::DW_RLE_startx_endx: {
+ auto Start = LookupPooledAddress(RLE.Value0);
+ if (!Start)
+ Start = {0, -1ULL};
+ auto End = LookupPooledAddress(RLE.Value1);
+ if (!End)
+ End = {0, -1ULL};
+ // FIXME: Some error handling if Start.SectionIndex != End.SectionIndex
+ E.SectionIndex = Start->SectionIndex;
+ E.LowPC = Start->Address;
+ E.HighPC = End->Address;
+ break;
+ }
default:
// Unsupported encodings should have been reported during extraction,
// so we should not run into any here.
@@ -235,6 +245,17 @@ void RangeListEntry::dump(
DWARFAddressRange(Start, Start + Value1).dump(OS, AddrSize, DumpOpts);
break;
}
+ case dwarf::DW_RLE_startx_endx: {
+ PrintRawEntry(OS, *this, AddrSize, DumpOpts);
+ uint64_t Start = 0;
+ if (auto SA = LookupPooledAddress(Value0))
+ Start = SA->Address;
+ uint64_t End = 0;
+ if (auto SA = LookupPooledAddress(Value1))
+ End = SA->Address;
+ DWARFAddressRange(Start, End).dump(OS, AddrSize, DumpOpts);
+ break;
+ }
default:
llvm_unreachable("Unsupported range list encoding");
}
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists.s
index c9c94637b4d3..07c9fe6d0f36 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_rnglists.s
@@ -1,8 +1,8 @@
# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o %t.o
-# RUN: not llvm-dwarfdump --debug-rnglists %t.o 2> %t.err | FileCheck %s --check-prefixes=TERSE,BOTH
-# RUN: FileCheck %s --input-file %t.err --check-prefix=ERR
-# RUN: not llvm-dwarfdump -v --debug-rnglists %t.o 2> %t.err | FileCheck %s --check-prefixes=VERBOSE,BOTH
-# RUN: FileCheck %s --input-file %t.err --check-prefix=ERR
+# RUN: llvm-dwarfdump --debug-rnglists %t.o 2> %t.err | FileCheck %s --check-prefixes=TERSE,BOTH
+# RUN: FileCheck %s --allow-empty --input-file %t.err --check-prefix=ERR
+# RUN: llvm-dwarfdump -v --debug-rnglists %t.o 2> %t.err | FileCheck %s --check-prefixes=VERBOSE,BOTH
+# RUN: FileCheck %s --allow-empty --input-file %t.err --check-prefix=ERR
# BOTH: .debug_rnglists contents:
# TERSE-NEXT: range list header: length = 0x00000037, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
@@ -74,6 +74,18 @@
# VERBOSE-NEXT: 0x{{[0-9a-f]*}}:
# VERBOSE-SAME: range list header: length = 0x0000000c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
+# BOTH-NEXT: ranges:
+# TERSE-NEXT: [0x0000000000000000, 0x0000000000000000)
+# TERSE-NEXT: <End of list>
+
+# VERBOSE-NEXT: 0x00000091: [DW_RLE_startx_endx]: 0x0000000000000001, 0x000000000000000a => [0x0000000000000000, 0x0000000000000000)
+# VERBOSE-NEXT: 0x00000094: [DW_RLE_end_of_list]
+
+# TERSE-NEXT: range list header: length = 0x0000000c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
+
+# VERBOSE-NEXT: 0x{{[0-9a-f]*}}:
+# VERBOSE-SAME: range list header: length = 0x0000000c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
+
# BOTH-NEXT: ranges:
# TERSE-NEXT: [0x0000000000000000, 0x000000000000002a)
# TERSE-NEXT: <End of list>
@@ -110,8 +122,6 @@
# BOTH-NOT: range list header:
-# ERR-NOT: error:
-# ERR: error: unsupported rnglists encoding DW_RLE_startx_endx at offset 0x91
# ERR-NOT: error:
.section .debug_rnglists,"", at progbits
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/tombstone.s b/llvm/test/tools/llvm-dwarfdump/X86/tombstone.s
index cb2a3a9d798d..3465d08bf261 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/tombstone.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/tombstone.s
@@ -24,6 +24,7 @@
# CHECK-NEXT: [0x00000042, 0x00000048)
# CHECK-NEXT: [0x00000042, 0x00000048)
# CHECK-NEXT: [0x00000042, 0x00000048)
+# CHECK-NEXT: [0x00000042, 0x00000042)
# CHECK-NEXT: [0x00000042, 0x00000048)
# CHECK-NEXT: [0x00000042, 0x00000048))
# CHECK: DW_TAG_subprogram
@@ -48,10 +49,11 @@
# entire rnglists contribution (since there's no way to know where such a
# contribution starts) - rather than assuming one starts at 0.
-# CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000057)
+# CHECK: DW_AT_ranges
# [0x0000000000000042, 0x0000000000000048)
# [0x0000000000000042, 0x0000000000000048)
# [0x0000000000000042, 0x0000000000000048)
+# [0x0000000000000042, 0x0000000000000042)
# [0x0000000000000042, 0x0000000000000048)
# [0x0000000000000042, 0x0000000000000048))
# CHECK: DW_TAG_subprogram
@@ -127,6 +129,8 @@
# CHECK-NEXT: [DW_RLE_startx_length]: 0x00000001, 0x00000006
# CHECK-NEXT: [DW_RLE_start_end ]: [0xffffffff, 0xffffffff)
# CHECK-NEXT: [DW_RLE_start_end ]: [0x00000042, 0x00000048)
+# CHECK-NEXT: [DW_RLE_startx_endx ]: 0x00000000, 0x00000000
+# CHECK-NEXT: [DW_RLE_startx_endx ]: 0x00000001, 0x00000001
# CHECK-NEXT: [DW_RLE_base_address ]: 0x00000040
# CHECK-NEXT: [DW_RLE_offset_pair ]: 0x00000002, 0x00000008 => [0x00000042, 0x00000048)
# CHECK-NEXT: [DW_RLE_base_address ]: 0xffffffff
@@ -146,6 +150,8 @@
# CHECK-NEXT: [DW_RLE_startx_length]: 0x0000000000000001, 0x0000000000000006
# CHECK-NEXT: [DW_RLE_start_end ]: [0xffffffffffffffff, 0xffffffffffffffff)
# CHECK-NEXT: [DW_RLE_start_end ]: [0x0000000000000042, 0x0000000000000048)
+# CHECK-NEXT: [DW_RLE_startx_endx ]: 0x0000000000000000, 0x0000000000000000
+# CHECK-NEXT: [DW_RLE_startx_endx ]: 0x0000000000000001, 0x0000000000000001
# CHECK-NEXT: [DW_RLE_base_address ]: 0x0000000000000040
# CHECK-NEXT: [DW_RLE_offset_pair ]: 0x0000000000000002, 0x0000000000000008 => [0x0000000000000042, 0x0000000000000048)
# CHECK-NEXT: [DW_RLE_base_address ]: 0xffffffffffffffff
@@ -304,13 +310,12 @@
.byte 6 # DW_RLE_start_end
.long 0x42 # start address
.long 0x48 # length
-# FIXME: RLE_startx_endx unsupported by llvm-dwarfdump
-# .byte 2 # DW_RLE_startx_endx
-# .uleb128 0 # start address
-# .uleb128 0 # length
-# .byte 2 # DW_RLE_startx_endx
-# .uleb128 1 # start address
-# .uleb128 1 # length
+ .byte 2 # DW_RLE_startx_endx
+ .uleb128 0 # start index
+ .uleb128 0 # end index
+ .byte 2 # DW_RLE_startx_endx
+ .uleb128 1 # start index
+ .uleb128 1 # end index
.byte 5 # DW_RLE_base_address
.long 0x40 # address
.byte 4 # DW_RLE_offset_pair
@@ -358,13 +363,12 @@
.byte 6 # DW_RLE_start_end
.quad 0x42 # start address
.quad 0x48 # length
-# FIXME: RLE_startx_endx unsupported by llvm-dwarfdump
-# .byte 2 # DW_RLE_startx_endx
-# .uleb128 0 # start address
-# .uleb128 0 # length
-# .byte 2 # DW_RLE_startx_endx
-# .uleb128 1 # start address
-# .uleb128 1 # length
+ .byte 2 # DW_RLE_startx_endx
+ .uleb128 0 # start index
+ .uleb128 0 # end index
+ .byte 2 # DW_RLE_startx_endx
+ .uleb128 1 # start index
+ .uleb128 1 # end index
.byte 5 # DW_RLE_base_address
.quad 0x40 # address
.byte 4 # DW_RLE_offset_pair
More information about the llvm-commits
mailing list