]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
add "this" pointers to more target APIs
authorTom Tromey <tromey@redhat.com>
Tue, 30 Jul 2013 16:36:07 +0000 (10:36 -0600)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:45:20 +0000 (07:45 -0700)
A subsequent pass introduces delegation helper functions to the target
API.  This delegation is much cleaner if the target_ops pointer is
directly available at delegation time.

This patch adds the "this" pointer to various to_* methods for this
purpose.

This updates a number of ports which I am unable to test.  Please give
them a look-over.  Any possible problem here is trivial, though, as
all that is required is adding an argument to a function.

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

* aarch64-linux-nat.c (aarch64_linux_stopped_by_watchpoint):
Add 'ops' argument.
* arm-linux-nat.c (arm_linux_stopped_by_watchpoint): Add
'ops' argument.
* i386-nat.c (i386_stopped_by_watchpoint): Add 'ops' argument.
* ia64-linux-nat.c (ia64_linux_stopped_by_watchpoint): Add
'ops' argument.
* inf-ttrace.c (inf_ttrace_stopped_by_watchpoint): Add 'ops'
argument.
* linux-nat.c (save_sigtrap): Update.
(linux_nat_stopped_by_watchpoint, linux_nat_is_async_p)
(linux_nat_can_async_p, linux_nat_async): Add 'ops' argument.
(linux_nat_close): Update.
* mips-linux-nat.c (mips_linux_stopped_by_watchpoint): Add 'ops'
argument.
* ppc-linux-nat.c (ppc_linux_stopped_by_watchpoint): Add 'ops'
argument.
* procfs.c (procfs_stopped_by_watchpoint): Add 'ops' argument.
* record-full.c (record_full_beneath_to_stopped_by_watchpoint)
(record_full_beneath_to_async, tmp_to_stopped_by_watchpoint)
(tmp_to_async): Add 'ops' argument.
(record_full_stopped_by_watchpoint, record_full_async)
(record_full_can_async_p, record_full_is_async_p): Add 'ops'
argument.
* remote-m32r-sdi.c (m32r_insert_breakpoint, m32r_remove_breakpoint)
(m32r_stopped_by_watchpoint): Add 'ops' argument.
* remote-mips.c (mips_stopped_by_watchpoint): Add 'ops' argument.
* remote.c (remote_stopped_by_watchpoint_p, remote_can_async_p)
(remote_is_async_p, remote_async): Add 'ops' argument.
(remote_stopped_data_address): Update.
* s390-nat.c (s390_stopped_by_watchpoint): Add 'ops' argument.
* target.c (update_current_target)
(find_default_can_async_p, find_default_is_async_p): Update.
(init_dummy_target): Update.
(debug_to_stopped_by_watchpoint): Add 'ops' argument.
* target.h (struct target_ops) <to_stopped_by_watchpoint,
to_can_async_p, to_is_async_p, to_async>: Add 'ops' argument.
(target_can_async_p, target_is_async_p, target_async)
(target_stopped_by_watchpoint): Update.

18 files changed:
gdb/ChangeLog
gdb/aarch64-linux-nat.c
gdb/arm-linux-nat.c
gdb/i386-nat.c
gdb/ia64-linux-nat.c
gdb/inf-ttrace.c
gdb/linux-nat.c
gdb/mips-linux-nat.c
gdb/nto-procfs.c
gdb/ppc-linux-nat.c
gdb/procfs.c
gdb/record-full.c
gdb/remote-m32r-sdi.c
gdb/remote-mips.c
gdb/remote.c
gdb/s390-linux-nat.c
gdb/target.c
gdb/target.h

