This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC v2 10/38] Add target_ops argument to to_thread_name
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tromey at redhat dot com>
- Date: Thu, 6 Feb 2014 13:55:08 -0700
- Subject: [RFC v2 10/38] Add target_ops argument to to_thread_name
- Authentication-results: sourceware.org; auth=none
- References: <1391720136-2121-1-git-send-email-tromey at redhat dot com>
2014-02-06 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-02-06 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-02-06 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-02-06 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-02-06 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-02-06 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-02-06 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-02-06 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-02-06 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-02-06 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 dd4b3ce..70b03a9 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 cc7fa13..da0f367 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 662fa55..a2a1f60 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 d9d1443..a3f51d6 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 8591293..da8df80 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2251,7 +2251,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"));
}
@@ -2526,7 +2526,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 37fac4b..e047636 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 7180fb4..89265a0 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 76877de..2181648 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -844,7 +844,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
@@ -2193,7 +2193,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;
}
@@ -3991,7 +3991,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);
@@ -4031,7 +4031,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;
@@ -4095,7 +4095,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. */
@@ -4517,7 +4518,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;
}
@@ -4744,12 +4745,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 3f5a067..20bd4c2 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");
@@ -2262,7 +2262,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)
@@ -2276,7 +2276,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 347636f..72c471b 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 dc6a570..145505d 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 5fedb90..1b2b2ff 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -1218,7 +1218,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 1b01317..06592a0 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);
@@ -137,9 +137,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);
@@ -4263,7 +4265,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);
}
@@ -5056,7 +5058,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);
@@ -5471,7 +5474,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;
@@ -5541,7 +5544,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 fa9fbf5..a825f5a 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -1701,7 +1701,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;
@@ -1724,7 +1724,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 0af8cfc..02a812a 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -1391,7 +1391,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 31107f7..3e81927 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 9d3c6ab..fde6942 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -154,7 +154,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);
@@ -5215,7 +5215,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");
@@ -9152,7 +9152,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 ();
@@ -10415,7 +10415,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 2b1eced..7471a6b 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -130,7 +130,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 0351f5d..f4ab31e 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -304,7 +304,7 @@ extern void serial_add_interface (const 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 d948e92..ec48d40 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -146,7 +146,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
@@ -822,16 +822,16 @@ update_current_target (void)
(char *(*) (struct target_ops *, struct thread_info *))
return_null);
de_fault (to_thread_name,
- (char *(*) (struct thread_info *))
+ (char *(*) (struct target_ops *, struct thread_info *))
return_null);
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_null);
de_fault (to_thread_architecture,
default_thread_architecture);
@@ -2710,7 +2710,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;
@@ -3151,13 +3151,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;
}
@@ -3168,7 +3168,7 @@ target_supports_non_stop (void)
for (t = ¤t_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;
}
@@ -3709,7 +3709,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;
@@ -3717,7 +3718,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;
@@ -3725,7 +3727,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;
@@ -3733,7 +3735,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 ();
}
@@ -3864,7 +3866,7 @@ target_stop (ptid_t ptid)
return;
}
- (*current_target.to_stop) (ptid);
+ (*current_target.to_stop) (¤t_target, ptid);
}
static void
@@ -4926,28 +4928,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);
@@ -5014,10 +5016,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 dc560a1..c315bcb 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -514,11 +514,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 *);
@@ -535,15 +536,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
@@ -1421,7 +1423,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) (¤t_target, command, outbuf)
/* Does the target include all of memory, or only part of it? This
@@ -1531,7 +1533,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) (¤t_target, pid)
/* See the to_thread_architecture description in struct target_ops. */
@@ -1546,21 +1548,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) (¤t_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) (¤t_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) (¤t_target, ARGS, FROM_TTY)
#define target_goto_bookmark(ARG, FROM_TTY) \
- (current_target.to_goto_bookmark) (ARG, FROM_TTY)
+ (current_target.to_goto_bookmark) (¤t_target, ARG, FROM_TTY)
/* Hardware watchpoint interfaces. */
@@ -1854,7 +1856,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) (¤t_target, \
+ p); \
while (0)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index ef844be..91af87b 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -165,7 +165,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 *);
@@ -1994,7 +1994,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__
@@ -2403,7 +2403,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