From 78eff0ec9d736c4a96bbd18c9bcd643d2a1edcea Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Tue, 17 Dec 2013 21:38:09 -0700
Subject: [PATCH] Add target_ops argument to to_can_run_breakpoint_commands

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

	* target.h (struct target_ops) <to_can_run_breakpoint_commands>:
	Add argument.
	(target_can_run_breakpoint_commands): Add argument.
	* target.c (update_current_target): Update.
	* remote.c (remote_can_run_breakpoint_commands): Add 'self'
	argument.
	(remote_insert_breakpoint): Add 'self' argument.
	(remote_insert_hw_breakpoint): Add 'self' argument.
	(remote_can_run_breakpoint_commands): Add 'self' argument.
---
 gdb/ChangeLog | 12 ++++++++++++
 gdb/remote.c  |  8 ++++----
 gdb/target.c  |  2 +-
 gdb/target.h  |  4 ++--
 4 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 527fc3b3933..8b262faf6c4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+	* target.h (struct target_ops) <to_can_run_breakpoint_commands>:
+	Add argument.
+	(target_can_run_breakpoint_commands): Add argument.
+	* target.c (update_current_target): Update.
+	* remote.c (remote_can_run_breakpoint_commands): Add 'self'
+	argument.
+	(remote_insert_breakpoint): Add 'self' argument.
+	(remote_insert_hw_breakpoint): Add 'self' argument.
+	(remote_can_run_breakpoint_commands): Add 'self' argument.
+
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
 	* target.h (struct target_ops)
diff --git a/gdb/remote.c b/gdb/remote.c
index 2d74bc166b4..b62b5f2660a 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -228,7 +228,7 @@ static void remote_console_output (char *msg);
 
 static int remote_supports_cond_breakpoints (struct target_ops *self);
 
-static int remote_can_run_breakpoint_commands (void);
+static int remote_can_run_breakpoint_commands (struct target_ops *self);
 
 /* For "remote".  */
 
@@ -8084,7 +8084,7 @@ remote_insert_breakpoint (struct target_ops *ops,
       if (remote_supports_cond_breakpoints (ops))
 	remote_add_target_side_condition (gdbarch, bp_tgt, p, endbuf);
 
-      if (remote_can_run_breakpoint_commands ())
+      if (remote_can_run_breakpoint_commands (ops))
 	remote_add_target_side_commands (gdbarch, bp_tgt, p);
 
       putpkt (rs->buf);
@@ -8363,7 +8363,7 @@ remote_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
   if (remote_supports_cond_breakpoints (self))
     remote_add_target_side_condition (gdbarch, bp_tgt, p, endbuf);
 
-  if (remote_can_run_breakpoint_commands ())
+  if (remote_can_run_breakpoint_commands (self))
     remote_add_target_side_commands (gdbarch, bp_tgt, p);
 
   putpkt (rs->buf);
@@ -10306,7 +10306,7 @@ remote_supports_string_tracing (struct target_ops *self)
 }
 
 static int
-remote_can_run_breakpoint_commands (void)
+remote_can_run_breakpoint_commands (struct target_ops *self)
 {
   struct remote_state *rs = get_remote_state ();
 
diff --git a/gdb/target.c b/gdb/target.c
index 4dfa8dd49f0..bf4a513ad90 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -933,7 +933,7 @@ update_current_target (void)
 	    (int (*) (struct target_ops *))
 	    return_zero);
   de_fault (to_can_run_breakpoint_commands,
-	    (int (*) (void))
+	    (int (*) (struct target_ops *))
 	    return_zero);
   de_fault (to_use_agent,
 	    (int (*) (int))
diff --git a/gdb/target.h b/gdb/target.h
index ce73863e274..c809c1babed 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -690,7 +690,7 @@ struct target_ops
 
     /* Does this target support evaluation of breakpoint commands on its
        end?  */
-    int (*to_can_run_breakpoint_commands) (void);
+    int (*to_can_run_breakpoint_commands) (struct target_ops *);
 
     /* Determine current architecture of thread PTID.
 
@@ -1129,7 +1129,7 @@ int target_supports_disable_randomization (void);
    on its end.  */
 
 #define target_can_run_breakpoint_commands() \
-  (*current_target.to_can_run_breakpoint_commands) ()
+  (*current_target.to_can_run_breakpoint_commands) (&current_target)
 
 extern int target_read_string (CORE_ADDR, char **, int, int *);