aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.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/target.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/target.c')
-rw-r--r--gdb/target.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 7fa891a..e6328a1 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3013,6 +3013,28 @@ target_supports_non_stop (void)
return 0;
}
+static int
+find_default_supports_disable_randomization (void)
+{
+ struct target_ops *t;
+
+ t = find_default_run_target (NULL);
+ if (t && t->to_supports_disable_randomization)
+ return (t->to_supports_disable_randomization) ();
+ return 0;
+}
+
+int
+target_supports_disable_randomization (void)
+{
+ struct target_ops *t;
+
+ for (t = &current_target; t != NULL; t = t->beneath)
+ if (t->to_supports_disable_randomization)
+ return t->to_supports_disable_randomization ();
+
+ return 0;
+}
char *
target_get_osdata (const char *type)
@@ -3257,6 +3279,8 @@ init_dummy_target (void)
dummy_target.to_can_async_p = find_default_can_async_p;
dummy_target.to_is_async_p = find_default_is_async_p;
dummy_target.to_supports_non_stop = find_default_supports_non_stop;
+ dummy_target.to_supports_disable_randomization
+ = find_default_supports_disable_randomization;
dummy_target.to_pid_to_str = dummy_pid_to_str;
dummy_target.to_stratum = dummy_stratum;
dummy_target.to_find_memory_regions = dummy_find_memory_regions;