From f681b94f90b97794ed005701e542594d72766e55 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Tue, 31 Aug 2010 18:35:14 +0000 Subject: Added the ability to disable ASLR (Address Space Layout Randomization). ASLR is disabled by default, and can be enabled using: (lldb) set disable-aslr 0 llvm-svn: 112616 --- lldb/tools/debugserver/source/debugserver.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lldb/tools/debugserver/source/debugserver.cpp') diff --git a/lldb/tools/debugserver/source/debugserver.cpp b/lldb/tools/debugserver/source/debugserver.cpp index 680a988de52..17918da2290 100644 --- a/lldb/tools/debugserver/source/debugserver.cpp +++ b/lldb/tools/debugserver/source/debugserver.cpp @@ -53,6 +53,7 @@ RNBRemoteSP g_remoteSP; static int g_lockdown_opt = 0; static int g_applist_opt = 0; static nub_launch_flavor_t g_launch_flavor = eLaunchFlavorDefault; +static int g_disable_aslr = 0; int g_isatty = 0; @@ -209,6 +210,7 @@ RNBRunLoopLaunchInferior (RNBRemoteSP &remote, const char *stdio_path) &inferior_envp[0], stdio_path, launch_flavor, + g_disable_aslr, launch_err_str, sizeof(launch_err_str)); @@ -655,6 +657,7 @@ static struct option g_long_options[] = { "native-regs", no_argument, NULL, 'r' }, // Specify to use the native registers instead of the gdb defaults for the architecture. { "stdio-path", required_argument, NULL, 's' }, // Set the STDIO path to be used when launching applications { "setsid", no_argument, NULL, 'S' }, // call setsid() to make debugserver run in its own sessions + { "disable-aslr", no_argument, NULL, 'D' }, // Use _POSIX_SPAWN_DISABLE_ASLR to avoid shared library randomization { NULL, 0, NULL, 0 } }; @@ -861,6 +864,9 @@ main (int argc, char *argv[]) // signals sent to the session (i.e. dying when anyone hits ^C). setsid(); break; + case 'D': + g_disable_aslr = 1; + break; } } -- cgit v1.2.3