aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-nat.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2011-10-07 12:06:48 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2011-10-07 12:06:48 +0000
commit03583c206f350870e077f4e112f83b3c4bdd0b27 (patch)
treef21677825f84019f3963478b1f560a497081f4d2 /gdb/linux-nat.c
parent01b71697807be429fbd5d960e4228c04837024e3 (diff)
downloadgdb-03583c206f350870e077f4e112f83b3c4bdd0b27.zip
gdb-03583c206f350870e077f4e112f83b3c4bdd0b27.tar.gz
gdb-03583c206f350870e077f4e112f83b3c4bdd0b27.tar.bz2
* inferior.h (disable_randomization): Declare.
* infrun.c (disable_randomization): New global variable. (show_disable_randomization): New function. (set_disable_randomization): Likewise. (_initialize_infrun): Install set/show disable-randomization commands. * linux-nat.c (disable_randomization): Remove. (show_disable_randomization): Likewise. (set_disable_randomization): Likewise. (_initialize_linux_nat): No longer install set/show disable-randomization commands here. (linux_nat_supports_disable_randomization): New function. (linux_nat_add_target): Install it. * remote.c (PACKET_QDisableRandomization): New enum value. (remote_protocol_packets): Support QDisableRandomization. (_initialize_remote): Likewise. (remote_supports_disable_randomization): New function. (init_remote_ops): Install it. (extended_remote_supports_disable_randomization): New function. (init_extended_remote_ops): Install it. (extended_remote_disable_randomization): New function. (extended_remote_create_inferior_1): Call it. * target.h (struct target_ops): Add to_supports_disable_randomization. (target_supports_disable_randomization): Add prototype. * target.c (target_supports_disable_randomization): New function. (find_default_supports_disable_randomization): Likewise. (init_dummy_target): Install it. doc/ * gdb.texinfo (Starting your Program): "set disable-randomization" is no longer Linux-specific. (Remote Configuration): Document "set remote disable-randomization-packet". (General Query Packets): Document "QDisableRandomization" packet and add it to "qSupported" list. gdbserver/ * configure.ac: Check support for personality routine. * configure: Regenerate. * config.in: Likewise. * linux-low.c: Include <sys/personality.h>. Define ADDR_NO_RANDOMIZE if necessary. (linux_create_inferior): Disable address space randomization when forking inferior, if requested. (linux_supports_disable_randomization): New function. (linux_target_ops): Install it. * server.h (disable_randomization): Declare. * server.c (disable_randomization): New global variable. (handle_general_set): Handle QDisableRandomization. (handle_query): Likewise for qSupported. (main): Support --disable-randomization and --no-disable-randomization command line arguments. * target.h (struct target_ops): Add supports_disable_randomization. (target_supports_disable_randomization): New macro.
Diffstat (limited to 'gdb/linux-nat.c')
-rw-r--r--gdb/linux-nat.c53
1 files changed, 13 insertions, 40 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 9fcff9e..ef0837b 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -200,35 +200,6 @@ show_debug_linux_nat (struct ui_file *file, int from_tty,
value);
}
-static int disable_randomization = 1;
-
-static void
-show_disable_randomization (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
-{
-#ifdef HAVE_PERSONALITY
- fprintf_filtered (file,
- _("Disabling randomization of debuggee's "
- "virtual address space is %s.\n"),
- value);
-#else /* !HAVE_PERSONALITY */
- fputs_filtered (_("Disabling randomization of debuggee's "
- "virtual address space is unsupported on\n"
- "this platform.\n"), file);
-#endif /* !HAVE_PERSONALITY */
-}
-
-static void
-set_disable_randomization (char *args, int from_tty,
- struct cmd_list_element *c)
-{
-#ifndef HAVE_PERSONALITY
- error (_("Disabling randomization of debuggee's "
- "virtual address space is unsupported on\n"
- "this platform."));
-#endif /* !HAVE_PERSONALITY */
-}
-
struct simple_pid_list
{
int pid;
@@ -5308,6 +5279,16 @@ linux_nat_supports_multi_process (void)
return linux_multi_process;
}
+static int
+linux_nat_supports_disable_randomization (void)
+{
+#ifdef HAVE_PERSONALITY
+ return 1;
+#else
+ return 0;
+#endif
+}
+
static int async_terminal_is_ours = 1;
/* target_terminal_inferior implementation. */
@@ -5677,6 +5658,9 @@ linux_nat_add_target (struct target_ops *t)
t->to_supports_multi_process = linux_nat_supports_multi_process;
+ t->to_supports_disable_randomization
+ = linux_nat_supports_disable_randomization;
+
t->to_core_of_thread = linux_nat_core_of_thread;
/* We don't change the stratum; this target will sit at
@@ -5762,17 +5746,6 @@ Enables printf debugging output."),
sigdelset (&suspend_mask, SIGCHLD);
sigemptyset (&blocked_mask);
-
- add_setshow_boolean_cmd ("disable-randomization", class_support,
- &disable_randomization, _("\
-Set disabling of debuggee's virtual address space randomization."), _("\
-Show disabling of debuggee's virtual address space randomization."), _("\
-When this mode is on (which is the default), randomization of the virtual\n\
-address space is disabled. Standalone programs run with the randomization\n\
-enabled by default on some platforms."),
- &set_disable_randomization,
- &show_disable_randomization,
- &setlist, &showlist);
}