[Lldb-commits] [lldb] [lldb-dap] Fix: disableASLR launch argument not working. (PR #129753)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 5 02:35:44 PST 2025
https://github.com/Da-Viper updated https://github.com/llvm/llvm-project/pull/129753
>From 2f773debb694f5684664ea47e545027aeb6e33db Mon Sep 17 00:00:00 2001
From: Ezike Ebuka <yerimyah1 at gmail.com>
Date: Wed, 5 Mar 2025 10:32:16 +0000
Subject: [PATCH] [lldb-dap] Fix: disableASLR launch argument not working.
---
.../tools/lldb-dap/Handler/RequestHandler.cpp | 26 ++++++++++++++-----
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.cpp b/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
index d4030965869a1..816397adb26ad 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
@@ -31,7 +31,18 @@ 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,
+ bool default_value) {
+ if (GetBoolean(obj, key).value_or(default_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 +184,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, true);
+ flags = SetLaunchFlag(flags, arguments, "disableSTDIO",
+ lldb::eLaunchFlagDisableSTDIO, false);
+ flags = SetLaunchFlag(flags, arguments, "shellExpandArguments",
+ lldb::eLaunchFlagShellExpandArguments, false);
+
const bool detachOnError =
GetBoolean(arguments, "detachOnError").value_or(false);
launch_info.SetDetachOnError(detachOnError);
More information about the lldb-commits
mailing list