diff options
author | Pavel Labath <labath@google.com> | 2017-05-24 09:46:48 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2017-05-24 09:46:48 +0000 |
commit | 0dc2ad1b1316bd6ef7ae4d011c989d359c4e1d82 (patch) | |
tree | 8ae7fa7f08687a73f18c996d1ada6da9fc1b6585 /lldb/packages/Python/lldbsuite/test | |
parent | 2676f8269a1e2b4bf9b92868ecb0f3c5ebe76eb6 (diff) | |
download | bcm5719-llvm-0dc2ad1b1316bd6ef7ae4d011c989d359c4e1d82.tar.gz bcm5719-llvm-0dc2ad1b1316bd6ef7ae4d011c989d359c4e1d82.zip |
RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false
Summary:
The function had logic to handle the case when the expression terminated
while we were trying to halt the process, but it failed to take into
account the possibility that the expression stopped because it hit a
breakpoint. This was caused by the fact that the handling of the stopped
events was duplicated for the "halting" and regular cases (the regular
case handled this situation correctly). I've tried to merge these two
cases into one to make sure they stay in sync.
I should call out that the two cases were checking whether the thread
plan has completed in slightly different ways. I am not sure what is the
difference between them, but I think the check should be the same in
both cases, whatever it is, so I just took the one from the regular
case, as that is probably more tested.
For the test, I modified TestUnwindExpression to run the expression with
a smaller timeout (this is how I found this bug originally). With a 1ms
one thread timeout, the test failed consistently without this patch.
Reviewers: jingham
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D33283
llvm-svn: 303732
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py b/lldb/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py index bfd6f4642c6..25cc95030fe 100644 --- a/lldb/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py +++ b/lldb/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py @@ -57,19 +57,27 @@ class UnwindFromExpressionTest(TestBase): self.assertIsNotNone( thread, "Expected one thread to be stopped at the breakpoint") - # - # Use Python API to evaluate expressions while stopped in a stack frame. - # - main_frame = thread.GetFrameAtIndex(0) - # Next set a breakpoint in this function, set up Expression options to stop on # breakpoint hits, and call the function. fun_bkpt = target.BreakpointCreateBySourceRegex( "// Stop inside the function here.", main_spec) self.assertTrue(fun_bkpt, VALID_BREAKPOINT) + + # Run test with varying one thread timeouts to also test the halting + # logic in the IgnoreBreakpoints = False case + self.do_test(thread, fun_bkpt, 1000) + self.do_test(thread, fun_bkpt, 100000) + + def do_test(self, thread, bkpt, timeout): + # + # Use Python API to evaluate expressions while stopped in a stack frame. + # + main_frame = thread.GetFrameAtIndex(0) + options = lldb.SBExpressionOptions() options.SetIgnoreBreakpoints(False) options.SetUnwindOnError(False) + options.SetOneThreadTimeoutInMicroSeconds(timeout) val = main_frame.EvaluateExpression("a_function_to_call()", options) @@ -82,7 +90,7 @@ class UnwindFromExpressionTest(TestBase): "And the reason was right.") thread = lldbutil.get_one_thread_stopped_at_breakpoint( - process, fun_bkpt) + self.process(), bkpt) self.assertTrue( thread.IsValid(), "We are indeed stopped at our breakpoint") |