Skip to content

Commit 7e74472

Browse files
[lldb][testing] Check all stop reasons in get_threads_stopped_at_breakpoint_id (#108281)
If multiple breakpoints are hit at the same time, multiple stop reasons are reported, one per breakpoint. Currently, `get_threads_stopped_at_breakpoint_id` only checks the first such reason.
1 parent b6ff8ed commit 7e74472

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lldb/packages/Python/lldbsuite/test/lldbutil.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,9 +773,16 @@ def get_threads_stopped_at_breakpoint_id(process, bpid):
773773
return threads
774774

775775
for thread in stopped_threads:
776-
# Make sure we've hit our breakpoint...
777-
break_id = thread.GetStopReasonDataAtIndex(0)
778-
if break_id == bpid:
776+
# Make sure we've hit our breakpoint.
777+
# From the docs of GetStopReasonDataAtIndex: "Breakpoint stop reasons
778+
# will have data that consists of pairs of breakpoint IDs followed by
779+
# the breakpoint location IDs".
780+
# Iterate over all such pairs looking for `bpid`.
781+
break_ids = [
782+
thread.GetStopReasonDataAtIndex(idx)
783+
for idx in range(0, thread.GetStopReasonDataCount(), 2)
784+
]
785+
if bpid in break_ids:
779786
threads.append(thread)
780787

781788
return threads

0 commit comments

Comments
 (0)