summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
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/source/Plugins/Process/gdb-remote
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/source/Plugins/Process/gdb-remote')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp35
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h2
2 files changed, 25 insertions, 12 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 2a07ee97617..e8d596a413a 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -375,6 +375,7 @@ ProcessGDBRemote::DoLaunch
Module* module,
char const *argv[],
char const *envp[],
+ uint32_t launch_flags,
const char *stdin_path,
const char *stdout_path,
const char *stderr_path
@@ -404,6 +405,7 @@ ProcessGDBRemote::DoLaunch
NULL, //stdin_path,
LLDB_INVALID_PROCESS_ID,
NULL, false,
+ launch_flags & eLaunchFlagDisableASLR != 0,
inferior_arch);
if (error.Fail())
return error;
@@ -422,6 +424,7 @@ ProcessGDBRemote::DoLaunch
NULL, //stdin_path,
LLDB_INVALID_PROCESS_ID,
NULL, false,
+ launch_flags & eLaunchFlagDisableASLR != 0,
inferior_arch);
if (error.Fail())
return error;
@@ -639,12 +642,14 @@ ProcessGDBRemote::DoAttachToProcessWithID (lldb::pid_t attach_pid)
SetPrivateState (eStateAttaching);
char host_port[128];
snprintf (host_port, sizeof(host_port), "localhost:%u", get_random_port ());
- error = StartDebugserverProcess (host_port,
- NULL,
- NULL,
- NULL,
- LLDB_INVALID_PROCESS_ID,
- NULL, false,
+ error = StartDebugserverProcess (host_port, // debugserver_url
+ NULL, // inferior_argv
+ NULL, // inferior_envp
+ NULL, // stdin_path
+ LLDB_INVALID_PROCESS_ID, // attach_pid
+ NULL, // attach_pid_name
+ false, // wait_for_launch
+ false, // disable_aslr
arch_spec);
if (error.Fail())
@@ -740,12 +745,14 @@ ProcessGDBRemote::DoAttachToProcessWithName (const char *process_name, bool wait
char host_port[128];
ArchSpec arch_spec = GetTarget().GetArchitecture();
snprintf (host_port, sizeof(host_port), "localhost:%u", get_random_port ());
- error = StartDebugserverProcess (host_port,
- NULL,
- NULL,
- NULL,
- LLDB_INVALID_PROCESS_ID,
- NULL, false,
+ error = StartDebugserverProcess (host_port, // debugserver_url
+ NULL, // inferior_argv
+ NULL, // inferior_envp
+ NULL, // stdin_path
+ LLDB_INVALID_PROCESS_ID, // attach_pid
+ NULL, // attach_pid_name
+ false, // wait_for_launch
+ false, // disable_aslr
arch_spec);
if (error.Fail())
{
@@ -1644,6 +1651,7 @@ ProcessGDBRemote::StartDebugserverProcess
lldb::pid_t attach_pid, // If inferior inferior_argv == NULL, and attach_pid != LLDB_INVALID_PROCESS_ID then attach to this attach_pid
const char *attach_name, // Wait for the next process to launch whose basename matches "attach_name"
bool wait_for_launch, // Wait for the process named "attach_name" to launch
+ bool disable_aslr, // Disable ASLR
ArchSpec& inferior_arch // The arch of the inferior that we will launch
)
{
@@ -1771,6 +1779,9 @@ ProcessGDBRemote::StartDebugserverProcess
// signals generated by special terminal key
// sequences (^C) don't affect debugserver
+ if (disable_aslr)
+ debugserver_args.AppendArguments("--disable-aslr");
+
// Only set the inferior
if (launch_process)
{
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index 88c495a652a..62473f9ae38 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -81,6 +81,7 @@ public:
DoLaunch (lldb_private::Module* module,
char const *argv[], // Can be NULL
char const *envp[], // Can be NULL
+ uint32_t flags,
const char *stdin_path, // Can be NULL
const char *stdout_path, // Can be NULL
const char *stderr_path); // Can be NULL
@@ -292,6 +293,7 @@ protected:
lldb::pid_t attach_pid, // If inferior inferior_argv == NULL, then attach to this pid
const char *attach_pid_name, // Wait for the next process to launch whose basename matches "attach_wait_name"
bool wait_for_launch, // Wait for the process named "attach_wait_name" to launch
+ bool disable_aslr, // Disable ASLR
lldb_private::ArchSpec& arch_spec);
void
OpenPOWER on IntegriCloud