2 Test that argdumper is a viable launching strategy.
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class LaunchWithShellExpandTestCase(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
16 NO_DEBUG_INFO_TESTCASE = True
23 bugnumber="llvm.org/pr24778 llvm.org/pr22627")
24 @skipIfDarwinEmbedded # iOS etc don't launch the binary via a shell, so arg expansion won't happen
25 @expectedFailureNetBSD
28 exe = self.getBuildArtifact("a.out")
30 self.runCmd("target create %s" % exe)
33 target = self.dbg.CreateTarget(exe)
35 # Create any breakpoints we need
36 breakpoint = target.BreakpointCreateBySourceRegex(
37 'break here', lldb.SBFileSpec("main.cpp", False))
38 self.assertTrue(breakpoint, VALID_BREAKPOINT)
40 # Ensure we do the expansion with /bin/sh on POSIX.
41 os.environ["SHELL"] = '/bin/sh'
44 "process launch -X true -w %s -- fi*.tx? () > <" %
45 (self.getSourceDir()))
47 process = self.process()
49 self.assertTrue(process.GetState() == lldb.eStateStopped,
50 STOPPED_DUE_TO_BREAKPOINT)
52 thread = process.GetThreadAtIndex(0)
54 self.assertTrue(thread.IsValid(),
55 "Process stopped at 'main' should have a valid thread")
57 stop_reason = thread.GetStopReason()
60 stop_reason == lldb.eStopReasonBreakpoint,
61 "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint")
63 self.expect("frame variable argv[1]", substrs=['file1.txt'])
64 self.expect("frame variable argv[2]", substrs=['file2.txt'])
65 self.expect("frame variable argv[3]", substrs=['file3.txt'])
66 self.expect("frame variable argv[4]", substrs=['file4.txy'])
67 self.expect("frame variable argv[5]", substrs=['()'])
68 self.expect("frame variable argv[6]", substrs=['>'])
69 self.expect("frame variable argv[7]", substrs=['<'])
71 "frame variable argv[5]",
72 substrs=['file5.tyx'],
75 "frame variable argv[8]",
76 substrs=['file5.tyx'],
79 self.runCmd("process kill")
82 'process launch -X true -w %s -- "foo bar"' %
83 (self.getSourceDir()))
85 process = self.process()
87 self.assertTrue(process.GetState() == lldb.eStateStopped,
88 STOPPED_DUE_TO_BREAKPOINT)
90 thread = process.GetThreadAtIndex(0)
92 self.assertTrue(thread.IsValid(),
93 "Process stopped at 'main' should have a valid thread")
95 stop_reason = thread.GetStopReason()
98 stop_reason == lldb.eStopReasonBreakpoint,
99 "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint")
101 self.expect("frame variable argv[1]", substrs=['foo bar'])
103 self.runCmd("process kill")
105 self.runCmd('process launch -X true -w %s -- foo\ bar'
106 % (self.getBuildDir()))
108 process = self.process()
110 self.assertTrue(process.GetState() == lldb.eStateStopped,
111 STOPPED_DUE_TO_BREAKPOINT)
113 thread = process.GetThreadAtIndex(0)
115 self.assertTrue(thread.IsValid(),
116 "Process stopped at 'main' should have a valid thread")
118 stop_reason = thread.GetStopReason()
121 stop_reason == lldb.eStopReasonBreakpoint,
122 "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint")
124 self.expect("frame variable argv[1]", substrs=['foo bar'])