* 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.
+2011-10-07 Ulrich Weigand <ulrich.weigand@linaro.org>
+
+ * 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.
+
2011-10-07 Kevin Pouget <kevin.pouget@st.com>
Allow Python notification of new object-file loadings.
+2011-10-07 Ulrich Weigand <ulrich.weigand@linaro.org>
+
+ * 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.
+
2011-10-07 Kevin Pouget <kevin.pouget@st.com>
Allow Python notification of new object-file loadings.
is useful for multiple debugging sessions to make the execution better
reproducible and memory addresses reusable across debugging sessions.
-This feature is implemented only on @sc{gnu}/Linux. You can get the same
-behavior using
+This feature is implemented only on certain targets, including @sc{gnu}/Linux.
+On @sc{gnu}/Linux you can get the same behavior using
@smallexample
(@value{GDBP}) set exec-wrapper setarch `uname -m` -R
as @sc{gnu}/Linux, which do that for stand-alone programs. Use @kbd{set
disable-randomization off} to try to reproduce such elusive bugs.
-The virtual address space randomization is implemented only on @sc{gnu}/Linux.
-It protects the programs against some kinds of security attacks. In these
+On targets where it is available, virtual address space randomization
+protects the programs against certain kinds of security attacks. In these
cases the attacker needs to know the exact location of a concrete executable
code. Randomizing its location makes it impossible to inject jumps misusing
a code at its expected addresses.
@item @code{traceframe-info}
@tab @code{qXfer:traceframe-info:read}
@tab Traceframe info
+
+@item @code{disable-randomization}
+@tab @code{QDisableRandomization}
+@tab @code{set disable-randomization}
@end multitable
@node Remote Stub
The specified memory region's checksum is @var{crc32}.
@end table
+@item QDisableRandomization:@var{value}
+@cindex disable address space randomization, remote request
+@cindex @samp{QDisableRandomization} packet
+Some target operating systems will randomize the virtual address space
+of the inferior process as a security feature, but provide a feature
+to disable such randomization, e.g.@: to allow for a more deterministic
+debugging experience. On such systems, this packet with a @var{value}
+of 1 directs the target to disable address space randomization for
+processes subsequently started via @samp{vRun} packets, while a packet
+with a @var{value} of 0 tells the target to enable address space
+randomization.
+
+This packet is only available in extended mode (@pxref{extended mode}).
+
+Reply:
+@table @samp
+@item OK
+The request succeeded.
+
+@item E @var{nn}
+An error occurred. @var{nn} are hex digits.
+
+@item
+An empty reply indicates that @samp{QDisableRandomization} is not supported
+by the stub.
+@end table
+
+This packet is not probed by default; the remote stub must request it,
+by supplying an appropriate @samp{qSupported} response (@pxref{qSupported}).
+This should only be done on targets that actually support disabling
+address space randomization.
+
@item qfThreadInfo
@itemx qsThreadInfo
@cindex list active threads, remote request
@tab @samp{-}
@tab No
+@item @samp{QDisableRandomization}
+@tab No
+@tab @samp{-}
+@tab No
+
@item @samp{EnableDisableTracepoints}
@tab No
@tab @samp{-}
@item QAllow
The remote stub understands the @samp{QAllow} packet.
+@item QDisableRandomization
+The remote stub understands the @samp{QDisableRandomization} packet.
+
@item StaticTracepoint
@cindex static tracepoints, in remote protocol
The remote stub supports static tracepoints.
+2011-10-07 Ulrich Weigand <ulrich.weigand@linaro.org>
+
+ * 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.
+
2011-09-29 Mike Frysinger <vapier@gentoo.org>
* linux-low.c (target_loadseg): Add defined PTRACE_GETFDPIC to the
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
+/* Define to 1 if you have the declaration of `ADDR_NO_RANDOMIZE', and to 0 if
+ you don't. */
+#undef HAVE_DECL_ADDR_NO_RANDOMIZE
+
/* Define to 1 if you have the declaration of `memmem', and to 0 if you don't.
*/
#undef HAVE_DECL_MEMMEM
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#undef HAVE_NETINET_TCP_H
+/* Define if you support the personality syscall. */
+#undef HAVE_PERSONALITY
+
/* Define to 1 if you have the `pread' function. */
#undef HAVE_PREAD
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$saved_cflags"
+ac_fn_c_check_decl "$LINENO" "ADDR_NO_RANDOMIZE" "ac_cv_have_decl_ADDR_NO_RANDOMIZE" "#include <sys/personality.h>
+"
+if test "x$ac_cv_have_decl_ADDR_NO_RANDOMIZE" = x""yes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ADDR_NO_RANDOMIZE $ac_have_decl
+_ACEOF
+
+
+if test "$cross_compiling" = yes; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/personality.h>
+int
+main ()
+{
+
+# if !HAVE_DECL_ADDR_NO_RANDOMIZE
+# define ADDR_NO_RANDOMIZE 0x0040000
+# endif
+ /* Test the flag could be set and stays set. */
+ personality (personality (0xffffffff) | ADDR_NO_RANDOMIZE);
+ if (!(personality (personality (0xffffffff)) & ADDR_NO_RANDOMIZE))
+ return 1
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ gdbsrv_cv_have_personality=true
+else
+ gdbsrv_cv_have_personality=false
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/personality.h>
+int
+main ()
+{
+
+# if !HAVE_DECL_ADDR_NO_RANDOMIZE
+# define ADDR_NO_RANDOMIZE 0x0040000
+# endif
+ /* Test the flag could be set and stays set. */
+ personality (personality (0xffffffff) | ADDR_NO_RANDOMIZE);
+ if (!(personality (personality (0xffffffff)) & ADDR_NO_RANDOMIZE))
+ return 1
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gdbsrv_cv_have_personality=true
+else
+ gdbsrv_cv_have_personality=false
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+if $gdbsrv_cv_have_personality
+then
+
+$as_echo "#define HAVE_PERSONALITY 1" >>confdefs.h
+
+fi
+
IPA_DEPFILES=""
extra_libraries=""
[gdbsrv_cv_have_visibility_hidden=no])
CFLAGS="$saved_cflags"
+dnl Check if we can disable the virtual address space randomization.
+dnl The functionality of setarch -R.
+AC_CHECK_DECLS([ADDR_NO_RANDOMIZE],,, [#include <sys/personality.h>])
+define([PERSONALITY_TEST], [AC_LANG_PROGRAM([#include <sys/personality.h>], [
+# if !HAVE_DECL_ADDR_NO_RANDOMIZE
+# define ADDR_NO_RANDOMIZE 0x0040000
+# endif
+ /* Test the flag could be set and stays set. */
+ personality (personality (0xffffffff) | ADDR_NO_RANDOMIZE);
+ if (!(personality (personality (0xffffffff)) & ADDR_NO_RANDOMIZE))
+ return 1])])
+AC_RUN_IFELSE([PERSONALITY_TEST],
+ [gdbsrv_cv_have_personality=true],
+ [gdbsrv_cv_have_personality=false],
+ [AC_LINK_IFELSE([PERSONALITY_TEST],
+ [gdbsrv_cv_have_personality=true],
+ [gdbsrv_cv_have_personality=false])])
+if $gdbsrv_cv_have_personality
+then
+ AC_DEFINE([HAVE_PERSONALITY], 1,
+ [Define if you support the personality syscall.])
+fi
+
IPA_DEPFILES=""
extra_libraries=""
#define SPUFS_MAGIC 0x23c9b64e
#endif
+#ifdef HAVE_PERSONALITY
+# include <sys/personality.h>
+# if !HAVE_DECL_ADDR_NO_RANDOMIZE
+# define ADDR_NO_RANDOMIZE 0x0040000
+# endif
+#endif
+
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
static int
linux_create_inferior (char *program, char **allargs)
{
+#ifdef HAVE_PERSONALITY
+ int personality_orig = 0, personality_set = 0;
+#endif
struct lwp_info *new_lwp;
int pid;
ptid_t ptid;
+#ifdef HAVE_PERSONALITY
+ if (disable_randomization)
+ {
+ errno = 0;
+ personality_orig = personality (0xffffffff);
+ if (errno == 0 && !(personality_orig & ADDR_NO_RANDOMIZE))
+ {
+ personality_set = 1;
+ personality (personality_orig | ADDR_NO_RANDOMIZE);
+ }
+ if (errno != 0 || (personality_set
+ && !(personality (0xffffffff) & ADDR_NO_RANDOMIZE)))
+ warning ("Error disabling address space randomization: %s",
+ strerror (errno));
+ }
+#endif
+
#if defined(__UCLIBC__) && defined(HAS_NOMMU)
pid = vfork ();
#else
_exit (0177);
}
+#ifdef HAVE_PERSONALITY
+ if (personality_set)
+ {
+ errno = 0;
+ personality (personality_orig);
+ if (errno != 0)
+ warning ("Error restoring address space randomization: %s",
+ strerror (errno));
+ }
+#endif
+
linux_add_process (pid, 0);
ptid = ptid_build (pid, pid, 0);
return 1;
}
+static int
+linux_supports_disable_randomization (void)
+{
+#ifdef HAVE_PERSONALITY
+ return 1;
+#else
+ return 0;
+#endif
+}
/* Enumerate spufs IDs for process PID. */
static int
linux_cancel_breakpoints,
linux_stabilize_threads,
linux_install_fast_tracepoint_jump_pad,
- linux_emit_ops
+ linux_emit_ops,
+ linux_supports_disable_randomization,
};
static void
int multi_process;
int non_stop;
+/* Whether we should attempt to disable the operating system's address
+ space randomization feature before starting an inferior. */
+int disable_randomization = 1;
+
static char **program_argv, **wrapper_argv;
/* Enable miscellaneous debugging output. The name is historical - it
return;
}
+ if (strncmp ("QDisableRandomization:", own_buf,
+ strlen ("QDisableRandomization:")) == 0)
+ {
+ char *packet = own_buf + strlen ("QDisableRandomization:");
+ ULONGEST setting;
+
+ unpack_varlen_hex (packet, &setting);
+ disable_randomization = setting;
+
+ if (remote_debug)
+ {
+ if (disable_randomization)
+ fprintf (stderr, "[address space randomization disabled]\n");
+ else
+ fprintf (stderr, "[address space randomization enabled]\n");
+ }
+
+ write_ok (own_buf);
+ return;
+ }
+
if (target_supports_tracepoints ()
&& handle_tracepoint_general_set (own_buf))
return;
if (target_supports_non_stop ())
strcat (own_buf, ";QNonStop+");
+ if (target_supports_disable_randomization ())
+ strcat (own_buf, ";QDisableRandomization+");
+
strcat (own_buf, ";qXfer:threads:read+");
if (target_supports_tracepoints ())
}
}
}
+ else if (strcmp (*next_arg, "--disable-randomization") == 0)
+ disable_randomization = 1;
+ else if (strcmp (*next_arg, "--no-disable-randomization") == 0)
+ disable_randomization = 0;
else if (strcmp (*next_arg, "--once") == 0)
run_once = 1;
else
extern int multi_process;
extern int non_stop;
+extern int disable_randomization;
+
#if USE_WIN32API
#include <winsock2.h>
typedef SOCKET gdb_fildes_t;
/* Return the bytecode operations vector for the current inferior.
Returns NULL if bytecode compilation is not supported. */
struct emit_ops *(*emit_ops) (void);
+
+ /* Returns true if the target supports disabling randomization. */
+ int (*supports_disable_randomization) (void);
};
extern struct target_ops *the_target;
#define target_emit_ops() \
(the_target->emit_ops ? (*the_target->emit_ops) () : NULL)
+#define target_supports_disable_randomization() \
+ (the_target->supports_disable_randomization ? \
+ (*the_target->supports_disable_randomization) () : 0)
+
/* Start non-stop mode, returns 0 on success, -1 on failure. */
int start_non_stop (int nonstop);
detached depends on 'set follow-fork-mode' setting. */
extern int detach_fork;
+/* When set (default), the target should attempt to disable the operating
+ system's address space randomization feature when starting an inferior. */
+extern int disable_randomization;
+
extern void generic_mourn_inferior (void);
extern void terminal_save_ours (void);
fprintf_filtered (file, _("Inferior debugging is %s.\n"), value);
}
+
+/* Support for disabling address space randomization. */
+
+int disable_randomization = 1;
+
+static void
+show_disable_randomization (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ if (target_supports_disable_randomization ())
+ fprintf_filtered (file,
+ _("Disabling randomization of debuggee's "
+ "virtual address space is %s.\n"),
+ value);
+ else
+ fputs_filtered (_("Disabling randomization of debuggee's "
+ "virtual address space is unsupported on\n"
+ "this platform.\n"), file);
+}
+
+static void
+set_disable_randomization (char *args, int from_tty,
+ struct cmd_list_element *c)
+{
+ if (!target_supports_disable_randomization ())
+ error (_("Disabling randomization of debuggee's "
+ "virtual address space is unsupported on\n"
+ "this platform."));
+}
+
+
/* If the program uses ELF-style shared libraries, then calls to
functions in shared libraries go through stubs, which live in a
table called the PLT (Procedure Linkage Table). The first time the
Tells gdb whether to detach the child of a fork."),
NULL, NULL, &setlist, &showlist);
+ /* Set/show disable address space randomization mode. */
+
+ 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);
+
/* ptid initializations */
inferior_ptid = null_ptid;
target_last_wait_ptid = minus_one_ptid;
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;
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. */
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
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);
}
\f
PACKET_TracepointSource,
PACKET_QAllow,
PACKET_qXfer_fdpic,
+ PACKET_QDisableRandomization,
PACKET_MAX
};
remote_enable_disable_tracepoint_feature, -1 },
{ "qXfer:fdpic:read", PACKET_DISABLE, remote_supported_packet,
PACKET_qXfer_fdpic },
+ { "QDisableRandomization", PACKET_DISABLE, remote_supported_packet,
+ PACKET_QDisableRandomization },
};
static char *remote_support_xml;
extended_remote_mourn_1 (ops);
}
+static int
+extended_remote_supports_disable_randomization (void)
+{
+ return (remote_protocol_packets[PACKET_QDisableRandomization].support
+ == PACKET_ENABLE);
+}
+
+static void
+extended_remote_disable_randomization (int val)
+{
+ struct remote_state *rs = get_remote_state ();
+ char *reply;
+
+ sprintf (rs->buf, "QDisableRandomization:%x", val);
+ putpkt (rs->buf);
+ reply = remote_get_noisy_reply (&target_buf, &target_buf_size);
+ if (*reply == '\0')
+ error (_("Target does not support QDisableRandomization."));
+ if (strcmp (reply, "OK") != 0)
+ error (_("Bogus QDisableRandomization reply from target: %s"), reply);
+}
+
static int
extended_remote_run (char *args)
{
if (target_can_async_p ())
target_async (inferior_event_handler, 0);
+ /* Disable address space randomization if requested (and supported). */
+ if (extended_remote_supports_disable_randomization ())
+ extended_remote_disable_randomization (disable_randomization);
+
/* Now restart the remote server. */
if (extended_remote_run (args) == -1)
{
return 1;
}
+static int
+remote_supports_disable_randomization (void)
+{
+ /* Only supported in extended mode. */
+ return 0;
+}
+
static int
remote_supports_multi_process (void)
{
remote_ops.to_terminal_ours = remote_terminal_ours;
remote_ops.to_supports_non_stop = remote_supports_non_stop;
remote_ops.to_supports_multi_process = remote_supports_multi_process;
+ remote_ops.to_supports_disable_randomization
+ = remote_supports_disable_randomization;
remote_ops.to_supports_enable_disable_tracepoint = remote_supports_enable_disable_tracepoint;
remote_ops.to_trace_init = remote_trace_init;
remote_ops.to_download_tracepoint = remote_download_tracepoint;
extended_remote_ops.to_detach = extended_remote_detach;
extended_remote_ops.to_attach = extended_remote_attach;
extended_remote_ops.to_kill = extended_remote_kill;
+ extended_remote_ops.to_supports_disable_randomization
+ = extended_remote_supports_disable_randomization;
}
static int
add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_fdpic],
"qXfer:fdpic:read", "read-fdpic-loadmap", 0);
+ add_packet_config_cmd (&remote_protocol_packets[PACKET_QDisableRandomization],
+ "QDisableRandomization", "disable-randomization", 0);
+
/* Keep the old ``set remote Z-packet ...'' working. Each individual
Z sub-packet has its own set and show commands, but users may
have sets to this variable in their .gdbinit files (or in their
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 = ¤t_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)
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;
experiment is running? */
int (*to_supports_enable_disable_tracepoint) (void);
+ /* Does this target support disabling address space randomization? */
+ int (*to_supports_disable_randomization) (void);
+
/* Determine current architecture of thread PTID.
The target is supposed to determine the architecture of the code where
#define target_supports_multi_process() \
(*current_target.to_supports_multi_process) ()
+/* Returns true if this target can disable address space randomization. */
+
+int target_supports_disable_randomization (void);
+
/* Returns true if this target can enable and disable tracepoints
while a trace experiment is running. */