[Lldb-commits] [lldb] r344674 - [LLDB] - Add support for DW_RLE_start_end entries (.debug_rnglists)

George Rimar via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 17 00:37:26 PDT 2018


Author: grimar
Date: Wed Oct 17 00:37:26 2018
New Revision: 344674

URL: http://llvm.org/viewvc/llvm-project?rev=344674&view=rev
Log:
[LLDB] - Add support for DW_RLE_start_end entries (.debug_rnglists)

DWARF5 describes DW_RLE_start_end as:

This is a form of bounded range entry that has two target address operands.
Each operand is the same size as used in DW_FORM_addr. These indicate
the starting and ending addresses, respectively, that define the address range
for which the following location is valid.

The patch implements the support.

Differential revision: https://reviews.llvm.org/D53193

Added:
    lldb/trunk/lit/Breakpoint/Inputs/debug_rnglist_rlestartend.yaml
    lldb/trunk/lit/Breakpoint/debug_rnglist_rlestartend.test
Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp

Added: lldb/trunk/lit/Breakpoint/Inputs/debug_rnglist_rlestartend.yaml
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Breakpoint/Inputs/debug_rnglist_rlestartend.yaml?rev=344674&view=auto
==============================================================================
--- lldb/trunk/lit/Breakpoint/Inputs/debug_rnglist_rlestartend.yaml (added)
+++ lldb/trunk/lit/Breakpoint/Inputs/debug_rnglist_rlestartend.yaml Wed Oct 17 00:37:26 2018
@@ -0,0 +1,49 @@
+--- !ELF
+FileHeader:      
+  Class:           ELFCLASS64
+  Data:            ELFDATA2LSB
+  Type:            ET_EXEC
+  Machine:         EM_X86_64
+  Entry:           0x0000000000201000
+Sections:
+  - Name:            .text
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
+    Address:         0x0000000000201000
+    AddressAlign:    0x0000000000000010
+    Content:         31ED4989D15E4889E24883E4F0505449C7C08011200048C7C11011200048C7C7F0102000E897010000F4CCCCCCCCCCCC55B810202000483D102020004889E57417B8000000004885C0740D5DBF10202000FFE00F1F4400005DC3660F1F440000BE10202000554881EE102020004889E548C1FE034889F048C1E83F4801C648D1FE7415B8000000004885C0740B5DBF10202000FFE00F1F005DC3660F1F440000803D592F0000007517554889E5E87EFFFFFFC605472F0000015DC30F1F440000F3C30F1F4000662E0F1F840000000000554889E55DEB89CCCCCCCCCCCCCCCCCC554889E5B8010000005DC3CCCCCCCCCC554889E54883EC10C745FC00000000E8DCFFFFFF4883C4105DC3CCCCCCCCCCCC415741564189FF415541544C8D25E61E000055488D2DE61E0000534989F64989D54C29E54883EC0848C1FD03E8430000004885ED742031DB0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3
+  - Name:            .debug_str_offsets
+    Type:            SHT_PROGBITS
+    AddressAlign:    0x0000000000000001
+    Content:         2000000005000000040000002B0000003900000062000000270000000000000034000000
+  - Name:            .debug_str
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_MERGE, SHF_STRINGS ]
+    AddressAlign:    0x0000000000000001
+    Content:         696E7400636C616E672076657273696F6E20382E302E3020287472756E6B2033343430333529007A656400746573742E637070006D61696E002F686F6D652F756D622F74657374735F323031382F3130375F726E676C6973747374617274656E64005F5A337A65647600
+  - Name:            .debug_abbrev
+    Type:            SHT_PROGBITS
+    AddressAlign:    0x0000000000000001
+    Content:         011101252513050325721710171B251101551774170000022E001101120640186E2503253A0B3B0B49133F190000032E0011011206401803253A0B3B0B49133F19000004240003253E0B0B0B000000
+  - Name:            .debug_info
+    Type:            SHT_PROGBITS
+    AddressAlign:    0x0000000000000001
+    Content:         580000000500010800000000010004000108000000000000000200000000000000000C0000000C00000002E0102000000000000B0000000156030401015700000003F0102000000000001A0000000156060105570000000405050400
+  - Name:            .debug_rnglists
+    Type:            SHT_PROGBITS
+    AddressAlign:    0x0000000000000001
+    Content:         2B000000050008000000000006E010200000000000EB1020000000000006F0102000000000000A1120000000000000
+  - Name:            .debug_macinfo
+    Type:            SHT_PROGBITS
+    AddressAlign:    0x0000000000000001
+    Content:         '00'
+  - Name:            .debug_line
+    Type:            SHT_PROGBITS
+    AddressAlign:    0x0000000000000001
+    Content:         82000000050008004C000000010101FB0E0D00010101010000000100000101011F010900000003011F020F051E020000000000C404455D157064301CF8C713A4AC4CEE0000000000C404455D157064301CF8C713A4AC4CEE000902E0102000000000000105030A4B0207000101000902F01020000000000016050A0AE5050306580206000101
+  - Name:            .debug_line_str
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_MERGE, SHF_STRINGS ]
+    AddressAlign:    0x0000000000000001
+    Content:         746573742E637070002F686F6D652F756D622F74657374735F323031382F3130375F726E676C6973747374617274656E6400
+Symbols:

