aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDa-Viper <57949090+Da-Viper@users.noreply.github.com>2025-03-05 17:43:29 +0000
committerGitHub <noreply@github.com>2025-03-05 09:43:29 -0800
commit5d8b4ea97b174d6d80dbdeaabf5a3664d99e6a19 (patch)
tree71dbc860609d2a3a252361be1104c9b8c65028d5
parent74df2032d467618a9aab085120539e306f21bcc0 (diff)
downloadllvm-5d8b4ea97b174d6d80dbdeaabf5a3664d99e6a19.zip
llvm-5d8b4ea97b174d6d80dbdeaabf5a3664d99e6a19.tar.gz
llvm-5d8b4ea97b174d6d80dbdeaabf5a3664d99e6a19.tar.bz2
[lldb-dap] Fix: disableASLR launch argument not working. (#129753)
Fixes #94338
-rw-r--r--lldb/tools/lldb-dap/Handler/RequestHandler.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.cpp b/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
index c72cf85..e43fa36 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
@@ -31,7 +31,19 @@ MakeArgv(const llvm::ArrayRef<std::string> &strs) {
return argv;
}
-// Both attach and launch take a either a sourcePath or sourceMap
+static uint32_t SetLaunchFlag(uint32_t flags, const llvm::json::Object *obj,
+ llvm::StringRef key, lldb::LaunchFlags mask) {
+ if (const auto opt_value = GetBoolean(obj, key)) {
+ if (*opt_value)
+ flags |= mask;
+ else
+ flags &= ~mask;
+ }
+
+ return flags;
+}
+
+// Both attach and launch take either a sourcePath or a sourceMap
// argument (or neither), from which we need to set the target.source-map.
void RequestHandler::SetSourceMapFromArguments(
const llvm::json::Object &arguments) const {
@@ -173,12 +185,13 @@ RequestHandler::LaunchProcess(const llvm::json::Object &request) const {
auto flags = launch_info.GetLaunchFlags();
- if (GetBoolean(arguments, "disableASLR").value_or(true))
- flags |= lldb::eLaunchFlagDisableASLR;
- if (GetBoolean(arguments, "disableSTDIO").value_or(false))
- flags |= lldb::eLaunchFlagDisableSTDIO;
- if (GetBoolean(arguments, "shellExpandArguments").value_or(false))
- flags |= lldb::eLaunchFlagShellExpandArguments;
+ flags = SetLaunchFlag(flags, arguments, "disableASLR",
+ lldb::eLaunchFlagDisableASLR);
+ flags = SetLaunchFlag(flags, arguments, "disableSTDIO",
+ lldb::eLaunchFlagDisableSTDIO);
+ flags = SetLaunchFlag(flags, arguments, "shellExpandArguments",
+ lldb::eLaunchFlagShellExpandArguments);
+
const bool detachOnError =
GetBoolean(arguments, "detachOnError").value_or(false);
launch_info.SetDetachOnError(detachOnError);