diff options
author | Jim Ingham <jingham@apple.com> | 2016-02-12 00:03:19 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2016-02-12 00:03:19 +0000 |
commit | 0ea010aecb591df0d857de32945bb4ba840a67e4 (patch) | |
tree | 7777a7233cb05da94c224538d35e6f78c2cf8c9e /lldb/packages/Python/lldbsuite/test | |
parent | e5fc9f35138bbde114cb63700a4708d4130cdcf1 (diff) | |
download | bcm5719-llvm-0ea010aecb591df0d857de32945bb4ba840a67e4.tar.gz bcm5719-llvm-0ea010aecb591df0d857de32945bb4ba840a67e4.zip |
When calling TypeSystemMap::Clear, objects being destroyed in the process of
clearing the map ended up calling back into the TypeSystemMap to do lookups.
Not a good idea, and in this case it would cause a deadlock.
You would only see this when replacing the target contents after an exec, and only if you
had stopped before the exec, evaluated an expression, then continued
on to the point where you did the exec.
Fixed this by making sure the TypeSystemMap::Clear tears down the TypeSystems in the map before clearing the map.
I also add an expression before exec to the TestExec.py so that we'll catch this
issue if it crops up again in the future.
<rdar://problem/24554920>
llvm-svn: 260624
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py b/lldb/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py index e84ddd6cd28..912d51fb6b0 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py @@ -56,15 +56,18 @@ class ExecTestCase(TestBase): self.assertTrue(process.GetState() == lldb.eStateStopped, STOPPED_DUE_TO_BREAKPOINT) - thread = process.GetThreadAtIndex (0) + threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint) + self.assertTrue(len(threads) == 1) - self.assertTrue (thread.IsValid(), - "Process stopped at 'main' should have a valid thread"); + # We had a deadlock tearing down the TypeSystemMap on exec, but only if some + # expression had been evaluated. So make sure we do that here so the teardown + # is not trivial. - stop_reason = thread.GetStopReason() - - self.assertTrue (stop_reason == lldb.eStopReasonBreakpoint, - "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint"); + thread = threads[0] + value = thread.frames[0].EvaluateExpression("1 + 2") + self.assertTrue(value.IsValid(), "Expression evaluated successfully") + int_value = value.GetValueAsSigned() + self.assertTrue(int_value == 3, "Expression got the right result.") # Run and we should stop due to exec process.Continue() @@ -72,15 +75,11 @@ class ExecTestCase(TestBase): self.assertTrue(process.GetState() == lldb.eStateStopped, "Process should be stopped at __dyld_start") - thread = process.GetThreadAtIndex (0) - - self.assertTrue (thread.IsValid(), - "Process stopped at exec should have a valid thread"); - - stop_reason = thread.GetStopReason() - - self.assertTrue (stop_reason == lldb.eStopReasonExec, - "Thread in process stopped on exec should have a stop reason of eStopReasonExec"); - + threads = lldbutil.get_stopped_threads(process, lldb.eStopReasonExec) + self.assertTrue(len(threads) == 1, "We got a thread stopped for exec.") + # Run and we should stop at breakpoint in main after exec process.Continue() + + threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint) + self.assertTrue(len(threads) == 1, "Stopped at breakpoint in exec'ed process.") |