[Lldb-commits] [lldb] [lldb][testing] Check all stop reasons in get_threads_stopped_at_breakpoint_id (PR #108281)
Felipe de Azevedo Piovezan via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 11 12:48:30 PDT 2024
https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/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.
>From 09a4e6192345541c5c3ce7c3a78a64e8a29e3c64 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
Date: Wed, 11 Sep 2024 12:45:18 -0700
Subject: [PATCH] [lldb][testing] Check all stop reasons in
get_threads_stopped_at_breakpoint_id
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.
---
lldb/packages/Python/lldbsuite/test/lldbutil.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index 629565b38ca1e6..660a3c085a908a 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -773,9 +773,16 @@ def get_threads_stopped_at_breakpoint_id(process, bpid):
return threads
for thread in stopped_threads:
- # Make sure we've hit our breakpoint...
- break_id = thread.GetStopReasonDataAtIndex(0)
- if break_id == bpid:
+ # Make sure we've hit our breakpoint.
+ # From the docs of GetStopReasonDataAtIndex: "Breakpoint stop reasons
+ # will have data that consists of pairs of breakpoint IDs followed by
+ # the breakpoint location IDs".
+ # Iterate over all such pairs looking for `bpid`.
+ break_ids = [
+ thread.GetStopReasonDataAtIndex(idx)
+ for idx in range(0, thread.GetStopReasonDataCount(), 2)
+ ]
+ if bpid in break_ids:
threads.append(thread)
return threads
More information about the lldb-commits
mailing list