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
):
14 NO_DEBUG_INFO_TESTCASE
= True
17 oslist
=["windows", "linux", "freebsd"],
18 bugnumber
="llvm.org/pr24778 llvm.org/pr22627 llvm.org/pr48349",
20 @skipIfDarwinEmbedded # iOS etc don't launch the binary via a shell, so arg expansion won't happen
21 @expectedFailureNetBSD
24 target
= self
.createTestTarget()
26 # Create any breakpoints we need
27 breakpoint
= target
.BreakpointCreateBySourceRegex(
28 "break here", lldb
.SBFileSpec("main.cpp", False)
30 self
.assertTrue(breakpoint
, VALID_BREAKPOINT
)
32 # Ensure we do the expansion with /bin/sh on POSIX.
33 os
.environ
["SHELL"] = "/bin/sh"
36 "process launch -X true -w %s -- fi*.tx? () > <" % (self
.getSourceDir())
39 process
= self
.process()
42 process
.GetState(), lldb
.eStateStopped
, STOPPED_DUE_TO_BREAKPOINT
45 thread
= process
.GetThreadAtIndex(0)
48 thread
.IsValid(), "Process stopped at 'main' should have a valid thread"
51 stop_reason
= thread
.GetStopReason()
55 lldb
.eStopReasonBreakpoint
,
56 "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint",
59 self
.expect_var_path("argv[1]", summary
='"file1.txt"')
60 self
.expect_var_path("argv[2]", summary
='"file2.txt"')
61 self
.expect_var_path("argv[3]", summary
='"file3.txt"')
62 self
.expect_var_path("argv[4]", summary
='"file4.txy"')
63 self
.expect_var_path("argv[5]", summary
='"()"')
64 self
.expect_var_path("argv[6]", summary
='">"')
65 self
.expect_var_path("argv[7]", summary
='"<"')
66 self
.expect_var_path("argc", value
="8")
68 self
.runCmd("process kill")
70 self
.runCmd('process launch -X true -w %s -- "foo bar"' % (self
.getSourceDir()))
72 process
= self
.process()
75 process
.GetState(), lldb
.eStateStopped
, STOPPED_DUE_TO_BREAKPOINT
78 thread
= process
.GetThreadAtIndex(0)
81 thread
.IsValid(), "Process stopped at 'main' should have a valid thread"
84 stop_reason
= thread
.GetStopReason()
88 lldb
.eStopReasonBreakpoint
,
89 "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint",
92 self
.expect("frame variable argv[1]", substrs
=["foo bar"])
94 self
.runCmd("process kill")
96 self
.runCmd("process launch -X true -w %s -- foo\ bar" % (self
.getBuildDir()))
98 process
= self
.process()
101 process
.GetState(), lldb
.eStateStopped
, STOPPED_DUE_TO_BREAKPOINT
104 thread
= process
.GetThreadAtIndex(0)
107 thread
.IsValid(), "Process stopped at 'main' should have a valid thread"
110 stop_reason
= thread
.GetStopReason()
114 lldb
.eStopReasonBreakpoint
,
115 "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint",
118 self
.expect("frame variable argv[1]", substrs
=["foo bar"])