diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/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); diff --git a/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test b/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test --- a/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test +++ b/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: :1:1: use of undeclared identifier 'var' +# CHECK-NEXT: (int) $0 = {{.*}} q