Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / functionalities / rerun / TestRerun.py
blob0c74b714982448751753c8e41d6f46e4e78ab21c
1 """
2 Test that argdumper is a viable launching strategy.
3 """
6 import lldb
7 from lldbsuite.test.decorators import *
8 from lldbsuite.test.lldbtest import *
9 from lldbsuite.test import lldbutil
12 class TestRerun(TestBase):
13 def test(self):
14 self.build()
15 exe = self.getBuildArtifact("a.out")
17 self.runCmd("target create %s" % exe)
19 # Create the target
20 target = self.dbg.CreateTarget(exe)
22 # Create any breakpoints we need
23 breakpoint = target.BreakpointCreateBySourceRegex(
24 "break here", lldb.SBFileSpec("main.cpp", False)
26 self.assertTrue(breakpoint, VALID_BREAKPOINT)
28 self.runCmd("process launch 1 2 3")
30 process = self.process()
31 thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, breakpoint)
32 self.assertIsNotNone(
33 thread, "Process should be stopped at a breakpoint in main"
35 self.assertTrue(thread.IsValid(), "Stopped thread is not valid")
37 self.expect("frame variable argv[1]", substrs=["1"])
38 self.expect("frame variable argv[2]", substrs=["2"])
39 self.expect("frame variable argv[3]", substrs=["3"])
41 # Let program exit
42 self.runCmd("continue")
44 # Re-run with no args and make sure we still run with 1 2 3 as arguments as
45 # they should have been stored in "target.run-args"
46 self.runCmd("process launch")
48 process = self.process()
49 thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, breakpoint)
51 self.assertIsNotNone(
52 thread, "Process should be stopped at a breakpoint in main"
54 self.assertTrue(thread.IsValid(), "Stopped thread is not valid")
56 self.expect("frame variable argv[1]", substrs=["1"])
57 self.expect("frame variable argv[2]", substrs=["2"])
58 self.expect("frame variable argv[3]", substrs=["3"])