summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/lang/cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-01-21 21:07:30 +0000
committerZachary Turner <zturner@google.com>2016-01-21 21:07:30 +0000
commit783550be6211b65de45c4c44eac339311f3ae1e2 (patch)
tree4827f9b6759311267e2f86d95c6426f76d6b6ae6 /lldb/packages/Python/lldbsuite/test/lang/cpp
parentbef81f3a70028699965700e6b77dcb8952abcc85 (diff)
downloadbcm5719-llvm-783550be6211b65de45c4c44eac339311f3ae1e2.tar.gz
bcm5719-llvm-783550be6211b65de45c4c44eac339311f3ae1e2.zip
Remove assumptions that thread 0 is always the main thread.
Starting with Windows 10, the Windows loader is itself multi-threaded, meaning that the loader spins up a few threads to do process initialization before it executes main. Windows delivers these notifications asynchronously and they can come out of order, so we can't be sure that the first thread we get a notification about is actually the zero'th thread. This patch fixes this by requesting the thread stopped at the breakpoint that was specified, rather than getting thread 0 and verifying that it is stopped at a breakpoint. Differential Revision: http://reviews.llvm.org/D16247 llvm-svn: 258432
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lang/cpp')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py7
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py14
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py3
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py3
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py3
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)
OpenPOWER on IntegriCloud