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 12/32] Add target_ops argument to to_thread_name


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

	* target.h (struct target_ops) <to_thread_name>: Add argument.
	* target.c (target_thread_name): Add argument.
	(update_current_target): Update.
	* linux-nat.c (linux_nat_thread_name): Add 'self' argument.

Add target_ops argument to to_stop

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

	* windows-nat.c (windows_stop): Add 'self' argument.
	* target.h (struct target_ops) <to_stop>: Add argument.
	* target.c (target_stop): Add argument.
	(debug_to_stop): Add argument.
	(update_current_target): Update.
	* remote.c (remote_stop): Add 'self' argument.
	* remote-sim.c (gdbsim_stop): Add 'self' argument.
	(gdbsim_cntrl_c): Update.
	* remote-m32r-sdi.c (m32r_stop): Add 'self' argument.
	* procfs.c (procfs_stop): Add 'self' argument.
	* nto-procfs.c (procfs_stop): Add 'self' argument.
	* monitor.c (monitor_stop): Add 'self' argument.
	(monitor_open): Update.
	* linux-nat.c (linux_nat_stop): Add argument.
	* inf-ptrace.c (inf_ptrace_stop): Add 'self' argument.
	* gnu-nat.c (gnu_stop): Add 'self' argument.
	* darwin-nat.c (darwin_stop): Add 'self' argument.

Add target_ops argument to to_rcmd

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

	* target.h (struct target_ops) <to_rcmd>: Add argument.
	(target_rcmd): Add argument.
	* target.c (debug_to_rcmd): Add argument.
	(update_current_target, do_monitor_command): Update.
	* remote.c (remote_rcmd): Add 'self' argument.
	* monitor.c (monitor_rcmd): Add 'self' argument.

Add target_ops argument to to_pid_to_exec_file

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

	* windows-nat.c (windows_pid_to_exec_file): Add 'self' argument.
	* target.h (struct target_ops) <to_pid_to_exec_file>: Add
	argument.
	(target_pid_to_exec_file): Add argument.
	* target.c (debug_to_pid_to_exec_file): Add argument.
	(update_current_target): Update.
	* nbsd-nat.h (nbsd_pid_to_exec_file): Add 'self' argument.
	* nbsd-nat.c (nbsd_pid_to_exec_file): Add 'self' argument.
	* linux-nat.c (linux_child_pid_to_exec_file): Add 'self' argument.
	(linux_handle_extended_wait): Update.
	* inf-child.c (inf_child_pid_to_exec_file): Add 'self' argument.
	* fbsd-nat.h (fbsd_pid_to_exec_file): Add 'self' argument.
	* fbsd-nat.c (fbsd_pid_to_exec_file): Add 'self' argument.
	* darwin-nat.c (darwin_pid_to_exec_file): Add 'self' argument.

Add target_ops argument to to_log_command

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

	* target.h (struct target_ops) <to_log_command>: Add argument.
	(target_log_command): Add argument.
	* serial.h (serial_log_command): Add 'self' argument.
	* serial.c (serial_log_command): Add 'self' argument.

Add target_ops argument to to_supports_non_stop

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

	* target.h (struct target_ops) <to_supports_non_stop>: Add
	argument.
	* target.c (find_default_supports_non_stop): Add argument.
	(target_supports_non_stop): Add argument.
	(find_default_supports_non_stop): Add 'self' argument.
	* remote.c (remote_supports_non_stop): Add 'self' argument.
	* linux-nat.c (linux_nat_supports_non_stop): Add 'self' argument.

Add target_ops argument to to_find_memory_regions

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

	* target.h (struct target_ops) <to_find_memory_regions>: Add
	argument.
	(target_find_memory_regions): Add argument.
	* target.c (dummy_find_memory_regions): Add 'self' argument.
	* procfs.c (proc_find_memory_regions): Add 'self' argument.
	* gnu-nat.c (gnu_find_memory_regions): Add 'self' argument.
	* fbsd-nat.h (fbsd_find_memory_regions): Add 'self' argument.
	* fbsd-nat.c (fbsd_find_memory_regions): Add 'self' argument.
	* exec. (exec_do_find_memory_regions): New global.
	(exec_set_find_memory_regions): Rewrite.
	(exec_find_memory_regions): New function.
	(init_exec_ops): Use exec_find_memory_regions.

Add target_ops argument to to_make_corefile_notes

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

	* target.h (struct target_ops) <to_make_corefile_notes>: Add
	argument.
	(target_make_corefile_notes): Add argument.
	* target.c (dummy_make_corefile_notes): Add 'self' argument.
	* procfs.c (procfs_make_note_section): Add 'self' argument.
	(procfs_make_note_section): Add 'self' argument.
	(procfs_make_note_section): Add 'self' argument.
	* linux-nat.c (linux_nat_make_corefile_notes): Add 'self'
	argument.
	* fbsd-nat.h (fbsd_make_corefile_notes): Add 'self' argument.
	* fbsd-nat.c (fbsd_make_corefile_notes): Add 'self' argument.
	* exec.c (exec_make_note_section): Add 'self' argument.
	(exec_make_note_section): Add 'self' argument.