Added: lldb/trunk/lit/Breakpoint/debug_rnglist_rlestartend.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Breakpoint/debug_rnglist_rlestartend.test?rev=344674&view=auto
==============================================================================
--- lldb/trunk/lit/Breakpoint/debug_rnglist_rlestartend.test (added)
+++ lldb/trunk/lit/Breakpoint/debug_rnglist_rlestartend.test Wed Oct 17 00:37:26 2018
@@ -0,0 +1,28 @@
+# RUN: yaml2obj %p/Inputs/debug_rnglist_rlestartend.yaml > %ttest
+# RUN: lldb-test breakpoints %ttest %s | FileCheck %s
+
+# Test shows that LDLB is able to handle DW_RLE_start_end entries properly.
+
+# The following code and invocation were used to produce asm file.
+# clang -O0 -gdwarf-5 test.cpp -S -o test.s -fuse-ld=lld -ffunction-sections
+# It was edited to use DW_RLE_start_end, compiled and converted to yaml.
+# The yaml was manually reduced.
+#
+# //test.cpp:
+# int zed() { 
+#  return 1;
+# }
+#
+# int main() {
+#  return zed();
+# }
+#
+# clang and LLD versions were 8.0.0 (trunk 344035)
+
+b main
+# CHECK-LABEL: b main
+# CHECK: Address: {{.*}}`main + 15 at test.cpp:6:10
+
+b zed
+# CHECK-LABEL: b zed
+# CHECK: Address: {{.*}}`zed() + 4 at test.cpp:2:3

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp?rev=344674&r1=344673&r2=344674&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp Wed Oct 17 00:37:26 2018
@@ -143,10 +143,17 @@ bool DWARFDebugRngLists::ExtractRangeLis
       break;
     }
 
+    case DW_RLE_start_end: {
+      dw_addr_t begin = data.GetMaxU64(offset_ptr, addrSize);
+      dw_addr_t end = data.GetMaxU64(offset_ptr, addrSize);
+      rangeList.Append(DWARFRangeList::Entry(begin, end - begin));
+      break;
+    }
+
     default:
       // Next encodings are not yet supported:
       // DW_RLE_base_addressx, DW_RLE_startx_endx, DW_RLE_startx_length,
-      // DW_RLE_offset_pair, DW_RLE_base_address, DW_RLE_start_end
+      // DW_RLE_offset_pair, DW_RLE_base_address.
       lldbassert(0 && "unknown range list entry encoding");
       error = true;
     }




More information about the lldb-commits mailing list