index 5b61324d3589e397b32f07efcd56a1a06c784fab..770a534cfda822c164bb7762abdc9120ada8e2da 100644 (file)
@@ -1,3 +1,45 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * aarch64-linux-nat.c (aarch64_linux_stopped_by_watchpoint):
+       Add 'ops' argument.
+       * arm-linux-nat.c (arm_linux_stopped_by_watchpoint): Add
+       'ops' argument.
+       * i386-nat.c (i386_stopped_by_watchpoint): Add 'ops' argument.
+       * ia64-linux-nat.c (ia64_linux_stopped_by_watchpoint): Add
+       'ops' argument.
+       * inf-ttrace.c (inf_ttrace_stopped_by_watchpoint): Add 'ops'
+       argument.
+       * linux-nat.c (save_sigtrap): Update.
+       (linux_nat_stopped_by_watchpoint, linux_nat_is_async_p)
+       (linux_nat_can_async_p, linux_nat_async): Add 'ops' argument.
+       (linux_nat_close): Update.
+       * mips-linux-nat.c (mips_linux_stopped_by_watchpoint): Add 'ops'
+       argument.
+       * ppc-linux-nat.c (ppc_linux_stopped_by_watchpoint): Add 'ops'
+       argument.
+       * procfs.c (procfs_stopped_by_watchpoint): Add 'ops' argument.
+       * record-full.c (record_full_beneath_to_stopped_by_watchpoint)
+       (record_full_beneath_to_async, tmp_to_stopped_by_watchpoint)
+       (tmp_to_async): Add 'ops' argument.
+       (record_full_stopped_by_watchpoint, record_full_async)
+       (record_full_can_async_p, record_full_is_async_p): Add 'ops'
+       argument.
+       * remote-m32r-sdi.c (m32r_insert_breakpoint, m32r_remove_breakpoint)
+       (m32r_stopped_by_watchpoint): Add 'ops' argument.
+       * remote-mips.c (mips_stopped_by_watchpoint): Add 'ops' argument.
+       * remote.c (remote_stopped_by_watchpoint_p, remote_can_async_p)
+       (remote_is_async_p, remote_async): Add 'ops' argument.
+       (remote_stopped_data_address): Update.
+       * s390-nat.c (s390_stopped_by_watchpoint): Add 'ops' argument.
+       * target.c (update_current_target)
+       (find_default_can_async_p, find_default_is_async_p): Update.
+       (init_dummy_target): Update.
+       (debug_to_stopped_by_watchpoint): Add 'ops' argument.
+       * target.h (struct target_ops) <to_stopped_by_watchpoint,
+       to_can_async_p, to_is_async_p, to_async>: Add 'ops' argument.
+       (target_can_async_p, target_is_async_p, target_async)
+       (target_stopped_by_watchpoint): Update.
+
 2014-02-19  Yao Qi  <yao@codesourcery.com>
 
        PR gdb/16220
index 31c26c63ccbaf814b339bddc6aa74068fc753040..703c4ed96e92a9dc58e5226cae4a010c55f70c72 100644 (file)
@@ -1476,11 +1476,11 @@ aarch64_linux_stopped_data_address (struct target_ops *target,
 /* Implement the "to_stopped_by_watchpoint" target_ops method.  */
 
 static int
-aarch64_linux_stopped_by_watchpoint (void)
+aarch64_linux_stopped_by_watchpoint (struct target_ops *ops)
 {
   CORE_ADDR addr;
 
-  return aarch64_linux_stopped_data_address (&current_target, &addr);
+  return aarch64_linux_stopped_data_address (ops, &addr);
 }
 
 /* Implement the "to_watchpoint_addr_within_range" target_ops method.  */
index 6f56634e9815736632ff59af07ffe9a17c0aab83..9fa5f5b16635bb439e191074c98a26082f6b1935 100644 (file)
@@ -1171,10 +1171,10 @@ arm_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
 
 /* Has the target been stopped by hitting a watchpoint?  */
 static int
-arm_linux_stopped_by_watchpoint (void)
+arm_linux_stopped_by_watchpoint (struct target_ops *ops)
 {
   CORE_ADDR addr;
-  return arm_linux_stopped_data_address (&current_target, &addr);
+  return arm_linux_stopped_data_address (ops, &addr);
 }
 
 static int
index 034bf5126b0af35572c9e8be595b50a18c922538..23edc38a4044184cf64fd3e8b27caeebbadcbb5c 100644 (file)
@@ -756,10 +756,10 @@ i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
 }
 
 static int