Add target_ops argument to to_get_bookmark

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

	* target.h (struct target_ops) <to_get_bookmark>: Add argument.
	(target_get_bookmark): Add argument.
	* target.c (dummy_get_bookmark): Add 'self' argument.
	* record-full.c (record_full_get_bookmark): Add 'self' argument.

Add target_ops argument to to_goto_bookmark

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

	* target.h (struct target_ops) <to_goto_bookmark>: Add argument.
	(target_goto_bookmark): Add argument.
	* target.c (dummy_goto_bookmark): Add 'self' argument.
	* record-full.c (record_full_goto_bookmark): Add 'self' argument.
---
 gdb/ChangeLog         | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/darwin-nat.c      |   6 +--
 gdb/exec.c            |  18 ++++++--
 gdb/fbsd-nat.c        |   7 +--
 gdb/fbsd-nat.h        |   8 ++--
 gdb/gnu-nat.c         |   5 ++-
 gdb/inf-child.c       |   2 +-
 gdb/inf-ptrace.c      |   2 +-
 gdb/linux-nat.c       |  17 ++++----
 gdb/monitor.c         |   8 ++--
 gdb/nbsd-nat.c        |   2 +-
 gdb/nbsd-nat.h        |   2 +-
 gdb/nto-procfs.c      |   2 +-
 gdb/procfs.c          |  17 +++++---
 gdb/record-full.c     |   5 ++-
 gdb/remote-m32r-sdi.c |   2 +-
 gdb/remote-sim.c      |   6 +--
 gdb/remote.c          |   8 ++--
 gdb/serial.c          |   2 +-
 gdb/serial.h          |   2 +-
 gdb/target.c          |  47 +++++++++++----------
 gdb/target.h          |  37 ++++++++--------
 gdb/windows-nat.c     |   6 +--
 23 files changed, 234 insertions(+), 92 deletions(-)

diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index f0f938d..bb6c014 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -87,7 +87,7 @@
 
 extern boolean_t exc_server (mach_msg_header_t *in, mach_msg_header_t *out);
 
-static void darwin_stop (ptid_t);
+static void darwin_stop (struct target_ops *self, ptid_t);
 
 static void darwin_resume_to (struct target_ops *ops, ptid_t ptid, int step,
                               enum gdb_signal signal);
@@ -1144,7 +1144,7 @@ darwin_wait_to (struct target_ops *ops,
 }
 
 static void
-darwin_stop (ptid_t t)
+darwin_stop (struct target_ops *self, ptid_t t)
 {
   struct inferior *inf = current_inferior ();
 
@@ -1976,7 +1976,7 @@ set_enable_mach_exceptions (char *args, int from_tty,
 }
 
 static char *
-darwin_pid_to_exec_file (int pid)
+darwin_pid_to_exec_file (struct target_ops *self, int pid)
 {
   char *path;
   int res;
diff --git a/gdb/exec.c b/gdb/exec.c
index 5fe5b8b..6777f35 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -62,6 +62,10 @@ void _initialize_exec (void);
 
 struct target_ops exec_ops;
 
+/* Function used to implement to_find_memory_regions.  */
+
+static int (*exec_do_find_memory_regions) (find_memory_region_ftype, void *);
+
 /* True if the exec target is pushed on the stack.  */
 static int using_exec_ops;
 
@@ -821,10 +825,17 @@ exec_has_memory (struct target_ops *ops)
 extern void
 exec_set_find_memory_regions (int (*func) (find_memory_region_ftype, void *))
 {
-  exec_ops.to_find_memory_regions = func;
+  exec_do_find_memory_regions = func;
+}
+
+static int
+exec_find_memory_regions (struct target_ops *self,
+			  find_memory_region_ftype func, void *data)
+{
+  return exec_do_find_memory_regions (func, data);
 }
 
-static char *exec_make_note_section (bfd *, int *);
+static char *exec_make_note_section (struct target_ops *self, bfd *, int *);
 
 /* Fill in the exec file target vector.  Very few entries need to be
    defined.  */
@@ -848,6 +859,7 @@ Specify the filename of the executable file.";
   exec_ops.to_stratum = file_stratum;
   exec_ops.to_has_memory = exec_has_memory;
   exec_ops.to_make_corefile_notes = exec_make_note_section;
+  exec_ops.to_find_memory_regions = exec_find_memory_regions;
   exec_ops.to_magic = OPS_MAGIC;
 }
 
@@ -895,7 +907,7 @@ Show writing into executable and core files."), NULL,
 }
 
 static char *
-exec_make_note_section (bfd *obfd, int *note_size)
+exec_make_note_section (struct target_ops *self, bfd *obfd, int *note_size)
 {
   error (_("Can't create a corefile"));
 }
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 6b37a17..ba6ffab 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -37,7 +37,7 @@
    the child process identified by PID.  */
 
 char *
-fbsd_pid_to_exec_file (int pid)
+fbsd_pid_to_exec_file (struct target_ops *self, int pid)
 {
   size_t len = PATH_MAX;
   char *buf = xcalloc (len, sizeof (char));
@@ -91,7 +91,8 @@ fbsd_read_mapping (FILE *mapfile, unsigned long *start, unsigned long *end,
    argument to FUNC.  */
 
 int
-fbsd_find_memory_regions (find_memory_region_ftype func, void *obfd)
+fbsd_find_memory_regions (struct target_ops *self,
+			  find_memory_region_ftype func, void *obfd)
 {
   pid_t pid = ptid_get_pid (inferior_ptid);
   char *mapfilename;
@@ -166,7 +167,7 @@ find_stop_signal (void)
    allocated memory.  */
 
 char *
-fbsd_make_corefile_notes (bfd *obfd, int *note_size)
+fbsd_make_corefile_notes (struct target_ops *self, bfd *obfd, int *note_size)
 {
   const struct regcache *regcache = get_current_regcache ();
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h
index a422c46..f487864 100644
--- a/gdb/fbsd-nat.h
+++ b/gdb/fbsd-nat.h
@@ -23,17 +23,19 @@
 /* Return the name of a file that can be opened to get the symbols for
    the child process identified by PID.  */
 
-extern char *fbsd_pid_to_exec_file (int pid);
+extern char *fbsd_pid_to_exec_file (struct target_ops *self, int pid);
 
 /* Iterate over all the memory regions in the current inferior,
    calling FUNC for each memory region.  OBFD is passed as the last
    argument to FUNC.  */
 
-extern int fbsd_find_memory_regions (find_memory_region_ftype func, void *obfd);
+extern int fbsd_find_memory_regions (struct target_ops *self,
+				     find_memory_region_ftype func, void *obfd);
 
 /* Create appropriate note sections for a corefile, returning them in
    allocated memory.  */
 
-extern char *fbsd_make_corefile_notes (bfd *obfd, int *note_size);
+extern char *fbsd_make_corefile_notes (struct target_ops *self,
+				       bfd *obfd, int *note_size);
 
 #endif /* fbsd-nat.h */
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index c596034..862907f 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2252,7 +2252,7 @@ gnu_terminal_init_inferior (struct target_ops *self)
 }
 
 static void
-gnu_stop (ptid_t ptid)
+gnu_stop (struct target_ops *self, ptid_t ptid)
 {
   error (_("to_stop target function not implemented"));
 }
@@ -2527,7 +2527,8 @@ gnu_xfer_partial (struct target_ops *ops, enum target_object object,
 
 /* Call FUNC on each memory region in the task.  */
 static int
-gnu_find_memory_regions (find_memory_region_ftype func, void *data)
+gnu_find_memory_regions (struct target_ops *self,
+			 find_memory_region_ftype func, void *data)
 {
   error_t err;
   task_t task;
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index 858b464..7b8491f 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -134,7 +134,7 @@ inf_child_can_run (struct target_ops *self)
 }
 
 static char *
-inf_child_pid_to_exec_file (int pid)
+inf_child_pid_to_exec_file (struct target_ops *self, int pid)
 {
   /* This version of Unix doesn't support translation of a process ID
      to the filename of the executable file.  */
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index e71343a..aa347c5 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -321,7 +321,7 @@ inf_ptrace_kill (struct target_ops *ops)
 /* Stop the inferior.  */
 
 static void
-inf_ptrace_stop (ptid_t ptid)
+inf_ptrace_stop (struct target_ops *self, ptid_t ptid)
 {
   /* Send a SIGINT to the process group.  This acts just like the user
      typed a ^C on the controlling terminal.  Note that using a
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index aa3b136..1116f9c 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -850,7 +850,7 @@ linux_nat_pass_signals (struct target_ops *self,
 /* Prototypes for local functions.  */
 static int stop_wait_callback (struct lwp_info *lp, void *data);
 static int linux_thread_alive (ptid_t ptid);
-static char *linux_child_pid_to_exec_file (int pid);
+static char *linux_child_pid_to_exec_file (struct target_ops *self, int pid);
 
 
 /* Convert wait status STATUS to a string.  Used for printing debug
@@ -2199,7 +2199,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status,
 
       ourstatus->kind = TARGET_WAITKIND_EXECD;
       ourstatus->value.execd_pathname
-	= xstrdup (linux_child_pid_to_exec_file (pid));
+	= xstrdup (linux_child_pid_to_exec_file (NULL, pid));
 
       return 0;
     }
@@ -3997,7 +3997,7 @@ linux_nat_pid_to_str (struct target_ops *ops, ptid_t ptid)
 }
 
 static char *
-linux_nat_thread_name (struct thread_info *thr)
+linux_nat_thread_name (struct target_ops *self, struct thread_info *thr)
 {
   int pid = ptid_get_pid (thr->ptid);
   long lwp = ptid_get_lwp (thr->ptid);
@@ -4037,7 +4037,7 @@ linux_nat_thread_name (struct thread_info *thr)
    can be opened to get the symbols for the child process.  */
 
 static char *
-linux_child_pid_to_exec_file (int pid)
+linux_child_pid_to_exec_file (struct target_ops *self, int pid)
 {
   char *name1, *name2;
 
@@ -4101,7 +4101,8 @@ linux_nat_collect_thread_registers (const struct regcache *regcache,
    section for a corefile, and returns it in a malloc buffer.  */
 
 static char *
-linux_nat_make_corefile_notes (bfd *obfd, int *note_size)
+linux_nat_make_corefile_notes (struct target_ops *self,
+			       bfd *obfd, int *note_size)
 {
   /* FIXME: uweigand/2011-10-06: Once all GNU/Linux architectures have been
      converted to gdbarch_core_regset_sections, this function can go away.  */
@@ -4522,7 +4523,7 @@ linux_nat_can_async_p (struct target_ops *ops)
 }
 
 static int
-linux_nat_supports_non_stop (void)
+linux_nat_supports_non_stop (struct target_ops *self)
 {
   return 1;
 }
@@ -4749,12 +4750,12 @@ linux_nat_stop_lwp (struct lwp_info *lwp, void *data)
 }
 
 static void
-linux_nat_stop (ptid_t ptid)
+linux_nat_stop (struct target_ops *self, ptid_t ptid)
 {
   if (non_stop)
     iterate_over_lwps (ptid, linux_nat_stop_lwp, NULL);
   else
-    linux_ops->to_stop (ptid);
+    linux_ops->to_stop (linux_ops, ptid);
 }
 
 static void
diff --git a/gdb/monitor.c b/gdb/monitor.c
index cf12c1b..94246ba 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -61,7 +61,7 @@ static struct target_ops *targ_ops;
 
 static void monitor_interrupt_query (void);
 static void monitor_interrupt_twice (int);
-static void monitor_stop (ptid_t);
+static void monitor_stop (struct target_ops *self, ptid_t);
 static void monitor_dump_regs (struct regcache *regcache);
 
 #if 0
@@ -783,7 +783,7 @@ monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty)
 
   if (current_monitor->stop)
     {
-      monitor_stop (inferior_ptid);
+      monitor_stop (targ_ops, inferior_ptid);
       if ((current_monitor->flags & MO_NO_ECHO_ON_OPEN) == 0)
 	{
 	  monitor_debug ("EXP Open echo\n");
@@ -2264,7 +2264,7 @@ monitor_load (struct target_ops *self, char *args, int from_tty)
 }
 
 static void
-monitor_stop (ptid_t ptid)
+monitor_stop (struct target_ops *self, ptid_t ptid)
 {
   monitor_debug ("MON stop\n");
   if ((current_monitor->flags & MO_SEND_BREAK_ON_STOP) != 0)
@@ -2278,7 +2278,7 @@ monitor_stop (ptid_t ptid)
    ourseleves here cause of a nasty echo.  */
 
 static void
-monitor_rcmd (char *command,
+monitor_rcmd (struct target_ops *self, char *command,
 	      struct ui_file *outbuf)
 {
   char *p;
diff --git a/gdb/nbsd-nat.c b/gdb/nbsd-nat.c
index 324efd8..924e908 100644
--- a/gdb/nbsd-nat.c
+++ b/gdb/nbsd-nat.c
@@ -25,7 +25,7 @@
    the child process identified by PID.  */
 
 char *
-nbsd_pid_to_exec_file (int pid)
+nbsd_pid_to_exec_file (struct target_ops *self, int pid)
 {
   size_t len = PATH_MAX;
   char *buf = xcalloc (len, sizeof (char));
diff --git a/gdb/nbsd-nat.h b/gdb/nbsd-nat.h
index 8d6959a..cf14ea3 100644
--- a/gdb/nbsd-nat.h
+++ b/gdb/nbsd-nat.h
@@ -23,6 +23,6 @@
 /* Return the name of a file that can be opened to get the symbols for
    the child process identified by PID.  */
 
-extern char *nbsd_pid_to_exec_file (int pid);
+extern char *nbsd_pid_to_exec_file (struct target_ops *self, int pid);
 
 #endif /* nbsd-nat.h */
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 6fd3502..79e08c2 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -1220,7 +1220,7 @@ procfs_create_inferior (struct target_ops *ops, char *exec_file,
 }
 
 static void
-procfs_stop (ptid_t ptid)
+procfs_stop (struct target_ops *self, ptid_t ptid)
 {
   devctl (ctl_fd, DCMD_PROC_STOP, NULL, 0, 0);
 }
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 4ce2ebb..6ae7f91 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -113,7 +113,7 @@ static void procfs_attach (struct target_ops *, char *, int);
 static void procfs_detach (struct target_ops *, const char *, int);
 static void procfs_resume (struct target_ops *,
 			   ptid_t, int, enum gdb_signal);
-static void procfs_stop (ptid_t);
+static void procfs_stop (struct target_ops *self, ptid_t);
 static void procfs_files_info (struct target_ops *);
 static void procfs_fetch_registers (struct target_ops *,
 				    struct regcache *, int);
@@ -142,9 +142,11 @@ static int procfs_thread_alive (struct target_ops *ops, ptid_t);
 static void procfs_find_new_threads (struct target_ops *ops);
 static char *procfs_pid_to_str (struct target_ops *, ptid_t);
 
-static int proc_find_memory_regions (find_memory_region_ftype, void *);
+static int proc_find_memory_regions (struct target_ops *self,
+				     find_memory_region_ftype, void *);
 
-static char * procfs_make_note_section (bfd *, int *);
+static char * procfs_make_note_section (struct target_ops *self,
+					bfd *, int *);
 
 static int procfs_can_use_hw_breakpoint (struct target_ops *self,
 					 int, int, int);
@@ -4268,7 +4270,7 @@ procfs_files_info (struct target_ops *ignore)
    kill(SIGINT) to the child's process group.  */
 
 static void
-procfs_stop (ptid_t ptid)
+procfs_stop (struct target_ops *self, ptid_t ptid)
 {
   kill (-inferior_process_group (), SIGINT);
 }
@@ -5061,7 +5063,8 @@ find_memory_regions_callback (struct prmap *map,
    the callback.  */
 
 static int
-proc_find_memory_regions (find_memory_region_ftype func, void *data)
+proc_find_memory_regions (struct target_ops *self,
+			  find_memory_region_ftype func, void *data)
 {
   procinfo *pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
 
@@ -5476,7 +5479,7 @@ find_stop_signal (void)
 }
 
 static char *
-procfs_make_note_section (bfd *obfd, int *note_size)
+procfs_make_note_section (struct target_ops *self, bfd *obfd, int *note_size)
 {
   struct cleanup *old_chain;
   gdb_gregset_t gregs;
@@ -5549,7 +5552,7 @@ procfs_make_note_section (bfd *obfd, int *note_size)
 }
 #else /* !Solaris */
 static char *
-procfs_make_note_section (bfd *obfd, int *note_size)
+procfs_make_note_section (struct target_ops *self, bfd *obfd, int *note_size)
 {
   error (_("gcore not implemented for this host."));
   return NULL;	/* lint */
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 9e8ac1e..61b1397 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -1691,7 +1691,7 @@ record_full_can_execute_reverse (void)
 /* "to_get_bookmark" method for process record and prec over core.  */
 
 static gdb_byte *
-record_full_get_bookmark (char *args, int from_tty)
+record_full_get_bookmark (struct target_ops *self, char *args, int from_tty)
 {
   char *ret = NULL;
 
@@ -1714,7 +1714,8 @@ record_full_get_bookmark (char *args, int from_tty)
 /* "to_goto_bookmark" method for process record and prec over core.  */
 
 static void
-record_full_goto_bookmark (gdb_byte *raw_bookmark, int from_tty)
+record_full_goto_bookmark (struct target_ops *self,
+			   gdb_byte *raw_bookmark, int from_tty)
 {
   char *bookmark = (char *) raw_bookmark;
 
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index c37b6e2..eedc923 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -1392,7 +1392,7 @@ m32r_load (struct target_ops *self, char *args, int from_tty)
 }
 
 static void
-m32r_stop (ptid_t ptid)
+m32r_stop (struct target_ops *self, ptid_t ptid)
 {
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "m32r_stop()\n");
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index c4b7da1..42c63ba 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -88,7 +88,7 @@ static void gdbsim_files_info (struct target_ops *target);
 
 static void gdbsim_mourn_inferior (struct target_ops *target);
 
-static void gdbsim_stop (ptid_t ptid);
+static void gdbsim_stop (struct target_ops *self, ptid_t ptid);
 
 void simulator_command (char *args, int from_tty);
 
@@ -919,7 +919,7 @@ gdbsim_stop_inferior (struct inferior *inf, void *arg)
 }
 
 static void
-gdbsim_stop (ptid_t ptid)
+gdbsim_stop (struct target_ops *self, ptid_t ptid)
 {
   struct sim_inferior_data *sim_data;
 
@@ -963,7 +963,7 @@ gdb_os_poll_quit (host_callback *p)
 static void
 gdbsim_cntrl_c (int signo)
 {
-  gdbsim_stop (minus_one_ptid);
+  gdbsim_stop (NULL, minus_one_ptid);
 }
 
 static ptid_t
diff --git a/gdb/remote.c b/gdb/remote.c
index 61fc670..41147a2 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -155,7 +155,7 @@ static void init_remote_ops (void);
 
 static void init_extended_remote_ops (void);
 
-static void remote_stop (ptid_t);
+static void remote_stop (struct target_ops *self, ptid_t);
 
 static int ishex (int ch, int *val);
 
@@ -5166,7 +5166,7 @@ remote_stop_as (ptid_t ptid)
    will eventually end up here.  */
 
 static void
-remote_stop (ptid_t ptid)
+remote_stop (struct target_ops *self, ptid_t ptid)
 {
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "remote_stop called\n");
@@ -9097,7 +9097,7 @@ remote_search_memory (struct target_ops* ops,
 }
 
 static void
-remote_rcmd (char *command,
+remote_rcmd (struct target_ops *self, char *command,
 	     struct ui_file *outbuf)
 {
   struct remote_state *rs = get_remote_state ();
@@ -10360,7 +10360,7 @@ remote_can_execute_reverse (void)
 }
 
 static int
-remote_supports_non_stop (void)
+remote_supports_non_stop (struct target_ops *self)
 {
   return 1;
 }
diff --git a/gdb/serial.c b/gdb/serial.c
index 78e9085..659970e 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -127,7 +127,7 @@ serial_logchar (struct ui_file *stream, int ch_type, int ch, int timeout)
 }
 
 void
-serial_log_command (const char *cmd)
+serial_log_command (struct target_ops *self, const char *cmd)
 {
   if (!serial_logfp)
     return;
diff --git a/gdb/serial.h b/gdb/serial.h
index 7a97e28..829b211 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -305,7 +305,7 @@ extern void serial_add_interface (struct serial_ops * optable);
 
 /* File in which to record the remote debugging session.  */
 
-extern void serial_log_command (const char *);
+extern void serial_log_command (struct target_ops *self, const char *);
 
 #ifdef USE_WIN32API
 
diff --git a/gdb/target.c b/gdb/target.c
index 4345ff6..dce3eac 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -142,7 +142,7 @@ static void debug_to_load (struct target_ops *self, char *, int);
 
 static int debug_to_can_run (struct target_ops *self);
 
-static void debug_to_stop (ptid_t);
+static void debug_to_stop (struct target_ops *self, ptid_t);
 
 /* Pointer to array of target architecture structures; the size of the
    array; the current index into the array; the allocated size of the
@@ -818,16 +818,16 @@ update_current_target (void)
 	    (char *(*) (struct target_ops *, struct thread_info *))
 	    return_zero);
   de_fault (to_thread_name,
-	    (char *(*) (struct thread_info *))
+	    (char *(*) (struct target_ops *, struct thread_info *))
 	    return_zero);
   de_fault (to_stop,
-	    (void (*) (ptid_t))
+	    (void (*) (struct target_ops *, ptid_t))
 	    target_ignore);
   de_fault (to_rcmd,
-	    (void (*) (char *, struct ui_file *))
+	    (void (*) (struct target_ops *, char *, struct ui_file *))
 	    tcomplain);
   de_fault (to_pid_to_exec_file,
-	    (char *(*) (int))
+	    (char *(*) (struct target_ops *, int))
 	    return_zero);
   de_fault (to_thread_architecture,
 	    default_thread_architecture);
@@ -2698,7 +2698,7 @@ target_thread_name (struct thread_info *info)
   for (t = current_target.beneath; t != NULL; t = t->beneath)
     {
       if (t->to_thread_name != NULL)
-	return (*t->to_thread_name) (info);
+	return (*t->to_thread_name) (t, info);
     }
 
   return NULL;
@@ -3139,13 +3139,13 @@ find_default_is_async_p (struct target_ops *ignore)
 }
 
 static int
-find_default_supports_non_stop (void)
+find_default_supports_non_stop (struct target_ops *self)
 {
   struct target_ops *t;
 
   t = find_default_run_target (NULL);
   if (t && t->to_supports_non_stop)
-    return (t->to_supports_non_stop) ();
+    return (t->to_supports_non_stop) (t);
   return 0;
 }
 
@@ -3156,7 +3156,7 @@ target_supports_non_stop (void)
 
   for (t = &current_target; t != NULL; t = t->beneath)
     if (t->to_supports_non_stop)
-      return t->to_supports_non_stop ();
+      return t->to_supports_non_stop (t);
 
   return 0;
 }
@@ -3691,7 +3691,8 @@ dummy_pid_to_str (struct target_ops *ops, ptid_t ptid)
 
 /* Error-catcher for target_find_memory_regions.  */
 static int
-dummy_find_memory_regions (find_memory_region_ftype ignore1, void *ignore2)
+dummy_find_memory_regions (struct target_ops *self,
+			   find_memory_region_ftype ignore1, void *ignore2)
 {
   error (_("Command not implemented for this target."));
   return 0;
@@ -3699,7 +3700,8 @@ dummy_find_memory_regions (find_memory_region_ftype ignore1, void *ignore2)
 
 /* Error-catcher for target_make_corefile_notes.  */
 static char *
-dummy_make_corefile_notes (bfd *ignore1, int *ignore2)
+dummy_make_corefile_notes (struct target_ops *self,
+			   bfd *ignore1, int *ignore2)
 {
   error (_("Command not implemented for this target."));
   return NULL;
@@ -3707,7 +3709,7 @@ dummy_make_corefile_notes (bfd *ignore1, int *ignore2)
 
 /* Error-catcher for target_get_bookmark.  */
 static gdb_byte *
-dummy_get_bookmark (char *ignore1, int ignore2)
+dummy_get_bookmark (struct target_ops *self, char *ignore1, int ignore2)
 {
   tcomplain ();
   return NULL;
@@ -3715,7 +3717,7 @@ dummy_get_bookmark (char *ignore1, int ignore2)
 
 /* Error-catcher for target_goto_bookmark.  */
 static void
-dummy_goto_bookmark (gdb_byte *ignore, int from_tty)
+dummy_goto_bookmark (struct target_ops *self, gdb_byte *ignore, int from_tty)
 {
   tcomplain ();
 }
@@ -3846,7 +3848,7 @@ target_stop (ptid_t ptid)
       return;
     }
 
-  (*current_target.to_stop) (ptid);
+  (*current_target.to_stop) (&current_target, ptid);
 }
 
 static void
@@ -4860,28 +4862,28 @@ debug_to_thread_architecture (struct target_ops *ops, ptid_t ptid)
 }
 
 static void
-debug_to_stop (ptid_t ptid)
+debug_to_stop (struct target_ops *self, ptid_t ptid)
 {
-  debug_target.to_stop (ptid);
+  debug_target.to_stop (&debug_target, ptid);
 
   fprintf_unfiltered (gdb_stdlog, "target_stop (%s)\n",
 		      target_pid_to_str (ptid));
 }
 
 static void
-debug_to_rcmd (char *command,
+debug_to_rcmd (struct target_ops *self, char *command,
 	       struct ui_file *outbuf)
 {
-  debug_target.to_rcmd (command, outbuf);
+  debug_target.to_rcmd (&debug_target, command, outbuf);
   fprintf_unfiltered (gdb_stdlog, "target_rcmd (%s, ...)\n", command);
 }
 
 static char *
-debug_to_pid_to_exec_file (int pid)
+debug_to_pid_to_exec_file (struct target_ops *self, int pid)
 {
   char *exec_file;
 
-  exec_file = debug_target.to_pid_to_exec_file (pid);
+  exec_file = debug_target.to_pid_to_exec_file (&debug_target, pid);
 
   fprintf_unfiltered (gdb_stdlog, "target_pid_to_exec_file (%d) = %s\n",
 		      pid, exec_file);
@@ -4948,10 +4950,11 @@ do_monitor_command (char *cmd,
 		 int from_tty)
 {
   if ((current_target.to_rcmd
-       == (void (*) (char *, struct ui_file *)) tcomplain)
+       == (void (*) (struct target_ops *, char *, struct ui_file *)) tcomplain)
       || (current_target.to_rcmd == debug_to_rcmd
 	  && (debug_target.to_rcmd
-	      == (void (*) (char *, struct ui_file *)) tcomplain)))
+	      == (void (*) (struct target_ops *,
+			    char *, struct ui_file *)) tcomplain)))
     error (_("\"monitor\" command not supported by this target."));
   target_rcmd (cmd, gdb_stdtarg);
 }
diff --git a/gdb/target.h b/gdb/target.h
index d2a1796..6071e8f 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -509,11 +509,12 @@ struct target_ops
     void (*to_find_new_threads) (struct target_ops *);
     char *(*to_pid_to_str) (struct target_ops *, ptid_t);
     char *(*to_extra_thread_info) (struct target_ops *, struct thread_info *);
-    char *(*to_thread_name) (struct thread_info *);
-    void (*to_stop) (ptid_t);
-    void (*to_rcmd) (char *command, struct ui_file *output);
-    char *(*to_pid_to_exec_file) (int pid);
-    void (*to_log_command) (const char *);
+    char *(*to_thread_name) (struct target_ops *, struct thread_info *);
+    void (*to_stop) (struct target_ops *, ptid_t);
+    void (*to_rcmd) (struct target_ops *,
+		     char *command, struct ui_file *output);
+    char *(*to_pid_to_exec_file) (struct target_ops *, int pid);
+    void (*to_log_command) (struct target_ops *, const char *);
     struct target_section_table *(*to_get_section_table) (struct target_ops *);
     enum strata to_stratum;
     int (*to_has_all_memory) (struct target_ops *);
@@ -530,15 +531,16 @@ struct target_ops
       TARGET_DEFAULT_FUNC (find_default_is_async_p);
     void (*to_async) (struct target_ops *, async_callback_ftype *, void *)
       TARGET_DEFAULT_NORETURN (tcomplain ());
-    int (*to_supports_non_stop) (void);
+    int (*to_supports_non_stop) (struct target_ops *);
     /* find_memory_regions support method for gcore */
-    int (*to_find_memory_regions) (find_memory_region_ftype func, void *data);
+    int (*to_find_memory_regions) (struct target_ops *,
+				   find_memory_region_ftype func, void *data);
     /* make_corefile_notes support method for gcore */
-    char * (*to_make_corefile_notes) (bfd *, int *);
+    char * (*to_make_corefile_notes) (struct target_ops *, bfd *, int *);
     /* get_bookmark support method for bookmarks */
-    gdb_byte * (*to_get_bookmark) (char *, int);
+    gdb_byte * (*to_get_bookmark) (struct target_ops *, char *, int);
     /* goto_bookmark support method for bookmarks */
-    void (*to_goto_bookmark) (gdb_byte *, int);
+    void (*to_goto_bookmark) (struct target_ops *, gdb_byte *, int);
     /* Return the thread-local address at OFFSET in the
        thread-local storage for the thread PTID and the shared library
        or executable file given by OBJFILE.  If that block of
@@ -1399,7 +1401,7 @@ extern void target_stop (ptid_t ptid);
    placed in OUTBUF.  */
 
 #define target_rcmd(command, outbuf) \
-     (*current_target.to_rcmd) (command, outbuf)
+     (*current_target.to_rcmd) (&current_target, command, outbuf)
 
 
 /* Does the target include all of memory, or only part of it?  This
@@ -1509,7 +1511,7 @@ extern char *target_thread_name (struct thread_info *);
    it must persist.  */
 
 #define target_pid_to_exec_file(pid) \
-     (current_target.to_pid_to_exec_file) (pid)
+     (current_target.to_pid_to_exec_file) (&current_target, pid)
 
 /* See the to_thread_architecture description in struct target_ops.  */
 
@@ -1524,21 +1526,21 @@ extern char *target_thread_name (struct thread_info *);
  */
 
 #define target_find_memory_regions(FUNC, DATA) \
-     (current_target.to_find_memory_regions) (FUNC, DATA)
+     (current_target.to_find_memory_regions) (&current_target, FUNC, DATA)
 
 /*
  * Compose corefile .note section.
  */
 
 #define target_make_corefile_notes(BFD, SIZE_P) \
-     (current_target.to_make_corefile_notes) (BFD, SIZE_P)
+     (current_target.to_make_corefile_notes) (&current_target, BFD, SIZE_P)
 
 /* Bookmark interfaces.  */
 #define target_get_bookmark(ARGS, FROM_TTY) \
-     (current_target.to_get_bookmark) (ARGS, FROM_TTY)
+     (current_target.to_get_bookmark) (&current_target, ARGS, FROM_TTY)
 
 #define target_goto_bookmark(ARG, FROM_TTY) \
-     (current_target.to_goto_bookmark) (ARG, FROM_TTY)
+     (current_target.to_goto_bookmark) (&current_target, ARG, FROM_TTY)
 
 /* Hardware watchpoint interfaces.  */
 
@@ -1827,7 +1829,8 @@ extern char *target_fileio_read_stralloc (const char *filename);
 #define target_log_command(p)						\
   do									\
     if (current_target.to_log_command)					\
-      (*current_target.to_log_command) (p);				\
+      (*current_target.to_log_command) (&current_target,		\
+					p);				\
   while (0)
 
 
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 24ad228..7132034 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -166,7 +166,7 @@ static int windows_initialization_done;
 #define DEBUG_MEM(x)	if (debug_memory)	printf_unfiltered x
 #define DEBUG_EXCEPT(x)	if (debug_exceptions)	printf_unfiltered x
 
-static void windows_stop (ptid_t);
+static void windows_stop (struct target_ops *self, ptid_t);
 static int windows_thread_alive (struct target_ops *, ptid_t);
 static void windows_kill_inferior (struct target_ops *);
 
@@ -1985,7 +1985,7 @@ windows_detach (struct target_ops *ops, const char *args, int from_tty)
 }
 
 static char *
-windows_pid_to_exec_file (int pid)
+windows_pid_to_exec_file (struct target_ops *self, int pid)
 {
   static char path[__PMAX];
 #ifdef __CYGWIN__
@@ -2394,7 +2394,7 @@ windows_mourn_inferior (struct target_ops *ops)
    ^C on the controlling terminal.  */
 
 static void
-windows_stop (ptid_t ptid)
+windows_stop (struct target_ops *self, ptid_t ptid)
 {
   DEBUG_EVENTS (("gdb: GenerateConsoleCtrlEvent (CTRLC_EVENT, 0)\n"));
   CHECK (GenerateConsoleCtrlEvent (CTRL_C_EVENT, current_event.dwProcessId));
-- 
1.8.1.4


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