2 Test that argdumper is a viable launching strategy.
4 from __future__ import print_function
11 from lldbsuite.test.lldbtest import *
12 import lldbsuite.test.lldbutil as lldbutil
14 class TestRerun(TestBase):
16 mydir = TestBase.compute_mydir(__file__)
20 exe = os.path.join (os.getcwd(), "a.out")
22 self.runCmd("target create %s" % exe)
25 target = self.dbg.CreateTarget(exe)
27 # Create any breakpoints we need
28 breakpoint = target.BreakpointCreateBySourceRegex ('break here', lldb.SBFileSpec ("main.cpp", False))
29 self.assertTrue(breakpoint, VALID_BREAKPOINT)
31 self.runCmd("process launch 1 2 3")
33 process = self.process()
35 self.assertTrue(process.GetState() == lldb.eStateStopped,
36 STOPPED_DUE_TO_BREAKPOINT)
38 thread = process.GetThreadAtIndex (0)
40 self.assertTrue (thread.IsValid(),
41 "Process stopped at 'main' should have a valid thread");
43 stop_reason = thread.GetStopReason()
45 self.assertTrue (stop_reason == lldb.eStopReasonBreakpoint,
46 "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint");
48 self.expect("frame variable argv[1]", substrs=['1'])
49 self.expect("frame variable argv[2]", substrs=['2'])
50 self.expect("frame variable argv[3]", substrs=['3'])
53 self.runCmd("continue")
55 # Re-run with no args and make sure we still run with 1 2 3 as arguments as
56 # they should have been stored in "target.run-args"
57 self.runCmd("process launch")
59 process = self.process()
61 self.assertTrue(process.GetState() == lldb.eStateStopped,
62 STOPPED_DUE_TO_BREAKPOINT)
64 thread = process.GetThreadAtIndex (0)
66 self.assertTrue (thread.IsValid(),
67 "Process stopped at 'main' should have a valid thread");
69 stop_reason = thread.GetStopReason()
71 self.assertTrue (stop_reason == lldb.eStopReasonBreakpoint,
72 "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint");
74 self.expect("frame variable argv[1]", substrs=['1'])
75 self.expect("frame variable argv[2]", substrs=['2'])
76 self.expect("frame variable argv[3]", substrs=['3'])