Changeset View
Changeset View
Standalone View
Standalone View
packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
Context not available. | |||||
if self.TraceOn() and error.Success(): | if self.TraceOn() and error.Success(): | ||||
print("Number of supported hardware watchpoints: %d" % num) | print("Number of supported hardware watchpoints: %d" % num) | ||||
@add_test_categories(['pyapi']) | |||||
def test_continue_after_process_exit(self): | |||||
"""Test SBProcess.Continue() API after the process exits.""" | |||||
self.build() | |||||
exe = os.path.join(os.getcwd(), "a.out") | |||||
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) | |||||
target = self.dbg.CreateTarget(exe) | |||||
self.assertTrue(target, VALID_TARGET) | |||||
breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line) | |||||
self.assertTrue(breakpoint, VALID_BREAKPOINT) | |||||
# Launch the process, and do not stop at the entry point. | |||||
process = target.LaunchSimple (None, None, self.get_process_working_directory()) | |||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) | |||||
self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint") | |||||
frame = thread.GetFrameAtIndex(0) | |||||
le = frame.GetLineEntry() | |||||
self.assertTrue(le.IsValid(), "There should be valid line entry at breakpoint") | |||||
self.assertEqual(self.line, le.GetLine(), "There should be valid line number") | |||||
# Continue the return out of main | |||||
err = process.Continue() | |||||
self.assertTrue(err.Success(), "Continue after breakpoint should be valid") | |||||
# At this point, the inferior process should have exited. | |||||
self.assertEqual(lldb.eStateExited, process.GetState(), PROCESS_EXITED) | |||||
# Continue after proces exited should fail with good message, try it multiple times | |||||
for i in range(2): | |||||
err = process.Continue() | |||||
self.assertTrue(err.Fail(), "Continue after exit shouldn't be valid") | |||||
self.assertIn("Process is not alive", err.GetCString()) | |||||
No newline at end of file | |||||
Context not available. |