Author: Felipe de Azevedo Piovezan Date: 2024-09-12T07:01:59-07:00 New Revision: 7e74472801486cc702fba3e831c8fcd77c120142
URL: https://github.com/llvm/llvm-project/commit/7e74472801486cc702fba3e831c8fcd77c120142 DIFF: https://github.com/llvm/llvm-project/commit/7e74472801486cc702fba3e831c8fcd77c120142.diff LOG: [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. Added: Modified: lldb/packages/Python/lldbsuite/test/lldbutil.py Removed: ################################################################################ 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 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits