This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC 09/32] Add target_ops argument to to_close


2014-01-08  Tom Tromey  <tromey@redhat.com>

	* windows-nat.c (windows_close): Add 'self' argument.
	* tracepoint.c (tfile_close): Add 'self' argument.
	* target.h (struct target_ops) <to_close>: Add argument.
	* target.c (target_close): Add argument.
	(update_current_target): Update.
	* remote.c (remote_close): Add 'self' argument.
	* remote-sim.c (gdbsim_close): Add 'self' argument.
	* remote-mips.c (mips_close): Add 'self' argument.
	* remote-m32r-sdi.c (m32r_close): Add 'self' argument.
	* record-full.c (record_full_close): Add 'self' argument.
	* record-btrace.c (record_btrace_close): Add 'self' argument.
	* monitor.h (monitor_close): Add 'self' argument.
	* monitor.c (monitor_close): Add 'self' argument.
	* mips-linux-nat.c (mips_linux_close): Add 'self' argument.
	* linux-nat.c (linux_nat_close): Add argument.
	* go32-nat.c (go32_close): Add 'self' argument.
	* exec.c (exec_close_1): Add 'self' argument.
	* ctf.c (ctf_close): Add 'self' argument.
	* corelow.c (core_close): Add 'self' argument.
	(core_close_cleanup): Update.
	* bsd-uthread.c (bsd_uthread_close): Add 'self' argument.
	* bsd-kvm.c (bsd_kvm_close): Add 'self' argument.

Add target_ops argument to to_post_attach

2014-01-08  Tom Tromey  <tromey@redhat.com>

	* target.h (struct target_ops) <to_post_attach>: Add argument.
	(target_post_attach): Add argument.
	* target.c (debug_to_post_attach): Add argument.
	(update_current_target): Update.
	* spu-linux-nat.c (spu_child_post_attach): Add 'self' argument.
	* nto-procfs.c (procfs_post_attach): Add 'self' argument.
	* linux-nat.c (linux_child_post_attach): Add 'self' argument.
	* inf-ptrace.c (inf_ptrace_post_attach): Add 'self' argument.
	* inf-child.c (inf_child_post_attach): Add 'self' argument.

Add target_ops argument to to_prepare_to_store

2014-01-08  Tom Tromey  <tromey@redhat.com>

	* windows-nat.c (windows_prepare_to_store): Add 'self' argument.
	* target.h (struct target_ops) <to_prepare_to_store>: Add
	argument.
	(target_prepare_to_store): Add argument.
	* target.c (debug_to_prepare_to_store): Add argument.
	(update_current_target): Update.
	* remote.c (remote_prepare_to_store): Add 'self' argument.
	* remote-sim.c (gdbsim_prepare_to_store): Add 'self' argument.
	* remote-mips.c (mips_prepare_to_store): Add 'self' argument.
	* remote-m32r-sdi.c (m32r_prepare_to_store): Add 'self' argument.
	* record-full.c (record_full_core_prepare_to_store): Add 'self'
	argument.
	* ravenscar-thread.c (ravenscar_prepare_to_store): Add argument.
	* nto-procfs.c (procfs_prepare_to_store): Add 'self' argument.
	* monitor.c (monitor_prepare_to_store): Add 'self' argument.
	* inf-child.c (inf_child_prepare_to_store): Add 'self' argument.
	* go32-nat.c (go32_prepare_to_store): Add 'self' argument.

Add target_ops argument to to_can_use_hw_breakpoint

2014-01-08  Tom Tromey  <tromey@redhat.com>

	* target.h (struct target_ops) <to_can_use_hw_breakpoint>: Add
	argument.
	(target_can_use_hardware_watchpoint): Add argument.
	* target.c (debug_to_can_use_hw_breakpoint): Add argument.
	(update_current_target): Update.
	* spu-linux-nat.c (spu_can_use_hw_breakpoint): Add 'self'
	argument.
	* s390-linux-nat.c (s390_can_use_hw_breakpoint): Add 'self'
	argument.
	* remote.c (remote_check_watch_resources): Add 'self' argument.
	* remote-mips.c (mips_can_use_watchpoint): Add 'self' argument.
	* remote-m32r-sdi.c (m32r_can_use_hw_watchpoint): Add 'self'
	argument.
	* procfs.c (procfs_can_use_hw_breakpoint): Add 'self' argument.
	* ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Add 'self'
	argument.
	* nto-procfs.c (procfs_can_use_hw_breakpoint): Add 'self'
	argument.
	* mips-linux-nat.c (mips_linux_can_use_hw_breakpoint): Add 'self'
	argument.
	* inf-ttrace.c (inf_ttrace_can_use_hw_breakpoint): Add 'self'
	argument.
	* ia64-linux-nat.c (ia64_linux_can_use_hw_breakpoint): Add 'self'
	argument.
	* ia64-hpux-nat.c (ia64_hpux_can_use_hw_breakpoint): Add 'self'
	argument.
	* i386-nat.c (i386_can_use_hw_breakpoint): Add 'self' argument.
	* arm-linux-nat.c (arm_linux_can_use_hw_breakpoint): Add 'self'
	argument.
	* aarch64-linux-nat.c (aarch64_linux_can_use_hw_breakpoint): Add
	'self' argument.

Add target_ops argument to to_insert_hw_breakpoint

2014-01-08  Tom Tromey  <tromey@redhat.com>

	* target.h (struct target_ops) <to_insert_hw_breakpoint>: Add
	argument.
	(target_insert_hw_breakpoint): Add argument.
	* target.c (debug_to_insert_hw_breakpoint): Add argument.
	(update_current_target): Update.
	* remote.c (remote_insert_hw_breakpoint): Add 'self' argument.
	* ppc-linux-nat.c (ppc_linux_insert_hw_breakpoint): Add 'self'
	argument.
	* nto-procfs.c (procfs_insert_hw_breakpoint): Add 'self' argument.
	* i386-nat.c (i386_insert_hw_breakpoint): Add 'self' argument.
	* arm-linux-nat.c (arm_linux_insert_hw_breakpoint): Add 'self'
	argument.
	* aarch64-linux-nat.c (aarch64_linux_insert_hw_breakpoint): Add
	'self' argument.

Add target_ops argument to to_remove_hw_breakpoint

2014-01-08  Tom Tromey  <tromey@redhat.com>

	* target.h (struct target_ops) <to_remove_hw_breakpoint>: Add
	argument.
	(target_remove_hw_breakpoint): Add argument.
	* target.c (debug_to_remove_hw_breakpoint): Add argument.
	(update_current_target): Update.
	* remote.c (remote_remove_hw_breakpoint): Add 'self' argument.
	* ppc-linux-nat.c (ppc_linux_remove_hw_breakpoint): Add 'self'
	argument.
	* nto-procfs.c (procfs_remove_breakpoint): Add 'self' argument.
	* i386-nat.c (i386_remove_hw_breakpoint): Add 'self' argument.
	* arm-linux-nat.c (arm_linux_remove_hw_breakpoint): Add 'self'
	argument.
	* aarch64-linux-nat.c (aarch64_linux_remove_hw_breakpoint): Add
	'self' argument.

Add target_ops argument to to_remove_watchpoint

2014-01-08  Tom Tromey  <tromey@redhat.com>

	* target.h (struct target_ops) <to_remove_watchpoint>: Add
	argument.
	(target_remove_watchpoint): Add argument.
	* target.c (debug_to_remove_watchpoint): Add argument.
	(update_current_target): Update.
	* s390-linux-nat.c (s390_remove_watchpoint): Add 'self' argument.
	* remote.c (remote_remove_watchpoint): Add 'self' argument.
	* remote-mips.c (mips_remove_watchpoint): Add 'self' argument.
	* remote-m32r-sdi.c (m32r_remove_watchpoint): Add 'self' argument.
	* procfs.c (procfs_remove_watchpoint): Add 'self' argument.
	* ppc-linux-nat.c (ppc_linux_remove_watchpoint): Add 'self'
	argument.
	* nto-procfs.c (procfs_remove_hw_watchpoint): Add 'self' argument.
	* mips-linux-nat.c (mips_linux_remove_watchpoint): Add 'self'
	argument.
	* inf-ttrace.c (inf_ttrace_remove_watchpoint): Add 'self'
	argument.
	* ia64-linux-nat.c (ia64_linux_remove_watchpoint): Add 'self'
	argument.
	* i386-nat.c (i386_remove_watchpoint): Add 'self' argument.
	* arm-linux-nat.c (arm_linux_remove_watchpoint): Add 'self'
	argument.
	* aarch64-linux-nat.c (aarch64_linux_remove_watchpoint): Add
	'self' argument.

Add target_ops argument to to_insert_watchpoint

2014-01-08  Tom Tromey  <tromey@redhat.com>

	* target.h (struct target_ops) <to_insert_watchpoint>: Add
	argument.
	(target_insert_watchpoint): Add argument.
	* target.c (debug_to_insert_watchpoint): Add argument.
	(update_current_target): Update.
	* s390-linux-nat.c (s390_insert_watchpoint): Add 'self' argument.
	* remote.c (remote_insert_watchpoint): Add 'self' argument.
	* remote-mips.c (mips_insert_watchpoint): Add 'self' argument.
	* remote-m32r-sdi.c (m32r_insert_watchpoint): Add 'self' argument.
	* procfs.c (procfs_insert_watchpoint): Add 'self' argument.
	* ppc-linux-nat.c (ppc_linux_insert_watchpoint): Add 'self'
	argument.
	* nto-procfs.c (procfs_insert_hw_watchpoint): Add 'self' argument.
	(procfs_insert_hw_watchpoint): Add 'self' argument.
	* mips-linux-nat.c (mips_linux_insert_watchpoint): Add 'self'
	argument.
	* inf-ttrace.c (inf_ttrace_insert_watchpoint): Add 'self'
	argument.
	* ia64-linux-nat.c (ia64_linux_insert_watchpoint): Add 'self'
	argument.
	* i386-nat.c (i386_insert_watchpoint): Add 'self' argument.
	* arm-linux-nat.c (arm_linux_insert_watchpoint): Add 'self'
	argument.
	* aarch64-linux-nat.c (aarch64_linux_insert_watchpoint): Add
	'self' argument.

Add target_ops argument to to_region_ok_for_hw_watchpoint

2014-01-08  Tom Tromey  <tromey@redhat.com>

	* target.h (struct target_ops) <to_region_ok_for_hw_watchpoint>:
	Add argument.
	(target_region_ok_for_hw_watchpoint): Add argument.
	* target.c (debug_to_region_ok_for_hw_watchpoint): Add argument.
	(default_region_ok_for_hw_watchpoint): Add argument.
	* spu-multiarch.c (spu_region_ok_for_hw_watchpoint): Add argument.
	* s390-linux-nat.c (s390_region_ok_for_hw_watchpoint): Add 'self'
	argument.
	* remote.c (remote_region_ok_for_hw_watchpoint): Add 'self'
	argument.
	* procfs.c (procfs_region_ok_for_hw_watchpoint): Add 'self'
	argument.
	* ppc-linux-nat.c (ppc_linux_region_ok_for_hw_watchpoint): Add
	'self' argument.
	* mips-linux-nat.c (mips_linux_region_ok_for_hw_watchpoint): Add
	'self' argument.
	* inf-ttrace.c (inf_ttrace_region_ok_for_hw_watchpoint): Add
	'self' argument.
	* i386-nat.c (i386_region_ok_for_watchpoint): Add 'self' argument.
	* arm-linux-nat.c (arm_linux_region_ok_for_hw_watchpoint): Add
	'self' argument.
	* aarch64-linux-nat.c (aarch64_linux_region_ok_for_hw_watchpoint):
	Add 'self' argument.

Add target_ops argument to to_can_accel_watchpoint_condition

2014-01-08  Tom Tromey  <tromey@redhat.com>

	* target.h (struct target_ops)
	<to_can_accel_watchpoint_condition>: Add argument.
	(target_can_accel_watchpoint_condition): Add argument.
	* target.c (debug_to_can_accel_watchpoint_condition): Add
	argument.
	(update_current_target): Update.
	* ppc-linux-nat.c (ppc_linux_can_accel_watchpoint_condition): Add
	'self' argument.
---
 gdb/ChangeLog           | 217 ++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/aarch64-linux-nat.c |  18 ++--
 gdb/arm-linux-nat.c     |  18 ++--
 gdb/bsd-kvm.c           |   2 +-
 gdb/bsd-uthread.c       |   2 +-
 gdb/corelow.c           |   6 +-
 gdb/ctf.c               |   2 +-
 gdb/exec.c              |   2 +-
 gdb/go32-nat.c          |   9 +-
 gdb/i386-nat.c          |  16 ++--
 gdb/ia64-hpux-nat.c     |   3 +-
 gdb/ia64-linux-nat.c    |   9 +-
 gdb/inf-child.c         |   5 +-
 gdb/inf-ptrace.c        |   2 +-
 gdb/inf-ttrace.c        |  12 ++-
 gdb/linux-nat.c         |   6 +-
 gdb/mips-linux-nat.c    |  14 ++--
 gdb/monitor.c           |   4 +-
 gdb/monitor.h           |   2 +-
 gdb/nto-procfs.c        |  26 +++---
 gdb/ppc-linux-nat.c     |  21 +++--
 gdb/procfs.c            |  15 ++--
 gdb/ravenscar-thread.c  |   8 +-
 gdb/record-btrace.c     |   2 +-
 gdb/record-full.c       |   5 +-
 gdb/remote-m32r-sdi.c   |  13 +--
 gdb/remote-mips.c       |  18 ++--
 gdb/remote-sim.c        |   9 +-
 gdb/remote.c            |  25 +++---
 gdb/s390-linux-nat.c    |  12 ++-
 gdb/spu-linux-nat.c     |   5 +-
 gdb/spu-multiarch.c     |   6 +-
 gdb/target.c            | 105 ++++++++++++++---------
 gdb/target.h            |  51 +++++++-----
 gdb/tracepoint.c        |   2 +-
 gdb/windows-nat.c       |   4 +-
 36 files changed, 503 insertions(+), 173 deletions(-)

diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index 5f4baa5..a59a6e7 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -938,7 +938,8 @@ aarch64_align_watchpoint (CORE_ADDR addr, int len, CORE_ADDR *aligned_addr_p,
    sharing implemented via reference counts.  */
 
 static int
-aarch64_linux_can_use_hw_breakpoint (int type, int cnt, int othertype)
+aarch64_linux_can_use_hw_breakpoint (struct target_ops *self,
+				     int type, int cnt, int othertype)
 {
   return 1;
 }
@@ -1198,7 +1199,8 @@ aarch64_handle_breakpoint (int type, CORE_ADDR addr, int len, int is_insert)
    Return 0 on success, -1 on failure.  */
 
 static int
-aarch64_linux_insert_hw_breakpoint (struct gdbarch *gdbarch,
+aarch64_linux_insert_hw_breakpoint (struct target_ops *self,
+				    struct gdbarch *gdbarch,
 				    struct bp_target_info *bp_tgt)
 {
   int ret;
@@ -1230,7 +1232,8 @@ aarch64_linux_insert_hw_breakpoint (struct gdbarch *gdbarch,
    Return 0 on success, -1 on failure.  */
 
 static int
-aarch64_linux_remove_hw_breakpoint (struct gdbarch *gdbarch,
+aarch64_linux_remove_hw_breakpoint (struct target_ops *self,
+				    struct gdbarch *gdbarch,
 				    struct bp_target_info *bp_tgt)
 {
   int ret;
@@ -1334,7 +1337,8 @@ aarch64_handle_watchpoint (int type, CORE_ADDR addr, int len, int is_insert)
    of the type TYPE.  Return 0 on success, -1 on failure.  */
 
 static int
-aarch64_linux_insert_watchpoint (CORE_ADDR addr, int len, int type,
+aarch64_linux_insert_watchpoint (struct target_ops *self,
+				 CORE_ADDR addr, int len, int type,
 				 struct expression *cond)
 {
   int ret;
@@ -1366,7 +1370,8 @@ aarch64_linux_insert_watchpoint (CORE_ADDR addr, int len, int type,
    type TYPE.  Return 0 on success, -1 on failure.  */
 
 static int
-aarch64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type,
+aarch64_linux_remove_watchpoint (struct target_ops *self,
+				 CORE_ADDR addr, int len, int type,
 				 struct expression *cond)
 {
   int ret;
@@ -1395,7 +1400,8 @@ aarch64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type,
 /* Implement the "to_region_ok_for_hw_watchpoint" target_ops method.  */
 
 static int
-aarch64_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
+aarch64_linux_region_ok_for_hw_watchpoint (struct target_ops *self,
+					   CORE_ADDR addr, int len)
 {
   CORE_ADDR aligned_addr;
 
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 0dc6e2a..7cd7d63 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -747,7 +747,8 @@ arm_linux_get_hw_watchpoint_count (void)
 /* Have we got a free break-/watch-point available for use?  Returns -1 if
    there is not an appropriate resource available, otherwise returns 1.  */
 static int
-arm_linux_can_use_hw_breakpoint (int type, int cnt, int ot)
+arm_linux_can_use_hw_breakpoint (struct target_ops *self,
+				 int type, int cnt, int ot)
 {
   if (type == bp_hardware_watchpoint || type == bp_read_watchpoint
       || type == bp_access_watchpoint || type == bp_watchpoint)
@@ -1036,7 +1037,8 @@ arm_linux_remove_hw_breakpoint1 (const struct arm_linux_hw_breakpoint *bpt,
 
 /* Insert a Hardware breakpoint.  */
 static int
-arm_linux_insert_hw_breakpoint (struct gdbarch *gdbarch, 
+arm_linux_insert_hw_breakpoint (struct target_ops *self,
+				struct gdbarch *gdbarch, 
 				struct bp_target_info *bp_tgt)
 {
   struct lwp_info *lp;
@@ -1054,7 +1056,8 @@ arm_linux_insert_hw_breakpoint (struct gdbarch *gdbarch,
 
 /* Remove a hardware breakpoint.  */
 static int
-arm_linux_remove_hw_breakpoint (struct gdbarch *gdbarch, 
+arm_linux_remove_hw_breakpoint (struct target_ops *self,
+				struct gdbarch *gdbarch, 
 				struct bp_target_info *bp_tgt)
 {
   struct lwp_info *lp;
@@ -1073,7 +1076,8 @@ arm_linux_remove_hw_breakpoint (struct gdbarch *gdbarch,
 /* Are we able to use a hardware watchpoint for the LEN bytes starting at 
    ADDR?  */
 static int
-arm_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
+arm_linux_region_ok_for_hw_watchpoint (struct target_ops *self,
+				       CORE_ADDR addr, int len)
 {
   const struct arm_linux_hwbp_cap *cap = arm_linux_get_hwbp_cap ();
   CORE_ADDR max_wp_length, aligned_addr;
@@ -1105,7 +1109,8 @@ arm_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
 
 /* Insert a Hardware breakpoint.  */
 static int
-arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
+arm_linux_insert_watchpoint (struct target_ops *self,
+			     CORE_ADDR addr, int len, int rw,
 			     struct expression *cond)
 {
   struct lwp_info *lp;
@@ -1123,7 +1128,8 @@ arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
 
 /* Remove a hardware breakpoint.  */
 static int
-arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
+arm_linux_remove_watchpoint (struct target_ops *self,
+			     CORE_ADDR addr, int len, int rw,
 			     struct expression *cond)
 {
   struct lwp_info *lp;
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index d1e7ca8..7d755e3 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -104,7 +104,7 @@ bsd_kvm_open (char *filename, int from_tty)
 }
 
 static void
-bsd_kvm_close (void)
+bsd_kvm_close (struct target_ops *self)
 {
   if (core_kd)
     {
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 0a2ea81..1da4172 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -204,7 +204,7 @@ bsd_uthread_activate (struct objfile *objfile)
 /* Cleanup due to deactivation.  */
 
 static void
-bsd_uthread_close (void)
+bsd_uthread_close (struct target_ops *self)
 {
   bsd_uthread_active = 0;
   bsd_uthread_thread_run_addr = 0;
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 50f89cf..4b72203 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -85,7 +85,7 @@ static int gdb_check_format (bfd *);
 
 static void core_open (char *, int);
 
-static void core_close (void);
+static void core_close (struct target_ops *self);
 
 static void core_close_cleanup (void *ignore);
 
@@ -192,7 +192,7 @@ gdb_check_format (bfd *abfd)
    stack spaces as empty.  */
 
 static void
-core_close (void)
+core_close (struct target_ops *self)
 {
   if (core_bfd)
     {
@@ -223,7 +223,7 @@ core_close (void)
 static void
 core_close_cleanup (void *ignore)
 {
-  core_close ();
+  core_close (NULL);
 }
 
 /* Look for sections whose names start with `.reg/' so that we can
diff --git a/gdb/ctf.c b/gdb/ctf.c
index b886d67..239afb2 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1196,7 +1196,7 @@ ctf_open (char *dirname, int from_tty)
    CTF iterator and context.  */
 
 static void
-ctf_close (void)
+ctf_close (struct target_ops *self)
 {
   ctf_destroy ();
   xfree (trace_dirname);
diff --git a/gdb/exec.c b/gdb/exec.c
index 70409d9..5fe5b8b 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -112,7 +112,7 @@ exec_close (void)
    sections and closes all executable bfds from all program spaces.  */
 
 static void
-exec_close_1 (void)
+exec_close_1 (struct target_ops *self)
 {
   using_exec_ops = 0;
 
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index c1172f6..ef6ceef 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -235,7 +235,7 @@ static int dr_ref_count[4];
 
 static int prog_has_started = 0;
 static void go32_open (char *name, int from_tty);
-static void go32_close (void);
+static void go32_close (struct target_ops *self);
 static void go32_attach (struct target_ops *ops, char *args, int from_tty);
 static void go32_detach (struct target_ops *ops, char *args, int from_tty);
 static void go32_resume (struct target_ops *ops,
@@ -246,7 +246,8 @@ static void go32_fetch_registers (struct target_ops *ops,
 static void store_register (const struct regcache *, int regno);
 static void go32_store_registers (struct target_ops *ops,
 				  struct regcache *, int regno);
-static void go32_prepare_to_store (struct regcache *);
+static void go32_prepare_to_store (struct target_ops *self,
+				   struct regcache *);
 static int go32_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
 			     int write,
 			     struct mem_attrib *attrib,
@@ -371,7 +372,7 @@ go32_open (char *name, int from_tty)
 }
 
 static void
-go32_close (void)
+go32_close (struct target_ops *self)
 {
 }
 
@@ -598,7 +599,7 @@ go32_store_registers (struct target_ops *ops,
 }
 
 static void
-go32_prepare_to_store (struct regcache *regcache)
+go32_prepare_to_store (struct target_ops *self, struct regcache *regcache)
 {
 }
 
diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
index 8d54ae0..dc61edb 100644
--- a/gdb/i386-nat.c
+++ b/gdb/i386-nat.c
@@ -589,7 +589,8 @@ i386_update_inferior_debug_regs (struct i386_debug_reg_state *new_state)
    of the type TYPE.  Return 0 on success, -1 on failure.  */
 
 static int
-i386_insert_watchpoint (CORE_ADDR addr, int len, int type,
+i386_insert_watchpoint (struct target_ops *self,
+			CORE_ADDR addr, int len, int type,
 			struct expression *cond)
 {
   struct i386_debug_reg_state *state
@@ -627,7 +628,8 @@ i386_insert_watchpoint (CORE_ADDR addr, int len, int type,
    address ADDR, whose length is LEN bytes, and for accesses of the
    type TYPE.  Return 0 on success, -1 on failure.  */
 static int
-i386_remove_watchpoint (CORE_ADDR addr, int len, int type,
+i386_remove_watchpoint (struct target_ops *self,
+			CORE_ADDR addr, int len, int type,
 			struct expression *cond)
 {
   struct i386_debug_reg_state *state
@@ -662,7 +664,8 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type,
    address ADDR and whose length is LEN bytes.  */
 
 static int
-i386_region_ok_for_watchpoint (CORE_ADDR addr, int len)
+i386_region_ok_for_watchpoint (struct target_ops *self,
+			       CORE_ADDR addr, int len)
 {
   struct i386_debug_reg_state *state
     = i386_debug_reg_state (ptid_get_pid (inferior_ptid));
@@ -765,7 +768,7 @@ i386_stopped_by_watchpoint (struct target_ops *ops)
 /* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
    Return 0 on success, EBUSY on failure.  */
 static int
-i386_insert_hw_breakpoint (struct gdbarch *gdbarch,
+i386_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
 			   struct bp_target_info *bp_tgt)
 {
   struct i386_debug_reg_state *state
@@ -791,7 +794,7 @@ i386_insert_hw_breakpoint (struct gdbarch *gdbarch,
    Return 0 on success, -1 on failure.  */
 
 static int
-i386_remove_hw_breakpoint (struct gdbarch *gdbarch,
+i386_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
 			   struct bp_target_info *bp_tgt)
 {
   struct i386_debug_reg_state *state
@@ -831,7 +834,8 @@ i386_remove_hw_breakpoint (struct gdbarch *gdbarch,
    sharing implemented via reference counts in i386-nat.c.  */
 
 static int
-i386_can_use_hw_breakpoint (int type, int cnt, int othertype)
+i386_can_use_hw_breakpoint (struct target_ops *self,
+			    int type, int cnt, int othertype)
 {
   return 1;
 }
diff --git a/gdb/ia64-hpux-nat.c b/gdb/ia64-hpux-nat.c
index e4e1d32..bb684a4 100644
--- a/gdb/ia64-hpux-nat.c
+++ b/gdb/ia64-hpux-nat.c
@@ -696,7 +696,8 @@ ia64_hpux_xfer_partial (struct target_ops *ops, enum target_object object,
 /* The "to_can_use_hw_breakpoint" target_ops routine for ia64-hpux.  */
 
 static int
-ia64_hpux_can_use_hw_breakpoint (int type, int cnt, int othertype)
+ia64_hpux_can_use_hw_breakpoint (struct target_ops *self,
+				 int type, int cnt, int othertype)
 {
   /* No hardware watchpoint/breakpoint support yet.  */
   return 0;
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 51fbc81..5e05c9e 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -542,7 +542,8 @@ is_power_of_2 (int val)
 }
 
 static int
-ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
+ia64_linux_insert_watchpoint (struct target_ops *self,
+			      CORE_ADDR addr, int len, int rw,
 			      struct expression *cond)
 {
   struct lwp_info *lp;
@@ -596,7 +597,8 @@ ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
 }
 
 static int
-ia64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type,
+ia64_linux_remove_watchpoint (struct target_ops *self,
+			      CORE_ADDR addr, int len, int type,
 			      struct expression *cond)
 {
   int idx;
@@ -676,7 +678,8 @@ ia64_linux_stopped_by_watchpoint (struct target_ops *ops)
 }
 
 static int
-ia64_linux_can_use_hw_breakpoint (int type, int cnt, int othertype)
+ia64_linux_can_use_hw_breakpoint (struct target_ops *self,
+				  int type, int cnt, int othertype)
 {
   return 1;
 }
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index 3db09c9..de36417 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -87,7 +87,7 @@ inf_child_store_inferior_registers (struct target_ops *ops,
 }
 
 static void
-inf_child_post_attach (int pid)
+inf_child_post_attach (struct target_ops *self, int pid)
 {
   /* This version of Unix doesn't require a meaningful "post attach"
      operation by a debugger.  */
@@ -100,7 +100,8 @@ inf_child_post_attach (int pid)
    program being debugged.  */
 
 static void
-inf_child_prepare_to_store (struct regcache *regcache)
+inf_child_prepare_to_store (struct target_ops *self,
+			    struct regcache *regcache)
 {
 }
 
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 34e206b..7f6f8bf 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -246,7 +246,7 @@ inf_ptrace_attach (struct target_ops *ops, char *args, int from_tty)
 #ifdef PT_GET_PROCESS_STATE
 
 static void
-inf_ptrace_post_attach (int pid)
+inf_ptrace_post_attach (struct target_ops *self, int pid)
 {
   ptrace_event_t pe;
 
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index 2193569..4f94438 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -314,7 +314,8 @@ inf_ttrace_disable_page_protections (pid_t pid)
    type TYPE.  */
 
 static int
-inf_ttrace_insert_watchpoint (CORE_ADDR addr, int len, int type,
+inf_ttrace_insert_watchpoint (struct target_ops *self,
+			      CORE_ADDR addr, int len, int type,
 			      struct expression *cond)
 {
   const int pagesize = inf_ttrace_page_dict.pagesize;
@@ -338,7 +339,8 @@ inf_ttrace_insert_watchpoint (CORE_ADDR addr, int len, int type,
    type TYPE.  */
 
 static int
-inf_ttrace_remove_watchpoint (CORE_ADDR addr, int len, int type,
+inf_ttrace_remove_watchpoint (struct target_ops *self,
+			      CORE_ADDR addr, int len, int type,
 			      struct expression *cond)
 {
   const int pagesize = inf_ttrace_page_dict.pagesize;
@@ -359,13 +361,15 @@ inf_ttrace_remove_watchpoint (CORE_ADDR addr, int len, int type,
 }
 
 static int
-inf_ttrace_can_use_hw_breakpoint (int type, int len, int ot)
+inf_ttrace_can_use_hw_breakpoint (struct target_ops *self,
+				  int type, int len, int ot)
 {
   return (type == bp_hardware_watchpoint);
 }
 
 static int
-inf_ttrace_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
+inf_ttrace_region_ok_for_hw_watchpoint (struct target_ops *self,
+					CORE_ADDR addr, int len)
 {
   return 1;
 }
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 6d839e6..8e0f40b 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -335,7 +335,7 @@ linux_init_ptrace (pid_t pid)
 }
 
 static void
-linux_child_post_attach (int pid)
+linux_child_post_attach (struct target_ops *self, int pid)
 {
   linux_init_ptrace (pid);
 }
@@ -4756,14 +4756,14 @@ linux_nat_stop (ptid_t ptid)
 }
 
 static void
-linux_nat_close (void)
+linux_nat_close (struct target_ops *self)
 {
   /* Unregister from the event loop.  */
   if (linux_nat_is_async_p (linux_ops))
     linux_nat_async (linux_ops, NULL, 0);
 
   if (linux_ops->to_close)
-    linux_ops->to_close ();
+    linux_ops->to_close (linux_ops);
 }
 
 /* When requests are passed down from the linux-nat layer to the
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index 2285b4b..dbc710d 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -512,7 +512,8 @@ mips_show_dr (const char *func, CORE_ADDR addr,
    handle the specified watch type.  */
 
 static int
-mips_linux_can_use_hw_breakpoint (int type, int cnt, int ot)
+mips_linux_can_use_hw_breakpoint (struct target_ops *self,
+				  int type, int cnt, int ot)
 {
   int i;
   uint32_t wanted_mask, irw_mask;
@@ -588,7 +589,8 @@ mips_linux_stopped_data_address (struct target_ops *t, CORE_ADDR *paddr)
    the specified region can be covered by the watch registers.  */
 
 static int
-mips_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
+mips_linux_region_ok_for_hw_watchpoint (struct target_ops *self,
+					CORE_ADDR addr, int len)
 {
   struct pt_watch_regs dummy_regs;
   int i;
@@ -644,7 +646,8 @@ mips_linux_new_thread (struct lwp_info *lp)
    watch.  Return zero on success.  */
 
 static int
-mips_linux_insert_watchpoint (CORE_ADDR addr, int len, int type,
+mips_linux_insert_watchpoint (struct target_ops *self,
+			      CORE_ADDR addr, int len, int type,
 			      struct expression *cond)
 {
   struct pt_watch_regs regs;
@@ -697,7 +700,8 @@ mips_linux_insert_watchpoint (CORE_ADDR addr, int len, int type,
    Return zero on success.  */
 
 static int
-mips_linux_remove_watchpoint (CORE_ADDR addr, int len, int type,
+mips_linux_remove_watchpoint (struct target_ops *self,
+			      CORE_ADDR addr, int len, int type,
 			      struct expression *cond)
 {
   int retval;
@@ -744,7 +748,7 @@ mips_linux_remove_watchpoint (CORE_ADDR addr, int len, int type,
    super implementation.  */
 
 static void
-mips_linux_close (void)
+mips_linux_close (struct target_ops *self)
 {
   struct mips_watchpoint *w;
   struct mips_watchpoint *nw;
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 248109a..4292f47 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -853,7 +853,7 @@ monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty)
    control.  */
 
 void
-monitor_close (void)
+monitor_close (struct target_ops *self)
 {
   if (monitor_desc)
     serial_close (monitor_desc);
@@ -1427,7 +1427,7 @@ monitor_store_registers (struct target_ops *ops,
    debugged.  */
 
 static void
-monitor_prepare_to_store (struct regcache *regcache)
+monitor_prepare_to_store (struct target_ops *self, struct regcache *regcache)
 {
   /* Do nothing, since we can store individual regs.  */
 }
diff --git a/gdb/monitor.h b/gdb/monitor.h
index f66d1e7..bb2e5ec 100644
--- a/gdb/monitor.h
+++ b/gdb/monitor.h
@@ -240,7 +240,7 @@ struct monitor_ops
 #define SREC_SIZE 160
 
 extern void monitor_open (char *args, struct monitor_ops *ops, int from_tty);
-extern void monitor_close (void);
+extern void monitor_close (struct target_ops *self);
 extern char *monitor_supply_register (struct regcache *regcache,
 				      int regno, char *valstr);
 extern int monitor_expect (char *prompt, char *buf, int buflen);
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 4e3d2d2..22e8f46 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -67,12 +67,15 @@ static void init_procfs_ops (void);
 
 static ptid_t do_attach (ptid_t ptid);
 
-static int procfs_can_use_hw_breakpoint (int, int, int);
+static int procfs_can_use_hw_breakpoint (struct target_ops *self,
+					 int, int, int);
 
-static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type,
+static int procfs_insert_hw_watchpoint (struct target_ops *self,
+					CORE_ADDR addr, int len, int type,
 					struct expression *cond);
 
-static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type,
+static int procfs_remove_hw_watchpoint (struct target_ops *self,
+					CORE_ADDR addr, int len, int type,
 					struct expression *cond);
 
 static int procfs_stopped_by_watchpoint (struct target_ops *ops);
@@ -648,7 +651,7 @@ procfs_attach (struct target_ops *ops, char *args, int from_tty)
 }
 
 static void
-procfs_post_attach (pid_t pid)
+procfs_post_attach (struct target_ops *self, pid_t pid)
 {
   if (exec_bfd)
     solib_create_inferior_hook (0);
@@ -930,7 +933,7 @@ procfs_insert_breakpoint (struct target_ops *ops,
 }
 
 static int
-procfs_remove_breakpoint (struct target_ops *ops,
+procfs_remove_breakpoint (struct target_ops *self, struct target_ops *ops,
 			  struct gdbarch *gdbarch,
 			  struct bp_target_info *bp_tgt)
 {
@@ -938,7 +941,7 @@ procfs_remove_breakpoint (struct target_ops *ops,
 }
 
 static int
-procfs_insert_hw_breakpoint (struct gdbarch *gdbarch,
+procfs_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
 			     struct bp_target_info *bp_tgt)
 {
   return procfs_breakpoint (bp_tgt->placed_address,
@@ -1231,7 +1234,7 @@ procfs_kill_inferior (struct target_ops *ops)
 /* Store register REGNO, or all registers if REGNO == -1, from the contents
    of REGISTERS.  */
 static void
-procfs_prepare_to_store (struct regcache *regcache)
+procfs_prepare_to_store (struct target_ops *self, struct regcache *regcache)
 {
 }
 
@@ -1490,20 +1493,23 @@ procfs_hw_watchpoint (int addr, int len, int type)
 }
 
 static int
-procfs_can_use_hw_breakpoint (int type, int cnt, int othertype)
+procfs_can_use_hw_breakpoint (struct target_ops *self,
+			      int type, int cnt, int othertype)
 {
   return 1;
 }
 
 static int
-procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type,
+procfs_remove_hw_watchpoint (struct target_ops *self,
+			     CORE_ADDR addr, int len, int type,
 			     struct expression *cond)
 {
   return procfs_hw_watchpoint (addr, -1, type);
 }
 
 static int
-procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type,
+procfs_insert_hw_watchpoint (struct target_ops *self,
+			     CORE_ADDR addr, int len, int type,
 			     struct expression *cond)
 {
   return procfs_hw_watchpoint (addr, len, type);
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 82ed2c6..434a404 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1444,7 +1444,8 @@ have_ptrace_hwdebug_interface (void)
 }
 
 static int
-ppc_linux_can_use_hw_breakpoint (int type, int cnt, int ot)
+ppc_linux_can_use_hw_breakpoint (struct target_ops *self,
+				 int type, int cnt, int ot)
 {
   int total_hw_wp, total_hw_bp;
 
@@ -1496,7 +1497,8 @@ ppc_linux_can_use_hw_breakpoint (int type, int cnt, int ot)
 }
 
 static int
-ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
+ppc_linux_region_ok_for_hw_watchpoint (struct target_ops *self,
+				       CORE_ADDR addr, int len)
 {
   /* Handle sub-8-byte quantities.  */
   if (len <= 0)
@@ -1672,7 +1674,8 @@ ppc_linux_ranged_break_num_registers (struct target_ops *target)
    success, 1 if hardware breakpoints are not supported or -1 for failure.  */
 
 static int
-ppc_linux_insert_hw_breakpoint (struct gdbarch *gdbarch,
+ppc_linux_insert_hw_breakpoint (struct target_ops *self,
+				struct gdbarch *gdbarch,
 				  struct bp_target_info *bp_tgt)
 {
   struct lwp_info *lp;
@@ -1708,7 +1711,8 @@ ppc_linux_insert_hw_breakpoint (struct gdbarch *gdbarch,
 }
 
 static int
-ppc_linux_remove_hw_breakpoint (struct gdbarch *gdbarch,
+ppc_linux_remove_hw_breakpoint (struct target_ops *self,
+				struct gdbarch *gdbarch,
 				  struct bp_target_info *bp_tgt)
 {
   struct lwp_info *lp;
@@ -2011,7 +2015,8 @@ check_condition (CORE_ADDR watch_addr, struct expression *cond,
    the condition expression, thus only triggering the watchpoint when it is
    true.  */
 static int
-ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw,
+ppc_linux_can_accel_watchpoint_condition (struct target_ops *self,
+					  CORE_ADDR addr, int len, int rw,
 					  struct expression *cond)
 {
   CORE_ADDR data_value;
@@ -2073,7 +2078,8 @@ create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr,
 }
 
 static int
-ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
+ppc_linux_insert_watchpoint (struct target_ops *self,
+			     CORE_ADDR addr, int len, int rw,
 			     struct expression *cond)
 {
   struct lwp_info *lp;
@@ -2141,7 +2147,8 @@ ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
 }
 
 static int
-ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
+ppc_linux_remove_watchpoint (struct target_ops *self,
+			     CORE_ADDR addr, int len, int rw,
 			     struct expression *cond)
 {
   struct lwp_info *lp;
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 40a5dd5..448ce04 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -145,7 +145,8 @@ static int proc_find_memory_regions (find_memory_region_ftype, void *);
 
 static char * procfs_make_note_section (bfd *, int *);
 
-static int procfs_can_use_hw_breakpoint (int, int, int);
+static int procfs_can_use_hw_breakpoint (struct target_ops *self,
+					 int, int, int);
 
 static void procfs_info_proc (struct target_ops *, char *,
 			      enum info_proc_what);
@@ -4837,7 +4838,8 @@ procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag,
    target_can_use_hardware_watchpoint.  */
 
 static int
-procfs_can_use_hw_breakpoint (int type, int cnt, int othertype)
+procfs_can_use_hw_breakpoint (struct target_ops *self,
+			      int type, int cnt, int othertype)
 {
   /* Due to the way that proc_set_watchpoint() is implemented, host
      and target pointers must be of the same size.  If they are not,
@@ -4900,7 +4902,8 @@ procfs_stopped_data_address (struct target_ops *targ, CORE_ADDR *addr)
 }
 
 static int
-procfs_insert_watchpoint (CORE_ADDR addr, int len, int type,
+procfs_insert_watchpoint (struct target_ops *self,
+			  CORE_ADDR addr, int len, int type,
 			  struct expression *cond)
 {
   if (!target_have_steppable_watchpoint
@@ -4922,14 +4925,16 @@ procfs_insert_watchpoint (CORE_ADDR addr, int len, int type,
 }
 
 static int
-procfs_remove_watchpoint (CORE_ADDR addr, int len, int type,
+procfs_remove_watchpoint (struct target_ops *self,
+			  CORE_ADDR addr, int len, int type,
 			  struct expression *cond)
 {
   return procfs_set_watchpoint (inferior_ptid, addr, 0, 0, 0);
 }
 
 static int
-procfs_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
+procfs_region_ok_for_hw_watchpoint (struct target_ops *self,
+				    CORE_ADDR addr, int len)
 {
   /* The man page for proc(4) on Solaris 2.6 and up says that the
      system can support "thousands" of hardware watchpoints, but gives
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 9ef265d..0d60277 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -62,7 +62,8 @@ static void ravenscar_fetch_registers (struct target_ops *ops,
                                        struct regcache *regcache, int regnum);
 static void ravenscar_store_registers (struct target_ops *ops,
                                        struct regcache *regcache, int regnum);
-static void ravenscar_prepare_to_store (struct regcache *regcache);
+static void ravenscar_prepare_to_store (struct target_ops *self,
+					struct regcache *regcache);
 static void ravenscar_resume (struct target_ops *ops, ptid_t ptid, int step,
 			      enum gdb_signal siggnal);
 static void ravenscar_mourn_inferior (struct target_ops *ops);
@@ -303,14 +304,15 @@ ravenscar_store_registers (struct target_ops *ops,
 }
 
 static void
-ravenscar_prepare_to_store (struct regcache *regcache)
+ravenscar_prepare_to_store (struct target_ops *self,
+			    struct regcache *regcache)
 {
   struct target_ops *beneath = find_target_beneath (&ravenscar_ops);
 
   if (!ravenscar_runtime_initialized ()
       || ptid_equal (inferior_ptid, base_magic_null_ptid)
       || ptid_equal (inferior_ptid, ravenscar_running_thread ()))
-    beneath->to_prepare_to_store (regcache);
+    beneath->to_prepare_to_store (beneath, regcache);
   else
     {
       struct gdbarch *gdbarch = get_regcache_arch (regcache);
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 68f40c8..d1f36c9 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -190,7 +190,7 @@ record_btrace_stop_recording (void)
 /* The to_close method of target record-btrace.  */
 
 static void
-record_btrace_close (void)
+record_btrace_close (struct target_ops *self)
 {
   /* Make sure automatic recording gets disabled even if we did not stop
      recording before closing the record-btrace target.  */
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 1d66c6e..9e8ac1e 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -867,7 +867,7 @@ record_full_open (char *name, int from_tty)
 /* "to_close" target method.  Close the process record target.  */
 
 static void
-record_full_close (void)
+record_full_close (struct target_ops *self)
 {
   struct record_full_core_buf_entry *entry;
 
@@ -1969,7 +1969,8 @@ record_full_core_fetch_registers (struct target_ops *ops,
 /* "to_prepare_to_store" method for prec over corefile.  */
 
 static void
-record_full_core_prepare_to_store (struct regcache *regcache)
+record_full_core_prepare_to_store (struct target_ops *self,
+				   struct regcache *regcache)
 {
 }
 
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index a127b8a..58b19f2 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -430,7 +430,7 @@ m32r_open (char *args, int from_tty)
 /* Close out all files and local state before this target loses control.  */
 
 static void
-m32r_close (void)
+m32r_close (struct target_ops *self)
 {
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "m32r_close()\n");
@@ -1013,7 +1013,7 @@ m32r_store_register (struct target_ops *ops,
    debugged.  */
 
 static void
-m32r_prepare_to_store (struct regcache *regcache)
+m32r_prepare_to_store (struct target_ops *self, struct regcache *regcache)
 {
   /* Do nothing, since we can store individual regs.  */
   if (remote_debug)
@@ -1408,7 +1408,8 @@ m32r_stop (ptid_t ptid)
    implements the target_can_use_hardware_watchpoint macro.  */
 
 static int
-m32r_can_use_hw_watchpoint (int type, int cnt, int othertype)
+m32r_can_use_hw_watchpoint (struct target_ops *self,
+			    int type, int cnt, int othertype)
 {
   return sdi_desc != NULL && cnt < max_access_breaks;
 }
@@ -1418,7 +1419,8 @@ m32r_can_use_hw_watchpoint (int type, int cnt, int othertype)
    watchpoint.  */
 
 static int
-m32r_insert_watchpoint (CORE_ADDR addr, int len, int type,
+m32r_insert_watchpoint (struct target_ops *self,
+			CORE_ADDR addr, int len, int type,
 			struct expression *cond)
 {
   int i;
@@ -1443,7 +1445,8 @@ m32r_insert_watchpoint (CORE_ADDR addr, int len, int type,
 }
 
 static int
-m32r_remove_watchpoint (CORE_ADDR addr, int len, int type,
+m32r_remove_watchpoint (struct target_ops *self,
+			CORE_ADDR addr, int len, int type,
 			struct expression *cond)
 {
   int i;
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 44d127a..5c0b8a3 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -84,13 +84,14 @@ static void ddb_open (char *name, int from_tty);
 
 static void lsi_open (char *name, int from_tty);
 
-static void mips_close (void);
+static void mips_close (struct target_ops *self);
 
 static int mips_map_regno (struct gdbarch *, int);
 
 static void mips_set_register (int regno, ULONGEST value);
 
-static void mips_prepare_to_store (struct regcache *regcache);
+static void mips_prepare_to_store (struct target_ops *self,
+				   struct regcache *regcache);
 
 static int mips_fetch_word (CORE_ADDR addr, unsigned int *valp);
 
@@ -1731,7 +1732,7 @@ lsi_open (char *name, int from_tty)
 /* Close a connection to the remote board.  */
 
 static void
-mips_close (void)
+mips_close (struct target_ops *self)
 {
   if (mips_is_open)
     {
@@ -2064,7 +2065,7 @@ mips_fetch_registers (struct target_ops *ops,
    registers, so this function doesn't have to do anything.  */
 
 static void
-mips_prepare_to_store (struct regcache *regcache)
+mips_prepare_to_store (struct target_ops *self, struct regcache *regcache)
 {
 }
 
@@ -2392,7 +2393,8 @@ mips_remove_breakpoint (struct target_ops *ops,
    implements the target_can_use_hardware_watchpoint macro.  */
 
 static int
-mips_can_use_watchpoint (int type, int cnt, int othertype)
+mips_can_use_watchpoint (struct target_ops *self,
+			 int type, int cnt, int othertype)
 {
   return cnt < MAX_LSI_BREAKPOINTS && strcmp (target_shortname, "lsi") == 0;
 }
@@ -2426,7 +2428,8 @@ calculate_mask (CORE_ADDR addr, int len)
    watchpoint.  */
 
 static int
-mips_insert_watchpoint (CORE_ADDR addr, int len, int type,
+mips_insert_watchpoint (struct target_ops *self,
+			CORE_ADDR addr, int len, int type,
 			struct expression *cond)
 {
   if (mips_set_breakpoint (addr, len, type))
@@ -2438,7 +2441,8 @@ mips_insert_watchpoint (CORE_ADDR addr, int len, int type,
 /* Remove a watchpoint.  */
 
 static int
-mips_remove_watchpoint (CORE_ADDR addr, int len, int type,
+mips_remove_watchpoint (struct target_ops *self,
+			CORE_ADDR addr, int len, int type,
 			struct expression *cond)
 {
   if (mips_clear_breakpoint (addr, len, type))
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index c0596b3..9f1e5eb 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -76,12 +76,13 @@ static void gdbsim_load (char *prog, int fromtty);
 
 static void gdbsim_open (char *args, int from_tty);
 
-static void gdbsim_close (void);
+static void gdbsim_close (struct target_ops *self);
 
 static void gdbsim_detach (struct target_ops *ops, const char *args,
 			   int from_tty);
 
-static void gdbsim_prepare_to_store (struct regcache *regcache);
+static void gdbsim_prepare_to_store (struct target_ops *self,
+				     struct regcache *regcache);
 
 static void gdbsim_files_info (struct target_ops *target);
 
@@ -787,7 +788,7 @@ gdbsim_close_inferior (struct inferior *inf, void *arg)
 /* Close out all files and local state before this target loses control.  */
 
 static void
-gdbsim_close (void)
+gdbsim_close (struct target_ops *self)
 {
   struct sim_inferior_data *sim_data
     = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
@@ -1052,7 +1053,7 @@ gdbsim_wait (struct target_ops *ops,
    debugged.  */
 
 static void
-gdbsim_prepare_to_store (struct regcache *regcache)
+gdbsim_prepare_to_store (struct target_ops *self, struct regcache *regcache)
 {
   /* Do nothing, since we can store individual regs.  */
 }
diff --git a/gdb/remote.c b/gdb/remote.c
index 3ecab65..d23502c 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -98,7 +98,8 @@ static void async_handle_remote_sigint_twice (int);
 
 static void remote_files_info (struct target_ops *ignore);
 
-static void remote_prepare_to_store (struct regcache *regcache);
+static void remote_prepare_to_store (struct target_ops *self,
+				     struct regcache *regcache);
 
 static void remote_open (char *name, int from_tty);
 
@@ -106,7 +107,7 @@ static void extended_remote_open (char *name, int from_tty);
 
 static void remote_open_1 (char *, int, struct target_ops *, int extended_p);
 
-static void remote_close (void);
+static void remote_close (struct target_ops *self);
 
 static void remote_mourn (struct target_ops *ops);
 
@@ -3046,7 +3047,7 @@ extended_remote_restart (void)
 /* Clean up connection to a remote debugger.  */
 
 static void
-remote_close (void)
+remote_close (struct target_ops *self)
 {
   struct remote_state *rs = get_remote_state ();
 
@@ -6415,7 +6416,7 @@ remote_fetch_registers (struct target_ops *ops,
    first.  */
 
 static void
-remote_prepare_to_store (struct regcache *regcache)
+remote_prepare_to_store (struct target_ops *self, struct regcache *regcache)
 {
   struct remote_arch_state *rsa = get_remote_arch_state ();
   int i;
@@ -8315,7 +8316,8 @@ watchpoint_to_Z_packet (int type)
 }
 
 static int
-remote_insert_watchpoint (CORE_ADDR addr, int len, int type,
+remote_insert_watchpoint (struct target_ops *self,
+			  CORE_ADDR addr, int len, int type,
 			  struct expression *cond)
 {
   struct remote_state *rs = get_remote_state ();
@@ -8364,7 +8366,8 @@ remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr,
 
 
 static int
-remote_remove_watchpoint (CORE_ADDR addr, int len, int type,
+remote_remove_watchpoint (struct target_ops *self,
+			  CORE_ADDR addr, int len, int type,
 			  struct expression *cond)
 {
   struct remote_state *rs = get_remote_state ();
@@ -8406,7 +8409,8 @@ int remote_hw_watchpoint_length_limit = -1;
 int remote_hw_breakpoint_limit = -1;
 
 static int
-remote_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
+remote_region_ok_for_hw_watchpoint (struct target_ops *self,
+				    CORE_ADDR addr, int len)
 {
   if (remote_hw_watchpoint_length_limit == 0)
     return 0;
@@ -8419,7 +8423,8 @@ remote_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
 }
 
 static int
-remote_check_watch_resources (int type, int cnt, int ot)
+remote_check_watch_resources (struct target_ops *self,
+			      int type, int cnt, int ot)
 {
   if (type == bp_hardware_breakpoint)
     {
@@ -8469,7 +8474,7 @@ remote_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
 
 
 static int
-remote_insert_hw_breakpoint (struct gdbarch *gdbarch,
+remote_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
 			     struct bp_target_info *bp_tgt)
 {
   CORE_ADDR addr;
@@ -8533,7 +8538,7 @@ remote_insert_hw_breakpoint (struct gdbarch *gdbarch,
 
 
 static int
-remote_remove_hw_breakpoint (struct gdbarch *gdbarch,
+remote_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
 			     struct bp_target_info *bp_tgt)
 {
   CORE_ADDR addr;
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index 5fb342f..fec2455 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -508,7 +508,8 @@ s390_fix_watch_points (struct lwp_info *lp)
 }
 
 static int
-s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
+s390_insert_watchpoint (struct target_ops *self,
+			CORE_ADDR addr, int len, int type,
 			struct expression *cond)
 {
   struct lwp_info *lp;
@@ -529,7 +530,8 @@ s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
 }
 
 static int
-s390_remove_watchpoint (CORE_ADDR addr, int len, int type,
+s390_remove_watchpoint (struct target_ops *self,
+			CORE_ADDR addr, int len, int type,
 			struct expression *cond)
 {
   struct lwp_info *lp;
@@ -557,13 +559,15 @@ s390_remove_watchpoint (CORE_ADDR addr, int len, int type,
 }
 
 static int
-s390_can_use_hw_breakpoint (int type, int cnt, int othertype)
+s390_can_use_hw_breakpoint (struct target_ops *self,
+			    int type, int cnt, int othertype)
 {
   return type == bp_hardware_watchpoint;
 }
 
 static int
-s390_region_ok_for_hw_watchpoint (CORE_ADDR addr, int cnt)
+s390_region_ok_for_hw_watchpoint (struct target_ops *self,
+				  CORE_ADDR addr, int cnt)
 {
   return 1;
 }
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index 22ed483..daa2bc4 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -408,7 +408,7 @@ spu_child_post_startup_inferior (ptid_t ptid)
 /* Override the post_attach routine to try load the SPE executable
    file image from its copy inside the target process.  */
 static void
-spu_child_post_attach (int pid)
+spu_child_post_attach (struct target_ops *self, int pid)
 {
   int fd;
   ULONGEST addr;
@@ -605,7 +605,8 @@ spu_xfer_partial (struct target_ops *ops,
 
 /* Override the to_can_use_hw_breakpoint routine.  */
 static int
-spu_can_use_hw_breakpoint (int type, int cnt, int othertype)
+spu_can_use_hw_breakpoint (struct target_ops *self,
+			   int type, int cnt, int othertype)
 {
   return 0;
 }
diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c
index f584a9a..dbe7628 100644
--- a/gdb/spu-multiarch.c
+++ b/gdb/spu-multiarch.c
@@ -118,7 +118,8 @@ spu_thread_architecture (struct target_ops *ops, ptid_t ptid)
 
 /* Override the to_region_ok_for_hw_watchpoint routine.  */
 static int
-spu_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
+spu_region_ok_for_hw_watchpoint (struct target_ops *self,
+				 CORE_ADDR addr, int len)
 {
   struct target_ops *ops_beneath = find_target_beneath (&spu_ops);
   while (ops_beneath && !ops_beneath->to_region_ok_for_hw_watchpoint)
@@ -129,7 +130,8 @@ spu_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
     return 0;
 
   if (ops_beneath)
-    return ops_beneath->to_region_ok_for_hw_watchpoint (addr, len);
+    return ops_beneath->to_region_ok_for_hw_watchpoint (ops_beneath,
+							addr, len);
 
   return 0;
 }
diff --git a/gdb/target.c b/gdb/target.c
index 6fc95fc..411dbdf 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -52,7 +52,8 @@ static void default_terminal_info (const char *, int);
 static int default_watchpoint_addr_within_range (struct target_ops *,
 						 CORE_ADDR, CORE_ADDR, int);
 
-static int default_region_ok_for_hw_watchpoint (CORE_ADDR, int);
+static int default_region_ok_for_hw_watchpoint (struct target_ops *,
+						CORE_ADDR, int);
 
 static void tcomplain (void) ATTRIBUTE_NORETURN;
 
@@ -91,22 +92,28 @@ static struct target_ops debug_target;
 
 static void debug_to_open (char *, int);
 
-static void debug_to_prepare_to_store (struct regcache *);
+static void debug_to_prepare_to_store (struct target_ops *self,
+				       struct regcache *);
 
 static void debug_to_files_info (struct target_ops *);
 
-static int debug_to_can_use_hw_breakpoint (int, int, int);
+static int debug_to_can_use_hw_breakpoint (struct target_ops *self,
+					   int, int, int);
 
-static int debug_to_insert_hw_breakpoint (struct gdbarch *,
+static int debug_to_insert_hw_breakpoint (struct target_ops *self,
+					  struct gdbarch *,
 					  struct bp_target_info *);
 
-static int debug_to_remove_hw_breakpoint (struct gdbarch *,
+static int debug_to_remove_hw_breakpoint (struct target_ops *self,
+					  struct gdbarch *,
 					  struct bp_target_info *);
 
-static int debug_to_insert_watchpoint (CORE_ADDR, int, int,
+static int debug_to_insert_watchpoint (struct target_ops *self,
+				       CORE_ADDR, int, int,
 				       struct expression *);
 
-static int debug_to_remove_watchpoint (CORE_ADDR, int, int,
+static int debug_to_remove_watchpoint (struct target_ops *self,
+				       CORE_ADDR, int, int,
 				       struct expression *);
 
 static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *);
@@ -114,9 +121,11 @@ static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *);
 static int debug_to_watchpoint_addr_within_range (struct target_ops *,
 						  CORE_ADDR, CORE_ADDR, int);
 
-static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, int);
+static int debug_to_region_ok_for_hw_watchpoint (struct target_ops *self,
+						 CORE_ADDR, int);
 
-static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, int, int,
+static int debug_to_can_accel_watchpoint_condition (struct target_ops *self,
+						    CORE_ADDR, int, int,
 						    struct expression *);
 
 static void debug_to_terminal_init (void);
@@ -713,13 +722,13 @@ update_current_target (void)
 	    (void (*) (char *, int))
 	    tcomplain);
   de_fault (to_close,
-	    (void (*) (void))
+	    (void (*) (struct target_ops *))
 	    target_ignore);
   de_fault (to_post_attach,
-	    (void (*) (int))
+	    (void (*) (struct target_ops *, int))
 	    target_ignore);
   de_fault (to_prepare_to_store,
-	    (void (*) (struct regcache *))
+	    (void (*) (struct target_ops *, struct regcache *))
 	    noprocess);
   de_fault (deprecated_xfer_memory,
 	    (int (*) (CORE_ADDR, gdb_byte *, int, int,
@@ -729,26 +738,31 @@ update_current_target (void)
 	    (void (*) (struct target_ops *))
 	    target_ignore);
   de_fault (to_can_use_hw_breakpoint,
-	    (int (*) (int, int, int))
+	    (int (*) (struct target_ops *, int, int, int))
 	    return_zero);
   de_fault (to_insert_hw_breakpoint,
-	    (int (*) (struct gdbarch *, struct bp_target_info *))
+	    (int (*) (struct target_ops *, struct gdbarch *,
+		      struct bp_target_info *))
 	    return_minus_one);
   de_fault (to_remove_hw_breakpoint,
-	    (int (*) (struct gdbarch *, struct bp_target_info *))
+	    (int (*) (struct target_ops *, struct gdbarch *,
+		      struct bp_target_info *))
 	    return_minus_one);
   de_fault (to_insert_watchpoint,
-	    (int (*) (CORE_ADDR, int, int, struct expression *))
+	    (int (*) (struct target_ops *, CORE_ADDR, int, int,
+		      struct expression *))
 	    return_minus_one);
   de_fault (to_remove_watchpoint,
-	    (int (*) (CORE_ADDR, int, int, struct expression *))
+	    (int (*) (struct target_ops *, CORE_ADDR, int, int,
+		      struct expression *))
 	    return_minus_one);
   de_fault (to_watchpoint_addr_within_range,
 	    default_watchpoint_addr_within_range);
   de_fault (to_region_ok_for_hw_watchpoint,
 	    default_region_ok_for_hw_watchpoint);
   de_fault (to_can_accel_watchpoint_condition,
-            (int (*) (CORE_ADDR, int, int, struct expression *))
+            (int (*) (struct target_ops *, CORE_ADDR, int, int,
+		      struct expression *))
             return_zero);
   de_fault (to_terminal_init,
 	    (void (*) (void))
@@ -3558,7 +3572,8 @@ target_fileio_read_stralloc (const char *filename)
 
 
 static int
-default_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
+default_region_ok_for_hw_watchpoint (struct target_ops *self,
+				     CORE_ADDR addr, int len)
 {
   return (len <= gdbarch_ptr_bit (target_gdbarch ()) / TARGET_CHAR_BIT);
 }
@@ -3753,7 +3768,7 @@ target_close (struct target_ops *targ)
   if (targ->to_xclose != NULL)
     targ->to_xclose (targ);
   else if (targ->to_close != NULL)
-    targ->to_close ();
+    targ->to_close (targ);
 
   if (targetdebug)
     fprintf_unfiltered (gdb_stdlog, "target_close ()\n");
@@ -3834,9 +3849,9 @@ target_stop (ptid_t ptid)
 }
 
 static void
-debug_to_post_attach (int pid)
+debug_to_post_attach (struct target_ops *self, int pid)
 {
-  debug_target.to_post_attach (pid);
+  debug_target.to_post_attach (&debug_target, pid);
 
   fprintf_unfiltered (gdb_stdlog, "target_post_attach (%d)\n", pid);
 }
@@ -4403,9 +4418,9 @@ target_call_history_range (ULONGEST begin, ULONGEST end, int flags)
 }
 
 static void
-debug_to_prepare_to_store (struct regcache *regcache)
+debug_to_prepare_to_store (struct target_ops *self, struct regcache *regcache)
 {
-  debug_target.to_prepare_to_store (regcache);
+  debug_target.to_prepare_to_store (&debug_target, regcache);
 
   fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
 }
@@ -4492,11 +4507,13 @@ debug_to_remove_breakpoint (struct target_ops *ops,
 }
 
 static int
-debug_to_can_use_hw_breakpoint (int type, int cnt, int from_tty)
+debug_to_can_use_hw_breakpoint (struct target_ops *self,
+				int type, int cnt, int from_tty)
 {
   int retval;
 
-  retval = debug_target.to_can_use_hw_breakpoint (type, cnt, from_tty);
+  retval = debug_target.to_can_use_hw_breakpoint (&debug_target,
+						  type, cnt, from_tty);
 
   fprintf_unfiltered (gdb_stdlog,
 		      "target_can_use_hw_breakpoint (%ld, %ld, %ld) = %ld\n",
@@ -4508,11 +4525,13 @@ debug_to_can_use_hw_breakpoint (int type, int cnt, int from_tty)
 }
 
 static int
-debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
+debug_to_region_ok_for_hw_watchpoint (struct target_ops *self,
+				      CORE_ADDR addr, int len)
 {
   CORE_ADDR retval;
 
-  retval = debug_target.to_region_ok_for_hw_watchpoint (addr, len);
+  retval = debug_target.to_region_ok_for_hw_watchpoint (&debug_target,
+							addr, len);
 
   fprintf_unfiltered (gdb_stdlog,
 		      "target_region_ok_for_hw_watchpoint (%s, %ld) = %s\n",
@@ -4522,12 +4541,14 @@ debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
 }
 
 static int
-debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw,
+debug_to_can_accel_watchpoint_condition (struct target_ops *self,
+					 CORE_ADDR addr, int len, int rw,
 					 struct expression *cond)
 {
   int retval;
 
-  retval = debug_target.to_can_accel_watchpoint_condition (addr, len,
+  retval = debug_target.to_can_accel_watchpoint_condition (&debug_target,
+							   addr, len,
 							   rw, cond);
 
   fprintf_unfiltered (gdb_stdlog,
@@ -4583,12 +4604,14 @@ debug_to_watchpoint_addr_within_range (struct target_ops *target,
 }
 
 static int
-debug_to_insert_hw_breakpoint (struct gdbarch *gdbarch,
+debug_to_insert_hw_breakpoint (struct target_ops *self,
+			       struct gdbarch *gdbarch,
 			       struct bp_target_info *bp_tgt)
 {
   int retval;
 
-  retval = debug_target.to_insert_hw_breakpoint (gdbarch, bp_tgt);
+  retval = debug_target.to_insert_hw_breakpoint (&debug_target,
+						 gdbarch, bp_tgt);
 
   fprintf_unfiltered (gdb_stdlog,
 		      "target_insert_hw_breakpoint (%s, xxx) = %ld\n",
@@ -4598,12 +4621,14 @@ debug_to_insert_hw_breakpoint (struct gdbarch *gdbarch,
 }
 
 static int
-debug_to_remove_hw_breakpoint (struct gdbarch *gdbarch,
+debug_to_remove_hw_breakpoint (struct target_ops *self,
+			       struct gdbarch *gdbarch,
 			       struct bp_target_info *bp_tgt)
 {
   int retval;
 
-  retval = debug_target.to_remove_hw_breakpoint (gdbarch, bp_tgt);
+  retval = debug_target.to_remove_hw_breakpoint (&debug_target,
+						 gdbarch, bp_tgt);
 
   fprintf_unfiltered (gdb_stdlog,
 		      "target_remove_hw_breakpoint (%s, xxx) = %ld\n",
@@ -4613,12 +4638,14 @@ debug_to_remove_hw_breakpoint (struct gdbarch *gdbarch,
 }
 
 static int
-debug_to_insert_watchpoint (CORE_ADDR addr, int len, int type,
+debug_to_insert_watchpoint (struct target_ops *self,
+			    CORE_ADDR addr, int len, int type,
 			    struct expression *cond)
 {
   int retval;
 
-  retval = debug_target.to_insert_watchpoint (addr, len, type, cond);
+  retval = debug_target.to_insert_watchpoint (&debug_target,
+					      addr, len, type, cond);
 
   fprintf_unfiltered (gdb_stdlog,
 		      "target_insert_watchpoint (%s, %d, %d, %s) = %ld\n",
@@ -4628,12 +4655,14 @@ debug_to_insert_watchpoint (CORE_ADDR addr, int len, int type,
 }
 
 static int
-debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type,
+debug_to_remove_watchpoint (struct target_ops *self,
+			    CORE_ADDR addr, int len, int type,
 			    struct expression *cond)
 {
   int retval;
 
-  retval = debug_target.to_remove_watchpoint (addr, len, type, cond);
+  retval = debug_target.to_remove_watchpoint (&debug_target,
+					      addr, len, type, cond);
 
   fprintf_unfiltered (gdb_stdlog,
 		      "target_remove_watchpoint (%s, %d, %d, %s) = %ld\n",
diff --git a/gdb/target.h b/gdb/target.h
index d1fa12f..4fa3918 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -388,9 +388,9 @@ struct target_ops
        New re-entrant targets provide "to_xclose" and that is expected
        to xfree everything (including the "struct target_ops").  */
     void (*to_xclose) (struct target_ops *targ);
-    void (*to_close) (void);
+    void (*to_close) (struct target_ops *);
     void (*to_attach) (struct target_ops *ops, char *, int);
-    void (*to_post_attach) (int);
+    void (*to_post_attach) (struct target_ops *, int);
     void (*to_detach) (struct target_ops *ops, const char *, int);
     void (*to_disconnect) (struct target_ops *, char *, int);
     void (*to_resume) (struct target_ops *, ptid_t, int, enum gdb_signal)
@@ -401,7 +401,7 @@ struct target_ops
     void (*to_fetch_registers) (struct target_ops *, struct regcache *, int);
     void (*to_store_registers) (struct target_ops *, struct regcache *, int)
       TARGET_DEFAULT_NORETURN (noprocess ());
-    void (*to_prepare_to_store) (struct regcache *);
+    void (*to_prepare_to_store) (struct target_ops *, struct regcache *);
 
     /* Transfer LEN bytes of memory between GDB address MYADDR and
        target address MEMADDR.  If WRITE, transfer them to the target, else
@@ -436,15 +436,19 @@ struct target_ops
     int (*to_remove_breakpoint) (struct target_ops *, struct gdbarch *,
 				 struct bp_target_info *)
       TARGET_DEFAULT_FUNC (memory_remove_breakpoint);
-    int (*to_can_use_hw_breakpoint) (int, int, int);
+    int (*to_can_use_hw_breakpoint) (struct target_ops *, int, int, int);
     int (*to_ranged_break_num_registers) (struct target_ops *);
-    int (*to_insert_hw_breakpoint) (struct gdbarch *, struct bp_target_info *);
-    int (*to_remove_hw_breakpoint) (struct gdbarch *, struct bp_target_info *);
+    int (*to_insert_hw_breakpoint) (struct target_ops *,
+				    struct gdbarch *, struct bp_target_info *);
+    int (*to_remove_hw_breakpoint) (struct target_ops *,
+				    struct gdbarch *, struct bp_target_info *);
 
     /* Documentation of what the two routines below are expected to do is
        provided with the corresponding target_* macros.  */
-    int (*to_remove_watchpoint) (CORE_ADDR, int, int, struct expression *);
-    int (*to_insert_watchpoint) (CORE_ADDR, int, int, struct expression *);
+    int (*to_remove_watchpoint) (struct target_ops *,
+				 CORE_ADDR, int, int, struct expression *);
+    int (*to_insert_watchpoint) (struct target_ops *,
+				 CORE_ADDR, int, int, struct expression *);
 
     int (*to_insert_mask_watchpoint) (struct target_ops *,
 				      CORE_ADDR, CORE_ADDR, int);
@@ -461,9 +465,11 @@ struct target_ops
 
     /* Documentation of this routine is provided with the corresponding
        target_* macro.  */
-    int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, int);
+    int (*to_region_ok_for_hw_watchpoint) (struct target_ops *,
+					   CORE_ADDR, int);
 
-    int (*to_can_accel_watchpoint_condition) (CORE_ADDR, int, int,
+    int (*to_can_accel_watchpoint_condition) (struct target_ops *,
+					      CORE_ADDR, int, int,
 					      struct expression *);
     int (*to_masked_watch_num_registers) (struct target_ops *,
 					  CORE_ADDR, CORE_ADDR);
@@ -986,7 +992,7 @@ void target_attach (char *, int);
    This operation provides a target-specific hook that allows the
    necessary bookkeeping to be performed after an attach completes.  */
 #define target_post_attach(pid) \
-     (*current_target.to_post_attach) (pid)
+     (*current_target.to_post_attach) (&current_target, pid)
 
 /* Takes a program previously attached to and detaches it.
    The program may resume execution (some targets do, some don't) and will
@@ -1044,7 +1050,7 @@ extern void target_store_registers (struct regcache *regcache, int regs);
    debugged.  */
 
 #define	target_prepare_to_store(regcache)	\
-     (*current_target.to_prepare_to_store) (regcache)
+     (*current_target.to_prepare_to_store) (&current_target, regcache)
 
 /* Determine current address space of thread PTID.  */
 
@@ -1560,13 +1566,15 @@ extern char *target_thread_name (struct thread_info *);
    (including this one?).  OTHERTYPE is who knows what...  */
 
 #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
- (*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE);
+ (*current_target.to_can_use_hw_breakpoint) (&current_target,  \
+					     TYPE, CNT, OTHERTYPE);
 
 /* Returns the number of debug registers needed to watch the given
    memory region, or zero if not supported.  */
 
 #define target_region_ok_for_hw_watchpoint(addr, len) \
-    (*current_target.to_region_ok_for_hw_watchpoint) (addr, len)
+    (*current_target.to_region_ok_for_hw_watchpoint) (&current_target,	\
+						      addr, len)
 
 
 /* Set/clear a hardware watchpoint starting at ADDR, for LEN bytes.
@@ -1576,10 +1584,12 @@ extern char *target_thread_name (struct thread_info *);
    -1 for failure.  */
 
 #define	target_insert_watchpoint(addr, len, type, cond) \
-     (*current_target.to_insert_watchpoint) (addr, len, type, cond)
+     (*current_target.to_insert_watchpoint) (&current_target,	\
+					     addr, len, type, cond)
 
 #define	target_remove_watchpoint(addr, len, type, cond) \
-     (*current_target.to_remove_watchpoint) (addr, len, type, cond)
+     (*current_target.to_remove_watchpoint) (&current_target,	\
+					     addr, len, type, cond)
 
 /* Insert a new masked watchpoint at ADDR using the mask MASK.
    RW may be hw_read for a read watchpoint, hw_write for a write watchpoint
@@ -1596,10 +1606,12 @@ extern int target_insert_mask_watchpoint (CORE_ADDR, CORE_ADDR, int);
 extern int target_remove_mask_watchpoint (CORE_ADDR, CORE_ADDR, int);
 
 #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \
-     (*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt)
+     (*current_target.to_insert_hw_breakpoint) (&current_target,	\
+						gdbarch, bp_tgt)
 
 #define target_remove_hw_breakpoint(gdbarch, bp_tgt) \
-     (*current_target.to_remove_hw_breakpoint) (gdbarch, bp_tgt)
+     (*current_target.to_remove_hw_breakpoint) (&current_target,	\
+						gdbarch, bp_tgt)
 
 /* Return number of debug registers needed for a ranged breakpoint,
    or -1 if ranged breakpoints are not supported.  */
@@ -1628,7 +1640,8 @@ extern int target_ranged_break_num_registers (void);
    For this reason, GDB will still evaluate the condition expression when
    the watchpoint triggers.  */
 #define target_can_accel_watchpoint_condition(addr, len, type, cond) \
-  (*current_target.to_can_accel_watchpoint_condition) (addr, len, type, cond)
+  (*current_target.to_can_accel_watchpoint_condition) (&current_target,	\
+						       addr, len, type, cond)
 
 /* Return number of debug registers needed for a masked watchpoint,
    -1 if masked watchpoints are not supported or -2 if the given address
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index f30282b..a09bf37 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -4749,7 +4749,7 @@ parse_tsv_definition (char *line, struct uploaded_tsv **utsvp)
 /* Close the trace file and generally clean up.  */
 
 static void
-tfile_close (void)
+tfile_close (struct target_ops *self)
 {
   int pid;
 
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index f0545fc..3942f6f 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -2459,7 +2459,7 @@ windows_kill_inferior (struct target_ops *ops)
 }
 
 static void
-windows_prepare_to_store (struct regcache *regcache)
+windows_prepare_to_store (struct target_ops *self, struct regcache *regcache)
 {
   /* Do nothing, since we can store individual regs.  */
 }
@@ -2471,7 +2471,7 @@ windows_can_run (void)
 }
 
 static void
-windows_close (void)
+windows_close (struct target_ops *self)
 {
   DEBUG_EVENTS (("gdb: windows_close, inferior_ptid=%d\n",
 		ptid_get_pid (inferior_ptid)));
-- 
1.8.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]