Skip to content

Commit 6e1f15d

Browse files
committed
rebase on top of llvm#127806
1 parent 8c04565 commit 6e1f15d

File tree

1 file changed

+16
-31
lines changed

1 file changed

+16
-31
lines changed

lldb/source/Commands/CommandObjectThread.cpp

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -969,24 +969,12 @@ class CommandObjectThreadUntil : public CommandObjectParsed {
969969
return;
970970
}
971971

972-
uint32_t lowest_func_idx = UINT32_MAX;
973-
uint32_t highest_func_idx = 0;
974-
for (AddressRange range : sc.function->GetAddressRanges()) {
975-
uint32_t idx;
976-
LineEntry unused;
977-
Address addr = range.GetBaseAddress();
978-
if (line_table->FindLineEntryByAddress(addr, unused, &idx))
979-
lowest_func_idx = std::min(lowest_func_idx, idx);
980-
981-
addr.Slide(range.GetByteSize());
982-
if (line_table->FindLineEntryByAddress(addr, unused, &idx)) {
983-
highest_func_idx = std::max(highest_func_idx, idx);
984-
} else {
985-
// No line entry after the current function. The function is the
986-
// last in the file, so we can just search until the end.
987-
highest_func_idx = UINT32_MAX;
988-
}
972+
RangeVector<uint32_t, uint32_t> line_idx_ranges;
973+
for (const AddressRange &range : sc.function->GetAddressRanges()) {
974+
auto [begin, end] = line_table->GetLineEntryIndexRange(range);
975+
line_idx_ranges.Append(begin, end - begin);
989976
}
977+
line_idx_ranges.Sort();
990978

991979
bool found_something = false;
992980

@@ -1004,22 +992,19 @@ class CommandObjectThreadUntil : public CommandObjectParsed {
1004992
found_something = true;
1005993
line_number = line_entry.line;
1006994
exact = true;
1007-
uint32_t start_idx_ptr = lowest_func_idx;
1008-
while (start_idx_ptr <= highest_func_idx) {
1009-
start_idx_ptr = sc.comp_unit->FindLineEntry(
1010-
start_idx_ptr, line_number, nullptr, exact, &line_entry);
1011-
if (start_idx_ptr == UINT32_MAX)
1012-
break;
1013-
1014-
addr_t address =
1015-
line_entry.range.GetBaseAddress().GetLoadAddress(target);
1016-
if (address != LLDB_INVALID_ADDRESS) {
1017-
AddressRange unused;
1018-
if (sc.function->GetRangeContainingLoadAddress(address, *target,
1019-
unused))
995+
uint32_t end_func_idx = line_idx_ranges.GetMaxRangeEnd(0);
996+
uint32_t idx = sc.comp_unit->FindLineEntry(
997+
line_idx_ranges.GetMinRangeBase(UINT32_MAX), line_number, nullptr,
998+
exact, &line_entry);
999+
while (idx < end_func_idx) {
1000+
if (line_idx_ranges.FindEntryIndexThatContains(idx) != UINT32_MAX) {
1001+
addr_t address =
1002+
line_entry.range.GetBaseAddress().GetLoadAddress(target);
1003+
if (address != LLDB_INVALID_ADDRESS)
10201004
address_list.push_back(address);
10211005
}
1022-
start_idx_ptr++;
1006+
idx = sc.comp_unit->FindLineEntry(idx + 1, line_number, nullptr,
1007+
exact, &line_entry);
10231008
}
10241009
}
10251010

0 commit comments

Comments
 (0)