aboutsummaryrefslogtreecommitdiff
path: root/gdbserver
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2021-09-08 08:20:29 -0600
committerTom Tromey <tromey@adacore.com>2022-06-07 09:59:41 -0600
commitbcb9251f029da8dcf360a4f5acfa3b4211c87bb0 (patch)
treec56395b22b1c8ceb3ef8d010c61a4e14c9ee5295 /gdbserver
parent8fea1a81c7d9279a6f91e49ebacfb61e0f8ce008 (diff)
downloadgdb-bcb9251f029da8dcf360a4f5acfa3b4211c87bb0.zip
gdb-bcb9251f029da8dcf360a4f5acfa3b4211c87bb0.tar.gz
gdb-bcb9251f029da8dcf360a4f5acfa3b4211c87bb0.tar.bz2
Allow ASLR to be disabled on Windows
On Windows, it is possible to disable ASLR when creating a process. This patch adds code to do this, and hooks it up to gdb's existing disable-randomization feature. Because the Windows documentation cautions that this isn't available on all versions of Windows, the CreateProcess wrapper function is updated to make the attempt, and then fall back to the current approach if it fails.
Diffstat (limited to 'gdbserver')
-rw-r--r--gdbserver/win32-low.cc1
-rw-r--r--gdbserver/win32-low.h5
2 files changed, 6 insertions, 0 deletions
diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc
index 00ce2a5..a9af646 100644
--- a/gdbserver/win32-low.cc
+++ b/gdbserver/win32-low.cc
@@ -586,6 +586,7 @@ create_process (const char *program, char *args,
(inferior_cwd.empty ()
? NULL
: gdb_tilde_expand (inferior_cwd.c_str ()).c_str()),
+ get_client_state ().disable_randomization,
&si, /* start info */
pi); /* proc info */
diff --git a/gdbserver/win32-low.h b/gdbserver/win32-low.h
index d16f1f9..b29e8b3 100644
--- a/gdbserver/win32-low.h
+++ b/gdbserver/win32-low.h
@@ -165,6 +165,11 @@ public:
{ return true; }
const char *pid_to_exec_file (int pid) override;
+
+ bool supports_disable_randomization () override
+ {
+ return windows_nat::disable_randomization_available ();
+ }
};
/* The sole Windows process. */