diff options
Diffstat (limited to 'lldb/source/Commands/CommandObjectThread.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectThread.cpp | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index 4e2c4c1..cd3d2d8 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -959,7 +959,6 @@ protected: } LineEntry function_start; - uint32_t index_ptr = 0, end_ptr = UINT32_MAX; std::vector<addr_t> address_list; // Find the beginning & end index of the function, but first make @@ -970,19 +969,14 @@ protected: return; } - AddressRange fun_addr_range = sc.function->GetAddressRange(); - Address fun_start_addr = fun_addr_range.GetBaseAddress(); - line_table->FindLineEntryByAddress(fun_start_addr, function_start, - &index_ptr); - - Address fun_end_addr(fun_start_addr.GetSection(), - fun_start_addr.GetOffset() + - fun_addr_range.GetByteSize()); - - bool all_in_function = true; + RangeVector<uint32_t, uint32_t> line_idx_ranges; + for (const AddressRange &range : sc.function->GetAddressRanges()) { + auto [begin, end] = line_table->GetLineEntryIndexRange(range); + line_idx_ranges.Append(begin, end - begin); + } + line_idx_ranges.Sort(); - line_table->FindLineEntryByAddress(fun_end_addr, function_start, - &end_ptr); + bool found_something = false; // Since not all source lines will contribute code, check if we are // setting the breakpoint on the exact line number or the nearest @@ -991,45 +985,43 @@ protected: for (uint32_t line_number : line_numbers) { LineEntry line_entry; bool exact = false; - uint32_t start_idx_ptr = index_ptr; - start_idx_ptr = sc.comp_unit->FindLineEntry( - index_ptr, line_number, nullptr, exact, &line_entry); - if (start_idx_ptr != UINT32_MAX) - line_number = line_entry.line; + if (sc.comp_unit->FindLineEntry(0, line_number, nullptr, exact, + &line_entry) == UINT32_MAX) + continue; + + found_something = true; + line_number = line_entry.line; exact = true; - start_idx_ptr = index_ptr; - while (start_idx_ptr <= end_ptr) { - start_idx_ptr = sc.comp_unit->FindLineEntry( - start_idx_ptr, line_number, nullptr, exact, &line_entry); - if (start_idx_ptr == UINT32_MAX) - break; - - addr_t address = - line_entry.range.GetBaseAddress().GetLoadAddress(target); - if (address != LLDB_INVALID_ADDRESS) { - if (fun_addr_range.ContainsLoadAddress(address, target)) + uint32_t end_func_idx = line_idx_ranges.GetMaxRangeEnd(0); + uint32_t idx = sc.comp_unit->FindLineEntry( + line_idx_ranges.GetMinRangeBase(UINT32_MAX), line_number, nullptr, + exact, &line_entry); + while (idx < end_func_idx) { + if (line_idx_ranges.FindEntryIndexThatContains(idx) != UINT32_MAX) { + addr_t address = + line_entry.range.GetBaseAddress().GetLoadAddress(target); + if (address != LLDB_INVALID_ADDRESS) address_list.push_back(address); - else - all_in_function = false; } - start_idx_ptr++; + idx = sc.comp_unit->FindLineEntry(idx + 1, line_number, nullptr, + exact, &line_entry); } } for (lldb::addr_t address : m_options.m_until_addrs) { - if (fun_addr_range.ContainsLoadAddress(address, target)) + AddressRange unused; + if (sc.function->GetRangeContainingLoadAddress(address, *target, + unused)) address_list.push_back(address); - else - all_in_function = false; } if (address_list.empty()) { - if (all_in_function) + if (found_something) result.AppendErrorWithFormat( - "No line entries matching until target.\n"); + "Until target outside of the current function.\n"); else result.AppendErrorWithFormat( - "Until target outside of the current function.\n"); + "No line entries matching until target.\n"); return; } |