@@ -38,14 +38,12 @@ MakeArgv(const llvm::ArrayRef<std::string> &strs) {
3838 return argv;
3939}
4040
41- static uint32_t SetLaunchFlag (uint32_t flags, std::optional< bool > flag,
41+ static uint32_t SetLaunchFlag (uint32_t flags, bool flag,
4242 lldb::LaunchFlags mask) {
43- if (flag) {
44- if (*flag)
45- flags |= mask;
46- else
47- flags &= ~mask;
48- }
43+ if (flag)
44+ flags |= mask;
45+ else
46+ flags &= ~mask;
4947
5048 return flags;
5149}
@@ -107,7 +105,8 @@ RunInTerminal(DAP &dap, const protocol::LaunchRequestArguments &arguments) {
107105 return llvm::make_error<DAPError>(" Cannot use runInTerminal, feature is "
108106 " not supported by the connected client" );
109107
110- if (!arguments.program || arguments.program ->empty ())
108+ if (!arguments.configuration .program ||
109+ arguments.configuration .program ->empty ())
111110 return llvm::make_error<DAPError>(
112111 " program must be set to when using runInTerminal" );
113112
@@ -128,7 +127,7 @@ RunInTerminal(DAP &dap, const protocol::LaunchRequestArguments &arguments) {
128127#endif
129128
130129 llvm::json::Object reverse_request = CreateRunInTerminalReverseRequest (
131- *arguments.program , arguments.args , arguments.env ,
130+ *arguments.configuration . program , arguments.args , arguments.env ,
132131 arguments.cwd .value_or (" " ), comm_file.m_path , debugger_pid);
133132 dap.SendReverseRequest <LogFailureResponseHandler>(" runInTerminal" ,
134133 std::move (reverse_request));
@@ -223,23 +222,21 @@ llvm::Error BaseRequestHandler::LaunchProcess(
223222 launch_info.SetEnvironment (env, true );
224223 }
225224
226- auto flags = launch_info.GetLaunchFlags ();
225+ launch_info.SetDetachOnError (arguments.detachOnError );
226+ launch_info.SetShellExpandArguments (arguments.shellExpandArguments );
227227
228+ auto flags = launch_info.GetLaunchFlags ();
228229 flags =
229230 SetLaunchFlag (flags, arguments.disableASLR , lldb::eLaunchFlagDisableASLR);
230231 flags = SetLaunchFlag (flags, arguments.disableSTDIO ,
231232 lldb::eLaunchFlagDisableSTDIO);
232- flags = SetLaunchFlag (flags, arguments.shellExpandArguments ,
233- lldb::eLaunchFlagShellExpandArguments);
234- if (arguments.detachOnError )
235- launch_info.SetDetachOnError (*arguments.detachOnError );
236233 launch_info.SetLaunchFlags (flags | lldb::eLaunchFlagDebug |
237234 lldb::eLaunchFlagStopAtEntry);
238235
239236 if (arguments.runInTerminal ) {
240237 if (llvm::Error err = RunInTerminal (dap, arguments))
241238 return err;
242- } else if (! launchCommands) {
239+ } else if (launchCommands. empty () ) {
243240 lldb::SBError error;
244241 // Disable async events so the launch will be successful when we return from
245242 // the launch call and the launch will happen synchronously
@@ -252,7 +249,7 @@ llvm::Error BaseRequestHandler::LaunchProcess(
252249 // Set the launch info so that run commands can access the configured
253250 // launch details.
254251 dap.target .SetLaunchInfo (launch_info);
255- if (llvm::Error err = dap.RunLaunchCommands (* launchCommands))
252+ if (llvm::Error err = dap.RunLaunchCommands (launchCommands))
256253 return err;
257254
258255 // The custom commands might have created a new target so we should use the
0 commit comments