[Lldb-commits] [PATCH] D94064: lldb: Add support for printing variables with DW_AT_ranges on DW_TAG_subprograms

David Blaikie via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 5 00:12:56 PST 2021


dblaikie created this revision.
dblaikie added a reviewer: labath.
dblaikie requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Finishing out the support (to the best of my knowledge/based on current
testing running the whole check-lldb with a clang forcibly using
DW_AT_ranges on all DW_TAG_subprograms) for this feature.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94064

Files:
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test


Index: lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test
===================================================================
--- lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test
+++ lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test
@@ -1,6 +1,6 @@
 # UNSUPPORTED: system-windows
 # RUN: %clang_host -g -O0 %S/Inputs/subprogram_ranges.s -o %t.out
-# RUN: not %lldb -b -s %s %t.out 2>&1 | FileCheck %s
+# RUN: %lldb -b -s %s %t.out 2>&1 | FileCheck %s
 
 # Test breaking on symbols and printing variables when a DW_TAG_subprogram uses
 # DW_AT_ranges instead of DW_AT_low_pc/DW_AT_high_pc.  While the assembly here
@@ -22,8 +22,7 @@
 
 print var
 # Check that local variable names can be looked up
-# FIXME: This should be: (int) $0 = {{.*}}
 # CHECK: (lldb) print var
-# CHECK-NEXT: error: <user expression 0>:1:1: use of undeclared identifier 'var'
+# CHECK-NEXT: (int) $0 = {{.*}}
 
 q
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3040,8 +3040,13 @@
     if (sc.function) {
       DWARFDIE function_die = GetDIE(sc.function->GetID());
 
-      const dw_addr_t func_lo_pc = function_die.GetAttributeValueAsAddress(
+      dw_addr_t func_lo_pc = function_die.GetAttributeValueAsAddress(
           DW_AT_low_pc, LLDB_INVALID_ADDRESS);
+      DWARFFormValue form_value;
+      if (func_lo_pc == LLDB_INVALID_ADDRESS &&
+          function_die.GetDIE()->GetAttributeValue(function_die.GetCU(),
+                                                   DW_AT_ranges, form_value))
+        func_lo_pc = 0;
       if (func_lo_pc != LLDB_INVALID_ADDRESS) {
         const size_t num_variables = ParseVariables(
             sc, function_die.GetFirstChild(), func_lo_pc, true, true);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94064.314513.patch
Type: text/x-patch
Size: 1902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210105/839e2933/attachment.bin>


More information about the lldb-commits mailing list