summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/debugserver.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-08-31 18:35:14 +0000
committerGreg Clayton <gclayton@apple.com>2010-08-31 18:35:14 +0000
commitf681b94f90b97794ed005701e542594d72766e55 (patch)
tree5a298e7aff7a214231e62c583b6a946281842ae6 /lldb/tools/debugserver/source/debugserver.cpp
parent3931c859565a9b4ede553bdc56d90530286e5e93 (diff)
downloadbcm5719-llvm-f681b94f90b97794ed005701e542594d72766e55.tar.gz
bcm5719-llvm-f681b94f90b97794ed005701e542594d72766e55.zip
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
Diffstat (limited to 'lldb/tools/debugserver/source/debugserver.cpp')
-rw-r--r--lldb/tools/debugserver/source/debugserver.cpp6
1 files changed, 6 insertions, 0 deletions
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;
}
}
OpenPOWER on IntegriCloud