-i386_stopped_by_watchpoint (void)
+i386_stopped_by_watchpoint (struct target_ops *ops)
 {
   CORE_ADDR addr = 0;
-  return i386_stopped_data_address (&current_target, &addr);
+  return i386_stopped_data_address (ops, &addr);
 }
 
 /* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
index 072c8fd90d29d0b01b4aea3846b26c7cfd2efc65..ea575c8bba4d59cb3d75072d3eaf9c3bf2e98cf6 100644 (file)
@@ -669,10 +669,10 @@ ia64_linux_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
 }
 
 static int
-ia64_linux_stopped_by_watchpoint (void)
+ia64_linux_stopped_by_watchpoint (struct target_ops *ops)
 {
   CORE_ADDR addr;
-  return ia64_linux_stopped_data_address (&current_target, &addr);
+  return ia64_linux_stopped_data_address (ops, &addr);
 }
 
 static int
index 2eec951c2185069dae879e44cc49d1981112f54b..e219fb8bdbc8f580916633828833dfe377cfe276 100644 (file)
@@ -374,7 +374,7 @@ inf_ttrace_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
    by hitting a "hardware" watchpoint.  */
 
 static int
-inf_ttrace_stopped_by_watchpoint (void)
+inf_ttrace_stopped_by_watchpoint (struct target_ops *ops)
 {
   pid_t pid = ptid_get_pid (inferior_ptid);
   lwpid_t lwpid = ptid_get_lwp (inferior_ptid);
index 1dac44d9065e322bdbc4d77241dd3721d600092b..6c31c3b2fd16ff2d21b4f0fc9df34e9e4d4f2ea5 100644 (file)
@@ -262,10 +262,6 @@ async_file_mark (void)
      be awakened anyway.  */
 }
 
-static void linux_nat_async (void (*callback)
-                            (enum inferior_event_type event_type,
-                             void *context),
-                            void *context);
 static int kill_lwp (int lwpid, int signo);
 
 static int stop_callback (struct lwp_info *lp, void *data);
@@ -2484,7 +2480,7 @@ save_sigtrap (struct lwp_info *lp)
   old_chain = save_inferior_ptid ();
   inferior_ptid = lp->ptid;
 
