aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/exec/TestExec.py')
-rw-r--r--packages/Python/lldbsuite/test/functionalities/exec/TestExec.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py b/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
index 9321a308a83c..912d51fb6b02 100644
--- a/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
+++ b/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
@@ -8,9 +8,10 @@ from __future__ import print_function
import lldb
import os
import time
+from lldbsuite.support import seven
+from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
-import lldbsuite.test.lldbutil as lldbutil
-import lldbsuite.support.seven as seven
+from lldbsuite.test import lldbutil
def execute_command (command):
#print('%% %s' % (command))
@@ -55,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()
@@ -71,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.")