@@ -31,7 +31,19 @@ MakeArgv(const llvm::ArrayRef<std::string> &strs) {
31
31
return argv;
32
32
}
33
33
34
- // Both attach and launch take a either a sourcePath or sourceMap
34
+ static uint32_t SetLaunchFlag (uint32_t flags, const llvm::json::Object *obj,
35
+ llvm::StringRef key, lldb::LaunchFlags mask) {
36
+ if (const auto opt_value = GetBoolean (obj, key)) {
37
+ if (*opt_value)
38
+ flags |= mask;
39
+ else
40
+ flags &= ~mask;
41
+ }
42
+
43
+ return flags;
44
+ }
45
+
46
+ // Both attach and launch take either a sourcePath or a sourceMap
35
47
// argument (or neither), from which we need to set the target.source-map.
36
48
void RequestHandler::SetSourceMapFromArguments (
37
49
const llvm::json::Object &arguments) const {
@@ -173,12 +185,13 @@ RequestHandler::LaunchProcess(const llvm::json::Object &request) const {
173
185
174
186
auto flags = launch_info.GetLaunchFlags ();
175
187
176
- if (GetBoolean (arguments, " disableASLR" ).value_or (true ))
177
- flags |= lldb::eLaunchFlagDisableASLR;
178
- if (GetBoolean (arguments, " disableSTDIO" ).value_or (false ))
179
- flags |= lldb::eLaunchFlagDisableSTDIO;
180
- if (GetBoolean (arguments, " shellExpandArguments" ).value_or (false ))
181
- flags |= lldb::eLaunchFlagShellExpandArguments;
188
+ flags = SetLaunchFlag (flags, arguments, " disableASLR" ,
189
+ lldb::eLaunchFlagDisableASLR);
190
+ flags = SetLaunchFlag (flags, arguments, " disableSTDIO" ,
191
+ lldb::eLaunchFlagDisableSTDIO);
192
+ flags = SetLaunchFlag (flags, arguments, " shellExpandArguments" ,
193
+ lldb::eLaunchFlagShellExpandArguments);
194
+
182
195
const bool detachOnError =
183
196
GetBoolean (arguments, " detachOnError" ).value_or (false );
184
197
launch_info.SetDetachOnError (detachOnError);
0 commit comments