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 @@ -15,3 +15,7 @@ b main # CHECK: (lldb) b main # CHECK-NEXT: Breakpoint 1: where = subprogram_ranges.test.tmp.out`main + 6 at main.c:2:7 + +image lookup -v -s main +# CHECK: 1 symbols match 'main' +# CHECK: Variable: {{.*}}, name = "var", type = "int", {{.*}}, decl = main.c:2