summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint
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/functionalities/breakpoint
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/functionalities/breakpoint')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
index af6df376482..1a3b26f4548 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
@@ -27,7 +27,7 @@ class ConsecutiveBreakpoitsTestCase(TestBase):
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 @@ class ConsecutiveBreakpoitsTestCase(TestBase):
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 @@ class ConsecutiveBreakpoitsTestCase(TestBase):
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()
OpenPOWER on IntegriCloud