diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lang/cpp')
5 files changed, 12 insertions, 18 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py index d47d1b7dde4..9df6b123fce 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py @@ -69,11 +69,8 @@ class StaticVariableTestCase(TestBase): 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) diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py index b67e53c3074..7b89a911e08 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py @@ -92,11 +92,8 @@ class ClassTypesTestCase(TestBase): 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 @@ class ClassTypesTestCase(TestBase): 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.") diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py index 595d075d518..a423ed3b23a 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py @@ -46,7 +46,8 @@ class IterateFrameAndDisassembleTestCase(TestBase): # 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) diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py index 67de03b54b2..d525e12b31e 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py @@ -20,7 +20,8 @@ class CPPTestDiamondInheritance(TestBase): 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) diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py index d7435c46727..865516de4ed 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py @@ -51,7 +51,8 @@ class StdCXXDisassembleTestCase(TestBase): # 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) |