"""
Test that argdumper is a viable launching strategy.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestRerun(TestBase):
def test(self):
self.build()
exe = self.getBuildArtifact("a.out")
self.runCmd("target create %s" % exe)
target = self.dbg.CreateTarget(exe)
breakpoint = target.BreakpointCreateBySourceRegex(
"break here", lldb.SBFileSpec("main.cpp", False)
)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
self.runCmd("process launch 1 2 3")
process = self.process()
thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, breakpoint)
self.assertIsNotNone(
thread, "Process should be stopped at a breakpoint in main"
)
self.assertTrue(thread.IsValid(), "Stopped thread is not valid")
self.expect("frame variable argv[1]", substrs=["1"])
self.expect("frame variable argv[2]", substrs=["2"])
self.expect("frame variable argv[3]", substrs=["3"])
self.runCmd("continue")
self.runCmd("process launch")
process = self.process()
thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, breakpoint)
self.assertIsNotNone(
thread, "Process should be stopped at a breakpoint in main"
)
self.assertTrue(thread.IsValid(), "Stopped thread is not valid")
self.expect("frame variable argv[1]", substrs=["1"])
self.expect("frame variable argv[2]", substrs=["2"])
self.expect("frame variable argv[3]", substrs=["3"])