From 2bfc0540a2dd04b011509c9cd8d0db695f7cc115 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Tue, 17 Dec 2013 21:37:32 -0700
Subject: [PATCH] Add target_ops argument to to_supports_disable_randomization

2014-02-19  Tom Tromey  <tromey@redhat.com>

	* target.h (struct target_ops)
	<to_supports_disable_randomization>: Add argument.
	* target.c (find_default_supports_disable_randomization): Add
	argument.
	(target_supports_disable_randomization): Add argument.
	(find_default_supports_disable_randomization): Add 'self'
	argument.
	* remote.c (extended_remote_supports_disable_randomization): Add
	'self' argument.
	(remote_supports_disable_randomization): Add 'self' argument.
	(extended_remote_create_inferior): Update.
	* linux-nat.c (linux_nat_supports_disable_randomization): Add
	'self' argument.
---
 gdb/ChangeLog   | 16 ++++++++++++++++
 gdb/linux-nat.c |  2 +-
 gdb/remote.c    |  6 +++---
 gdb/target.c    |  6 +++---
 gdb/target.h    |  2 +-
 5 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ad04f808433..9d11dff9656 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,19 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+	* target.h (struct target_ops)
+	<to_supports_disable_randomization>: Add argument.
+	* target.c (find_default_supports_disable_randomization): Add
+	argument.
+	(target_supports_disable_randomization): Add argument.
+	(find_default_supports_disable_randomization): Add 'self'
+	argument.
+	* remote.c (extended_remote_supports_disable_randomization): Add
+	'self' argument.
+	(remote_supports_disable_randomization): Add 'self' argument.
+	(extended_remote_create_inferior): Update.
+	* linux-nat.c (linux_nat_supports_disable_randomization): Add
+	'self' argument.
+
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
 	* target.h (struct target_ops)
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 6befbac064c..ff800a9a667 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -4572,7 +4572,7 @@ linux_nat_supports_multi_process (struct target_ops *self)
 }
 
 static int
-linux_nat_supports_disable_randomization (void)
+linux_nat_supports_disable_randomization (struct target_ops *self)
 {
 #ifdef HAVE_PERSONALITY
   return 1;
diff --git a/gdb/remote.c b/gdb/remote.c
index 77a5166fc37..60d505f9b14 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -7834,7 +7834,7 @@ extended_remote_mourn (struct target_ops *ops)
 }
 
 static int
-extended_remote_supports_disable_randomization (void)
+extended_remote_supports_disable_randomization (struct target_ops *self)
 {
   return (remote_protocol_packets[PACKET_QDisableRandomization].support
 	  == PACKET_ENABLE);
@@ -7940,7 +7940,7 @@ extended_remote_create_inferior (struct target_ops *ops,
     target_async (inferior_event_handler, 0);
 
   /* Disable address space randomization if requested (and supported).  */
-  if (extended_remote_supports_disable_randomization ())
+  if (extended_remote_supports_disable_randomization (ops))
     extended_remote_disable_randomization (disable_randomization);
 
   /* Now restart the remote server.  */
@@ -10231,7 +10231,7 @@ remote_supports_non_stop (struct target_ops *self)
 }
 
 static int
-remote_supports_disable_randomization (void)
+remote_supports_disable_randomization (struct target_ops *self)
 {
   /* Only supported in extended mode.  */
   return 0;
diff --git a/gdb/target.c b/gdb/target.c
index f65f8befc90..26d1074e51f 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3267,13 +3267,13 @@ target_info_proc (char *args, enum info_proc_what what)
 }
 
 static int
-find_default_supports_disable_randomization (void)
+find_default_supports_disable_randomization (struct target_ops *self)
 {
   struct target_ops *t;
 
   t = find_default_run_target (NULL);
   if (t && t->to_supports_disable_randomization)
-    return (t->to_supports_disable_randomization) ();
+    return (t->to_supports_disable_randomization) (t);
   return 0;
 }
 
@@ -3284,7 +3284,7 @@ target_supports_disable_randomization (void)
 
   for (t = &current_target; t != NULL; t = t->beneath)
     if (t->to_supports_disable_randomization)
-      return t->to_supports_disable_randomization ();
+      return t->to_supports_disable_randomization (t);
 
   return 0;
 }
diff --git a/gdb/target.h b/gdb/target.h
index a196fe4cd2c..c25235badfa 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -679,7 +679,7 @@ struct target_ops
     int (*to_supports_enable_disable_tracepoint) (struct target_ops *);
 
     /* Does this target support disabling address space randomization?  */
-    int (*to_supports_disable_randomization) (void);
+    int (*to_supports_disable_randomization) (struct target_ops *);
 
     /* Does this target support the tracenz bytecode for string collection?  */
     int (*to_supports_string_tracing) (void);