-  lp->stopped_by_watchpoint = linux_ops->to_stopped_by_watchpoint ();
+  lp->stopped_by_watchpoint = linux_ops->to_stopped_by_watchpoint (linux_ops);
 
   if (lp->stopped_by_watchpoint)
     {
@@ -2502,7 +2498,7 @@ save_sigtrap (struct lwp_info *lp)
 /* See save_sigtrap.  */
 
 static int
-linux_nat_stopped_by_watchpoint (void)
+linux_nat_stopped_by_watchpoint (struct target_ops *ops)
 {
   struct lwp_info *lp = find_lwp_pid (inferior_ptid);
 
@@ -4536,7 +4532,7 @@ linux_trad_target (CORE_ADDR (*register_u_offset)(struct gdbarch *, int, int))
 /* target_is_async_p implementation.  */
 
 static int
-linux_nat_is_async_p (void)
+linux_nat_is_async_p (struct target_ops *ops)
 {
   /* NOTE: palves 2008-03-21: We're only async when the user requests
      it explicitly with the "set target-async" command.
@@ -4547,7 +4543,7 @@ linux_nat_is_async_p (void)
 /* target_can_async_p implementation.  */
 
 static int
-linux_nat_can_async_p (void)
+linux_nat_can_async_p (struct target_ops *ops)
 {
   /* NOTE: palves 2008-03-21: We're only async when the user requests
      it explicitly with the "set target-async" command.
@@ -4707,8 +4703,10 @@ linux_async_pipe (int enable)
 /* target_async implementation.  */
 
 static void
-linux_nat_async (void (*callback) (enum inferior_event_type event_type,
-                                  void *context), void *context)
+linux_nat_async (struct target_ops *ops,
+                void (*callback) (enum inferior_event_type event_type,
+                                  void *context),
+                void *context)
 {
   if (callback != NULL)
     {
@@ -4793,8 +4791,8 @@ static void
 linux_nat_close (void)
 {
   /* Unregister from the event loop.  */
-  if (linux_nat_is_async_p ())
-    linux_nat_async (NULL, 0);
+  if (linux_nat_is_async_p (NULL))
+    linux_nat_async (NULL, NULL, 0);
 
   if (linux_ops->to_close)
     linux_ops->to_close ();
index ce0d135e5c9f71412bff70421358c3662f9826aa..627241fa815540d12b3968b58cc637a2b62b8f34 100644 (file)
@@ -553,7 +553,7 @@ mips_linux_can_use_hw_breakpoint (int type, int cnt, int ot)
    register triggered.  */
 
 static int
-mips_linux_stopped_by_watchpoint (void)
+mips_linux_stopped_by_watchpoint (struct target_ops *ops)
 {
   int n;
   int num_valid;
index 4669345cb387940b0ebceb993748d55f3117f1a1..7739197c185410a4dbd7318c4bd331db85d97002 100644 (file)
@@ -75,7 +75,7 @@ static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type,
 static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type,
                                        struct expression *cond);
 
-static int procfs_stopped_by_watchpoint (void);
+static int procfs_stopped_by_watchpoint (struct target_ops *ops);
 
 /* These two globals are only ever set in procfs_open(), but are
    referenced elsewhere.  'nto_procfs_node' is a flag used to say
@@ -1508,7 +1508,7 @@ procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type,
 }
 
 static int
-procfs_stopped_by_watchpoint (void)
+procfs_stopped_by_watchpoint (struct target_ops *ops)
 {
   return 0;
 }
index 8d57b9d89d581858ae26ee7ca0d845ae7a9beb6a..b38b33ef25a78ac33b539ee16d76a49531bab9bc 100644 (file)
@@ -2283,10 +2283,10 @@ ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
 }
 
 static int
-ppc_linux_stopped_by_watchpoint (void)
+ppc_linux_stopped_by_watchpoint (struct target_ops *ops)
 {
   CORE_ADDR addr;
-  return ppc_linux_stopped_data_address (&current_target, &addr);
+  return ppc_linux_stopped_data_address (ops, &addr);
 }
 
 static int
index 13a71aac7bcad47a7bc332f489d77c7d74113263..9cdbdd53e89387c488d250431acfb0955f5c9b5e 100644 (file)
@@ -4858,7 +4858,7 @@ procfs_can_use_hw_breakpoint (int type, int cnt, int othertype)
    fault, else returns zero.  */
 
 static int
-procfs_stopped_by_watchpoint (void)
+procfs_stopped_by_watchpoint (struct target_ops *ops)
 {
   procinfo *pi;
 
index b223a1bde0e98f79d0708be877f5ae3915ca57c8..1d3750be61255cf5840bc0e71867edb131a84ccb 100644 (file)
@@ -252,11 +252,12 @@ static int
                                               struct gdbarch *,
                                               struct bp_target_info *);
 static struct target_ops *record_full_beneath_to_remove_breakpoint_ops;
-static int (*record_full_beneath_to_stopped_by_watchpoint) (void);
+static int (*record_full_beneath_to_stopped_by_watchpoint) (struct target_ops *);
 static int (*record_full_beneath_to_stopped_data_address) (struct target_ops *,
                                                           CORE_ADDR *);
 static void
-  (*record_full_beneath_to_async) (void (*) (enum inferior_event_type, void *),
+  (*record_full_beneath_to_async) (struct target_ops *,
+                                  void (*) (enum inferior_event_type, void *),
                                   void *);
 
 static void record_full_goto_insn (struct record_full_entry *entry,
@@ -824,10 +825,10 @@ static struct target_ops *tmp_to_insert_breakpoint_ops;
 static int (*tmp_to_remove_breakpoint) (struct target_ops *, struct gdbarch *,
                                        struct bp_target_info *);
 static struct target_ops *tmp_to_remove_breakpoint_ops;
-static int (*tmp_to_stopped_by_watchpoint) (void);
+static int (*tmp_to_stopped_by_watchpoint) (struct target_ops *);
 static int (*tmp_to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
-static int (*tmp_to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
-static void (*tmp_to_async) (void (*) (enum inferior_event_type, void *), void *);
+static void (*tmp_to_async) (struct target_ops *,
+                            void (*) (enum inferior_event_type, void *), void *);
 
 static void record_full_restore (void);
 
@@ -1523,12 +1524,16 @@ record_full_wait (struct target_ops *ops,
 }
 
 static int
-record_full_stopped_by_watchpoint (void)
+record_full_stopped_by_watchpoint (struct target_ops *ops)
 {
   if (RECORD_FULL_IS_REPLAY)
     return record_full_hw_watchpoint;
   else
-    return record_full_beneath_to_stopped_by_watchpoint ();
+    {
+      struct target_ops *beneath = find_target_beneath (ops);
+
+      return record_full_beneath_to_stopped_by_watchpoint (beneath);
+    }
 }
 
 static int
@@ -1909,25 +1914,26 @@ record_full_goto_bookmark (gdb_byte *raw_bookmark, int from_tty)
 }
 
 static void
-record_full_async (void (*callback) (enum inferior_event_type event_type,
+record_full_async (struct target_ops *ops,
+                  void (*callback) (enum inferior_event_type event_type,
                                     void *context), void *context)
 {
   /* If we're on top of a line target (e.g., linux-nat, remote), then
      set it to async mode as well.  Will be NULL if we're sitting on
      top of the core target, for "record restore".  */
   if (record_full_beneath_to_async != NULL)
-    record_full_beneath_to_async (callback, context);
+    record_full_beneath_to_async (find_target_beneath (ops), callback, context);
 }
 
 static int
-record_full_can_async_p (void)
+record_full_can_async_p (struct target_ops *ops)
 {
   /* We only enable async when the user specifically asks for it.  */
   return target_async_permitted;
 }
 
 static int
-record_full_is_async_p (void)
+record_full_is_async_p (struct target_ops *ops)
 {
   /* We only enable async when the user specifically asks for it.  */
   return target_async_permitted;
index d7228767142c3cfae07857d6a0f50df7219010dd..48c4b4bd27d9af3abca9d731f78a7451d40bf561 100644 (file)
@@ -1477,7 +1477,7 @@ m32r_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
 }
 
 static int
-m32r_stopped_by_watchpoint (void)
+m32r_stopped_by_watchpoint (struct target_ops *ops)
 {
   CORE_ADDR addr;
 
index 6e7d9560fbf9346754843012f524ac9bd8ccbb7c..6109e64bf6d05d503391df0510822ba9b4190a4c 100644 (file)
@@ -2450,7 +2450,7 @@ mips_remove_watchpoint (CORE_ADDR addr, int len, int type,
    if not.  */
 
 static int
-mips_stopped_by_watchpoint (void)
+mips_stopped_by_watchpoint (struct target_ops *ops)
 {
   return hit_watchpoint;
 }
index 4a4674025563408400c218a8659c11c21cd92807..e6fd8b3517a9a1ff4f80cc41d4ba881afb30ec2b 100644 (file)
@@ -125,12 +125,14 @@ static void remote_serial_write (const char *str, int len);
 
 static void remote_kill (struct target_ops *ops);
 
-static int remote_can_async_p (void);
+static int remote_can_async_p (struct target_ops *);
 
-static int remote_is_async_p (void);
+static int remote_is_async_p (struct target_ops *);
 
-static void remote_async (void (*callback) (enum inferior_event_type event_type,
-                                           void *context), void *context);
+static void remote_async (struct target_ops *ops,
+                         void (*callback) (enum inferior_event_type event_type,
+                                           void *context),
+                         void *context);
 
 static void sync_remote_interrupt_twice (int signo);
 
@@ -8294,7 +8296,7 @@ remote_check_watch_resources (int type, int cnt, int ot)
 }
 
 static int
-remote_stopped_by_watchpoint (void)
+remote_stopped_by_watchpoint (struct target_ops *ops)
 {
   struct remote_state *rs = get_remote_state ();
 
@@ -8307,7 +8309,7 @@ remote_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
   struct remote_state *rs = get_remote_state ();
   int rc = 0;
 
-  if (remote_stopped_by_watchpoint ())
+  if (remote_stopped_by_watchpoint (target))
     {
       *addr_p = rs->remote_watch_data_address;
       rc = 1;
@@ -11493,7 +11495,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya).";
 }
 
 static int
-remote_can_async_p (void)
+remote_can_async_p (struct target_ops *ops)
 {
   struct remote_state *rs = get_remote_state ();
 
@@ -11506,7 +11508,7 @@ remote_can_async_p (void)
 }
 
 static int
-remote_is_async_p (void)
+remote_is_async_p (struct target_ops *ops)
 {
   struct remote_state *rs = get_remote_state ();
 
@@ -11541,8 +11543,10 @@ remote_async_inferior_event_handler (gdb_client_data data)
 }
 
 static void
-remote_async (void (*callback) (enum inferior_event_type event_type,
-                               void *context), void *context)
+remote_async (struct target_ops *ops,
+             void (*callback) (enum inferior_event_type event_type,
+                               void *context),
+             void *context)
 {
   struct remote_state *rs = get_remote_state ();
 
index ee9b617deecb1ffbc255ff3dd235adbdb8a9378b..8cc9060baece90a7585259753d921de3a0fee906 100644 (file)
@@ -433,7 +433,7 @@ struct watch_area
 static struct watch_area *watch_base = NULL;
 
 static int
-s390_stopped_by_watchpoint (void)
+s390_stopped_by_watchpoint (struct target_ops *ops)
 {
   per_lowcore_bits per_lowcore;
   ptrace_area parea;
index 92d5e3943a1f4226fb44230028a1451f48151ce7..990dc5e36107c322805433a03fb24dd11457a967 100644 (file)
@@ -110,8 +110,6 @@ static int debug_to_insert_watchpoint (CORE_ADDR, int, int,
 static int debug_to_remove_watchpoint (CORE_ADDR, int, int,
                                       struct expression *);
 
-static int debug_to_stopped_by_watchpoint (void);
-
 static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *);
 
 static int debug_to_watchpoint_addr_within_range (struct target_ops *,
@@ -742,7 +740,7 @@ update_current_target (void)
            (int (*) (CORE_ADDR, int, int, struct expression *))
            return_minus_one);
   de_fault (to_stopped_by_watchpoint,
-           (int (*) (void))
+           (int (*) (struct target_ops *))
            return_zero);
   de_fault (to_stopped_data_address,
            (int (*) (struct target_ops *, CORE_ADDR *))
@@ -820,7 +818,9 @@ update_current_target (void)
            (char *(*) (int))
            return_null);
   de_fault (to_async,
-           (void (*) (void (*) (enum inferior_event_type, void*), void*))
+           (void (*) (struct target_ops *,
+                      void (*) (enum inferior_event_type, void*),
+                      void*))
            tcomplain);
   de_fault (to_thread_architecture,
            default_thread_architecture);
@@ -3231,7 +3231,7 @@ find_default_create_inferior (struct target_ops *ops,
 }
 
 static int
-find_default_can_async_p (void)
+find_default_can_async_p (struct target_ops *ignore)
 {
   struct target_ops *t;
 
@@ -3241,12 +3241,12 @@ find_default_can_async_p (void)
      connected yet.  */
   t = find_default_run_target (NULL);
   if (t && t->to_can_async_p)
-    return (t->to_can_async_p) ();
+    return (t->to_can_async_p) (t);
   return 0;
 }
 
 static int
-find_default_is_async_p (void)
+find_default_is_async_p (struct target_ops *ignore)
 {
   struct target_ops *t;
 
@@ -3256,7 +3256,7 @@ find_default_is_async_p (void)
      connected yet.  */
   t = find_default_run_target (NULL);
   if (t && t->to_is_async_p)
-    return (t->to_is_async_p) ();
+    return (t->to_is_async_p) (t);
   return 0;
 }
 
@@ -3864,7 +3864,8 @@ init_dummy_target (void)
   dummy_target.to_has_registers = (int (*) (struct target_ops *)) return_zero;
   dummy_target.to_has_execution
     = (int (*) (struct target_ops *, ptid_t)) return_zero;
-  dummy_target.to_stopped_by_watchpoint = return_zero;
+  dummy_target.to_stopped_by_watchpoint
+    = (int (*) (struct target_ops *)) return_zero;
   dummy_target.to_stopped_data_address =
     (int (*) (struct target_ops *, CORE_ADDR *)) return_zero;
   dummy_target.to_magic = OPS_MAGIC;
@@ -4743,11 +4744,11 @@ debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw,
 }
 
 static int
-debug_to_stopped_by_watchpoint (void)
+debug_to_stopped_by_watchpoint (struct target_ops *ops)
 {
   int retval;
 
-  retval = debug_target.to_stopped_by_watchpoint ();
+  retval = debug_target.to_stopped_by_watchpoint (&debug_target);
 
   fprintf_unfiltered (gdb_stdlog,
                      "target_stopped_by_watchpoint () = %ld\n",
index 9fa56f237decc810d1fc240d12b4256bfff5e30c..83e3b590e16d134b92aeb960f7a06b9e2d7d5d67 100644 (file)
@@ -435,7 +435,7 @@ struct target_ops
                                      CORE_ADDR, CORE_ADDR, int);
     int (*to_remove_mask_watchpoint) (struct target_ops *,
                                      CORE_ADDR, CORE_ADDR, int);
-    int (*to_stopped_by_watchpoint) (void);
+    int (*to_stopped_by_watchpoint) (struct target_ops *);
     int to_have_steppable_watchpoint;
     int to_have_continuable_watchpoint;
     int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
@@ -500,9 +500,10 @@ struct target_ops
     int to_has_thread_control; /* control thread execution */
     int to_attach_no_wait;
     /* ASYNC target controls */
-    int (*to_can_async_p) (void);
-    int (*to_is_async_p) (void);
-    void (*to_async) (async_callback_ftype *, void *);
+    int (*to_can_async_p) (struct target_ops *);
+    int (*to_is_async_p) (struct target_ops *);
+    void (*to_async) (struct target_ops *,
+                     async_callback_ftype *, void *);
     int (*to_supports_non_stop) (void);
     /* find_memory_regions support method for gcore */
     int (*to_find_memory_regions) (find_memory_region_ftype func, void *data);
@@ -1469,16 +1470,16 @@ extern int default_child_has_execution (struct target_ops *ops,
 extern int target_async_permitted;
 
 /* Can the target support asynchronous execution?  */
-#define target_can_async_p() (current_target.to_can_async_p ())
+#define target_can_async_p() (current_target.to_can_async_p (&current_target))
 
 /* Is the target in asynchronous execution mode?  */
-#define target_is_async_p() (current_target.to_is_async_p ())
+#define target_is_async_p() (current_target.to_is_async_p (&current_target))
 
 int target_supports_non_stop (void);
 
 /* Put the target in async mode with the specified callback function.  */
 #define target_async(CALLBACK,CONTEXT) \
-     (current_target.to_async ((CALLBACK), (CONTEXT)))
+     (current_target.to_async (&current_target, (CALLBACK), (CONTEXT)))
 
 #define target_execution_direction() \
   (current_target.to_execution_direction ())
@@ -1552,8 +1553,8 @@ extern char *target_thread_name (struct thread_info *);
 /* Returns non-zero if we were stopped by a hardware watchpoint (memory read or
    write).  Only the INFERIOR_PTID task is being queried.  */
 
-#define target_stopped_by_watchpoint \
-   (*current_target.to_stopped_by_watchpoint)
+#define target_stopped_by_watchpoint()         \
+  ((*current_target.to_stopped_by_watchpoint) (&current_target))
 
 /* Non-zero if we have steppable watchpoints  */