Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs.py +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs.py @@ -130,12 +130,8 @@ "instead the actual state is: '%s'" % lldbutil.state_type_to_str(process.GetState())) - # The stop reason of the thread should be breakpoint. - thread = process.GetThreadAtIndex(0) - if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbsuite.test.lldbutil import stop_reason_to_str - self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - stop_reason_to_str(thread.GetStopReason())) + thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, breakpoint) + self.assertIsNotNone(thread, "Expected one thread to be stopped at the breakpoint") # The filename of frame #0 should be 'main.cpp' and function is main. self.expect(lldbutil.get_filenames(thread)[0], Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py @@ -27,7 +27,7 @@ target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) - breakpoint = target.BreakpointCreateBySourceRegex("Set breakpoint here", lldb.SBFileSpec("main.cpp")) + breakpoint1 = target.BreakpointCreateBySourceRegex("Set breakpoint here", lldb.SBFileSpec("main.cpp")) self.assertTrue(breakpoint and breakpoint.GetNumLocations() == 1, VALID_BREAKPOINT) @@ -37,8 +37,8 @@ self.assertTrue(process, PROCESS_IS_VALID) # We should be stopped at the first breakpoint - thread = process.GetThreadAtIndex(0) - self.assertEqual(thread.GetStopReason(), lldb.eStopReasonBreakpoint) + thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, breakpoint1) + self.assertIsNotNone(thread, "Expected one thread to be stopped at breakpoint 1") # Set breakpoint to the next instruction frame = thread.GetFrameAtIndex(0) @@ -48,12 +48,12 @@ self.assertTrue(len(instructions) == 2) address = instructions[1].GetAddress() - target.BreakpointCreateByAddress(address.GetLoadAddress(target)) + breakpoint2 = target.BreakpointCreateByAddress(address.GetLoadAddress(target)) process.Continue() # We should be stopped at the second breakpoint - thread = process.GetThreadAtIndex(0) - self.assertEqual(thread.GetStopReason(), lldb.eStopReasonBreakpoint) + thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, breakpoint2) + self.assertIsNotNone(thread, "Expected one thread to be stopped at breakpoint 2") # Run the process until termination process.Continue() Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py @@ -64,7 +64,8 @@ for j in range(10): if self.TraceOn(): print("j is: ", j) - thread = process.GetThreadAtIndex(0) + thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, breakpoint) + self.assertIsNotNone(thread, "Expected one thread to be stopped at the breakpoint") if thread.GetNumFrames() >= 2: frame0 = thread.GetFrameAtIndex(0) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py @@ -38,11 +38,8 @@ # The stop reason should be breakpoint. self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) - self.assertEqual(lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint).IsValid(), 1, - STOPPED_DUE_TO_BREAKPOINT) - - thread = process.GetThreadAtIndex(0) - self.assertTrue(thread and thread.IsValid(), "Thread is valid") + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertTrue(thread.IsValid(), STOPPED_DUE_TO_BREAKPOINT) # Keep stepping until the inferior crashes while process.GetState() == lldb.eStateStopped and not lldbutil.is_thread_crashed(self, thread): Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py @@ -55,7 +55,7 @@ num_threads = process.GetNumThreads() # Make sure we see all three threads - self.assertTrue(num_threads == 3, 'Number of expected threads and actual threads do not match.') + self.assertTrue(num_threads >= 3, 'Number of expected threads and actual threads do not match.') # Get the thread objects thread1 = process.GetThreadAtIndex(0) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py @@ -69,28 +69,17 @@ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1) + bp = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1) # Run the program. self.runCmd("run", RUN_SUCCEEDED) - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - '* thread #1', - 'stop reason = breakpoint']) - # Get the target process target = self.dbg.GetSelectedTarget() process = target.GetProcess() - # Get the number of threads - num_threads = process.GetNumThreads() - - self.assertTrue(num_threads == 1, 'Number of expected threads and actual threads do not match.') - - # Get the thread object - thread = process.GetThreadAtIndex(0) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) # Make sure the thread is in the stopped state. self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' during breakpoint 1.") @@ -117,23 +106,12 @@ # Run the program. self.runCmd("run", RUN_SUCCEEDED) - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - '* thread #1', - 'stop reason = breakpoint']) - # Get the target process target = self.dbg.GetSelectedTarget() process = target.GetProcess() - # Get the number of threads - num_threads = process.GetNumThreads() - - self.assertTrue(num_threads == 1, 'Number of expected threads and actual threads do not match.') - - # Get the thread object - thread = process.GetThreadAtIndex(0) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change. self.dbg.SetAsync(True) @@ -162,23 +140,12 @@ # Run the program. self.runCmd("run", RUN_SUCCEEDED) - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - '* thread #1', - 'stop reason = breakpoint']) - # Get the target process target = self.dbg.GetSelectedTarget() process = target.GetProcess() - # Get the number of threads - num_threads = process.GetNumThreads() - - self.assertTrue(num_threads == 1, 'Number of expected threads and actual threads do not match.') - - # Get the thread object - thread = process.GetThreadAtIndex(0) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) # Get the inferior out of its loop self.runCmd("expression g_test = 1") @@ -202,20 +169,12 @@ # Run the program. self.runCmd("run", RUN_SUCCEEDED) - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - '* thread #1', - 'stop reason = breakpoint']) - # Get the target process target = self.dbg.GetSelectedTarget() process = target.GetProcess() - # Get the number of threads - num_threads = process.GetNumThreads() - - self.assertTrue(num_threads == 1, 'Number of expected threads and actual threads do not match.') + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change. self.dbg.SetAsync(True) @@ -228,11 +187,7 @@ # Stop the process self.runCmd("process interrupt") - # The stop reason of the thread should be signal. - self.expect("process status", STOPPED_DUE_TO_SIGNAL, - substrs = ['stopped', - '* thread #1', - 'stop reason = signal']) + self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal) # Get the inferior out of its loop self.runCmd("expression g_test = 1") @@ -252,23 +207,11 @@ # Run the program. self.runCmd("run", RUN_SUCCEEDED) - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - '* thread #1', - 'stop reason = breakpoint']) - # Get the target process target = self.dbg.GetSelectedTarget() process = target.GetProcess() - - # Get the number of threads - num_threads = process.GetNumThreads() - - self.assertTrue(num_threads == 1, 'Number of expected threads and actual threads do not match.') - - # Get the thread object - thread = process.GetThreadAtIndex(0) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) # Make sure the thread is in the stopped state. self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' during breakpoint 1.") @@ -289,11 +232,7 @@ # Stop the process self.runCmd("process interrupt") - # The stop reason of the thread should be signal. - self.expect("process status", STOPPED_DUE_TO_SIGNAL, - substrs = ['stopped', - '* thread #1', - 'stop reason = signal']) + self.assertEqual(thread.GetState(), lldb.eStopReasonSignal) # Check the thread state self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' after process stop.") @@ -306,20 +245,12 @@ self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' after expression evaluation.") self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' after expression evaluation.") - # The stop reason of the thread should be signal. - self.expect("process status", STOPPED_DUE_TO_SIGNAL, - substrs = ['stopped', - '* thread #1', - 'stop reason = signal']) + self.assertEqual(thread.GetState(), lldb.eStopReasonSignal) # Run to breakpoint 2 self.runCmd("continue") - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - '* thread #1', - 'stop reason = breakpoint']) + self.assertEqual(thread.GetState(), lldb.eStopReasonBreakpoint) # Make sure both threads are stopped self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' during breakpoint 2.") @@ -329,4 +260,4 @@ self.runCmd("continue") # At this point, the inferior process should have exited. - self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) + self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED) Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py @@ -100,11 +100,8 @@ "executable = a.out"]) # The stop reason of the thread should be breakpoint. - thread = process.GetThreadAtIndex(0) - if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbsuite.test.lldbutil import stop_reason_to_str - self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - stop_reason_to_str(thread.GetStopReason())) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) # Sanity check the print representation of thread. thr = str(thread) @@ -120,7 +117,7 @@ substrs = [tidstr]) # The breakpoint should have a hit count of 1. - self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE) + self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE) # The breakpoint should be resolved by now. bp = str(breakpoint) Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py @@ -112,14 +112,11 @@ self.assertTrue(process, PROCESS_IS_VALID) # The stop reason of the thread should be breakpoint. - thread = target.GetProcess().GetThreadAtIndex(0) - if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbsuite.test.lldbutil import stop_reason_to_str - self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - stop_reason_to_str(thread.GetStopReason())) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) # The breakpoint should have a hit count of 1. - self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE) + self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE) # Lookup the "bits" variable which contains 8 bitfields. frame = thread.GetFrameAtIndex(0) Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py @@ -69,11 +69,8 @@ self.assertTrue(process, PROCESS_IS_VALID) # The stop reason of the thread should be breakpoint. - thread = process.GetThreadAtIndex(0) - if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbsuite.test.lldbutil import stop_reason_to_str - self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - stop_reason_to_str(thread.GetStopReason())) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) # Get the SBValue of 'A::g_points' and 'g_points'. frame = thread.GetFrameAtIndex(0) Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py @@ -92,11 +92,8 @@ lldbutil.state_type_to_str(process.GetState())) # The stop reason of the thread should be breakpoint. - thread = process.GetThreadAtIndex(0) - if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbsuite.test.lldbutil import stop_reason_to_str - self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - stop_reason_to_str(thread.GetStopReason())) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) # The filename of frame #0 should be 'main.cpp' and the line number # should be 93. @@ -203,11 +200,8 @@ lldbutil.state_type_to_str(process.GetState())) # The stop reason of the thread should be breakpoint. - thread = process.GetThreadAtIndex(0) - if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbsuite.test.lldbutil import stop_reason_to_str - self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - stop_reason_to_str(thread.GetStopReason())) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) frame = thread.frames[0] self.assertTrue (frame.IsValid(), "Got a valid frame.") Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py @@ -46,7 +46,8 @@ # disassemble it. target = self.dbg.GetSelectedTarget() process = target.GetProcess() - thread = process.GetThreadAtIndex(0) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) depth = thread.GetNumFrames() for i in range(depth - 1): frame = thread.GetFrameAtIndex(i) Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py @@ -20,7 +20,8 @@ self.set_breakpoint(line_number('main.cpp', '// breakpoint 2')) process = target.LaunchSimple (None, None, self.get_process_working_directory()) self.assertTrue(process, PROCESS_IS_VALID) - thread = process.GetThreadAtIndex(0) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) frame = thread.GetFrameAtIndex(0) j1 = frame.FindVariable("j1") j1_Derived1 = j1.GetChildAtIndex(0) Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py @@ -51,7 +51,8 @@ # Disassemble the functions on the call stack. self.runCmd("thread backtrace") - thread = process.GetThreadAtIndex(0) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) depth = thread.GetNumFrames() for i in range(depth - 1): frame = thread.GetFrameAtIndex(i) Index: lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py +++ lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py @@ -566,6 +566,15 @@ return threads +def get_one_thread_stopped_at_breakpoint(process, bkpt, require_exactly_one = True): + threads = get_threads_stopped_at_breakpoint(process, bkpt) + if len(threads) == 0: + return None + if require_exactly_one and len(threads) != 1: + return None + + return threads[0] + def is_thread_crashed (test, thread): """In the test suite we dereference a null pointer to simulate a crash. The way this is reported depends on the platform.""" Index: lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py +++ lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py @@ -49,7 +49,8 @@ from six import StringIO as SixStringIO session = SixStringIO() while process.GetState() == lldb.eStateStopped: - thread = process.GetThreadAtIndex(0) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) # Inspect at most 3 frames. numFrames = min(3, thread.GetNumFrames()) for i in range(numFrames): @@ -134,7 +135,8 @@ self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED) - thread = process.GetThreadAtIndex(0) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) frame = thread.GetFrameAtIndex(0) if self.TraceOn(): print("frame:", frame) @@ -173,8 +175,8 @@ self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED) - thread = process.GetThreadAtIndex(0) - self.assertTrue(thread) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) frameEntered = thread.GetFrameAtIndex(0) if self.TraceOn(): Index: lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py +++ lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py @@ -60,7 +60,10 @@ # # outer_inline (argc); # - frame0 = process.GetThreadAtIndex(0).GetFrameAtIndex(0) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) + + frame0 = thread.GetFrameAtIndex(0) if frame0.IsInlined(): filename = frame0.GetLineEntry().GetFileSpec().GetFilename() self.assertTrue(filename == self.source) Index: lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py +++ lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py @@ -64,14 +64,11 @@ process = target.GetProcess() self.assertTrue(process, PROCESS_IS_VALID) - thread = process.GetThreadAtIndex(0) - if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbsuite.test.lldbutil import stop_reason_to_str - self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - stop_reason_to_str(thread.GetStopReason())) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) # The breakpoint should have a hit count of 1. - self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE) + self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE) @add_test_categories(['pyapi']) @expectedFailureWindows("llvm.org/pr24600") Index: lldb/trunk/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py +++ lldb/trunk/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py @@ -38,8 +38,9 @@ target = self.dbg.GetSelectedTarget() process = target.GetProcess() - - thread = process.GetThreadAtIndex(0) + + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertIsNotNone(thread) frame = thread.GetSelectedFrame() if self.TraceOn():