Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Kill ptrace_ops_hack
@ 2008-08-19 17:34 Vladimir Prus
  2008-09-13 15:34 ` Daniel Jacobowitz
  2008-09-18  0:57 ` Joel Brobecker
  0 siblings, 2 replies; 9+ messages in thread
From: Vladimir Prus @ 2008-08-19 17:34 UTC (permalink / raw)
  To: gdb-patches


This is the complete patch to kill ptrace_ops_hack. The approach is
outlined at http://permalink.gmane.org/gmane.comp.gdb.patches/43085
is involves adding 'struct target_ops *' parameter to enough target
methods to make ptrace_ops_hack unnecessary.

This patch mechanically adjusts all other targets to the changes,
but does not try to make those target take advantage of the new
parameter. It appears there there's a lot of target that have a 
static variable poiting either to themself, or to the target beneath,
and each such target probably should be fixed individually, but somebody
who can test on this target.

OK?

- Volodya

	* target.h (struct target_ops): Make to_attach, to_detach,
	to_create_inferior and to_mourn_inferior accept a pointer
	to struct target_ops.
	(target_attach, target_create_inferior, target_create_inferior):
	Convert from macros to function.  Find the right target to
	invoke a method of.
	(find_default_attach, find_default_create_inferior): New parameter
	ops.
	* corefile.c (core_file_command): Pass target to to_detach.
	* corelow.c (core_detach): Add 'ops' parameter.
	* fork-child.c (fork_inferior): Return the pid.  Allow
	init_trace_fun to be NULL.
	* inf-ptrace (ptrace_ops_hack): Remove.
	(inf_ptrace_him): Remove, moving all logic into....
	(inf_ptrace_create_inferior): ... here.  Push the target
	passed as parameter.
	(inf_ptrace_mourn_inferior, inf_ptrace_attach, inf_ptrace_detach):
	Push/pop target passed as parameter, no ptrace_ops_hack.
	(inf_ptrace_target): Don't remember result.
	* inferior.h (fork_inferior): Adjust prototype.
	* linux-nat.c (linux_nat_create_inferior, linux_nat_attach)
	(linux_nat_detach, linux_nat_mourn_inferior): New parameter ops.
	Pass it to linux_ops target.
	* linux-thread-db.c (thread_db_detach, thread_db_mourn_inferior):
	New parameter ops. Pass it to the target beneath.
	* remote.c (remote_mourn, extended_remote_mourn, remote_detach)
	(extended_remote_create_inferior): New parameter ops. Pass it
	further.
	* target.c (debug_to_attach, debug_to_detach)
	(debug_to_mourn_inferior): New parameter ops.
	(target_create_inferior): New.
	(update_current_target): Do not inherit to_attach, to_detach,
	to_create_inferiour, to_mourn_inferior.  Do not default
	to_detach and to_mourn_inferior.
	(target_detach): Find the right target to use.
	(target_mourn_inferior): New.
	(find_default_attach, find_default_create_inferior): New parameter
	ops.  Pass the found target when calling its method.
	(init_dummy_target): Provide fallback definition of to_detach.
	(target_attach): New.
	(debug_to_attach, debug_to_detach, debug_to_create_inferior)
	(debug_to_mourn_inferiour): New parameter ops.
        * aix-thread.c: Adjust.
        * bsd-uthread.c: Adjust.
        * gnu-nat.c: Adjust.
        * go32-nat.c: Adjust.
        * hpux-thread.c: Adjust.
        * inf-ttrace.c: Ajust.
        * monitor.c: Adjust.
        * nto-procfs.c: Adjust.
        * procfs.c: Adjust.
        * remote-m32r-sdi.c: Adjust.
        * remote-mips.c: Adjust.
        * remote-sim.c: Adjust.
        * rs6000-nat.c: Adjust.
        * sol-thread.c: Adjust.
        * win32-nat.c: Adjust.
---
 gdb/aix-thread.c      |   12 +++---
 gdb/bsd-uthread.c     |    5 +-
 gdb/corefile.c        |    2 +-
 gdb/corelow.c         |    6 +-
 gdb/fork-child.c      |    6 ++-
 gdb/gnu-nat.c         |    9 ++--
 gdb/go32-nat.c        |   11 +++--
 gdb/hpux-thread.c     |   17 ++++---
 gdb/inf-ptrace.c      |   42 +++++++-----------
 gdb/inf-ttrace.c      |   10 ++--
 gdb/inferior.h        |    6 +-
 gdb/linux-nat.c       |   17 ++++---
 gdb/linux-thread-db.c |   10 ++--
 gdb/monitor.c         |    8 ++--
 gdb/nto-procfs.c      |   10 ++--
 gdb/procfs.c          |   19 ++++----
 gdb/remote-m32r-sdi.c |    7 ++-
 gdb/remote-mips.c     |    4 +-
 gdb/remote-sim.c      |    4 +-
 gdb/remote.c          |   25 ++++++-----
 gdb/rs6000-nat.c      |    9 ++--
 gdb/sol-thread.c      |   22 +++++-----
 gdb/target.c          |  114 +++++++++++++++++++++++++++++++++++++-----------
 gdb/target.h          |   25 +++++------
 gdb/win32-nat.c       |   10 ++--
 25 files changed, 237 insertions(+), 173 deletions(-)

diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 3377d50..5514094 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -938,19 +938,19 @@ new_objfile (struct objfile *objfile)
 /* Attach to process specified by ARGS.  */
 
 static void
-aix_thread_attach (char *args, int from_tty)
+aix_thread_attach (struct target_ops *ops, char *args, int from_tty)
 {
-  base_target.to_attach (args, from_tty);
+  base_target.to_attach (&base_target, args, from_tty);
   pd_activate (1);
 }
 
 /* Detach from the process attached to by aix_thread_attach().  */
 
 static void
-aix_thread_detach (char *args, int from_tty)
+aix_thread_detach (struct target_ops *ops, char *args, int from_tty)
 {
   pd_disable ();
-  base_target.to_detach (args, from_tty);
+  base_target.to_detach (&base_target, args, from_tty);
 }
 
 /* Tell the inferior process to continue running thread PID if != -1
@@ -1667,10 +1667,10 @@ aix_thread_kill (void)
 /* Clean up after the inferior exits.  */
 
 static void
-aix_thread_mourn_inferior (void)
+aix_thread_mourn_inferior (struct target_ops *ops)
 {
   pd_deactivate ();
-  base_target.to_mourn_inferior ();
+  base_target.to_mourn_inferior (&base_target);
 }
 
 /* Return whether thread PID is still valid.  */
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index df038e6..e560c42 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -263,9 +263,10 @@ bsd_uthread_solib_unloaded (struct so_list *so)
 }
 
 static void
-bsd_uthread_mourn_inferior (void)
+bsd_uthread_mourn_inferior (struct target_ops *ops)
 {
-  find_target_beneath (bsd_uthread_ops_hack)->to_mourn_inferior ();
+  struct target_ops *beneath = find_target_beneath (bsd_uthread_ops_hack);
+  beneath->to_mourn_inferior (beneath);
   bsd_uthread_deactivate ();
 }
 
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 726d9fc..5ad3998 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -74,7 +74,7 @@ core_file_command (char *filename, int from_tty)
     error (_("GDB can't read core files on this machine."));
 
   if (!filename)
-    (t->to_detach) (filename, from_tty);
+    (t->to_detach) (t, filename, from_tty);
   else
     (t->to_open) (filename, from_tty);
 }
diff --git a/gdb/corelow.c b/gdb/corelow.c
index ce8d628..f3716bf 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -75,7 +75,7 @@ static int gdb_check_format (bfd *);
 
 static void core_open (char *, int);
 
-static void core_detach (char *, int);
+static void core_detach (struct target_ops *ops, char *, int);
 
 static void core_close (int);
 
@@ -376,11 +376,11 @@ core_open (char *filename, int from_tty)
 }
 
 static void
-core_detach (char *args, int from_tty)
+core_detach (struct target_ops *ops, char *args, int from_tty)
 {
   if (args)
     error (_("Too many arguments"));
-  unpush_target (&core_ops);
+  unpush_target (ops);
   reinit_frame_cache ();
   if (from_tty)
     printf_filtered (_("No core file now.\n"));
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 7aff110..26dc443 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -118,7 +118,7 @@ escape_bang_in_quoted_argument (const char *shell_file)
 /* This function is NOT reentrant.  Some of the variables have been
    made static to ensure that they survive the vfork call.  */
 
-void
+int
 fork_inferior (char *exec_file_arg, char *allargs, char **env,
 	       void (*traceme_fun) (void), void (*init_trace_fun) (int),
 	       void (*pre_trace_fun) (void), char *shell_file_arg)
@@ -400,11 +400,13 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
   /* Now that we have a child process, make it our target, and
      initialize anything target-vector-specific that needs
      initializing.  */
-  (*init_trace_fun) (pid);
+  if (init_trace_fun)
+    (*init_trace_fun) (pid);
 
   /* We are now in the child process of interest, having exec'd the
      correct program, and are poised at the first instruction of the
      new program.  */
+  return pid;
 }
 
 /* Accept NTRAPS traps from the inferior.  */
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 96531a8..eda77ff 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2015,7 +2015,7 @@ gnu_kill_inferior (void)
 
 /* Clean up after the inferior dies.  */
 static void
-gnu_mourn_inferior (void)
+gnu_mourn_inferior (struct target_ops *ops)
 {
   inf_debug (current_inferior, "rip");
   inf_detach (current_inferior);
@@ -2047,7 +2047,8 @@ cur_inf (void)
 }
 
 static void
-gnu_create_inferior (char *exec_file, char *allargs, char **env,
+gnu_create_inferior (struct target_ops *ops, 
+		     char *exec_file, char *allargs, char **env,
 		     int from_tty)
 {
   struct inf *inf = cur_inf ();
@@ -2110,7 +2111,7 @@ gnu_can_run (void)
 /* Attach to process PID, then initialize for debugging it
    and wait for the trace-trap that results from attaching.  */
 static void
-gnu_attach (char *args, int from_tty)
+gnu_attach (struct target_ops *ops, char *args, int from_tty)
 {
   int pid;
   char *exec_file;
@@ -2172,7 +2173,7 @@ gnu_attach (char *args, int from_tty)
    previously attached.  It *might* work if the program was
    started via fork.  */
 static void
-gnu_detach (char *args, int from_tty)
+gnu_detach (struct target_ops *ops, char *args, int from_tty)
 {
   if (from_tty)
     {
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 88bbddf..3f026b4 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -184,8 +184,9 @@ static int go32_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
 static void go32_files_info (struct target_ops *target);
 static void go32_stop (ptid_t);
 static void go32_kill_inferior (void);
-static void go32_create_inferior (char *exec_file, char *args, char **env, int from_tty);
-static void go32_mourn_inferior (void);
+static void go32_create_inferior (struct target_ops *ops, char *exec_file,
+				  char *args, char **env, int from_tty);
+static void go32_mourn_inferior (struct target_ops *ops);
 static int go32_can_run (void);
 
 static struct target_ops go32_ops;
@@ -306,7 +307,7 @@ go32_close (int quitting)
 }
 
 static void
-go32_attach (char *args, int from_tty)
+go32_attach (struct target_ops *ops, char *args, int from_tty)
 {
   error (_("\
 You cannot attach to a running program on this platform.\n\
@@ -314,7 +315,7 @@ Use the `run' command to run DJGPP programs."));
 }
 
 static void
-go32_detach (char *args, int from_tty)
+go32_detach (struct target_ops *ops, char *args, int from_tty)
 {
 }
 
@@ -672,7 +673,7 @@ go32_create_inferior (char *exec_file, char *args, char **env, int from_tty)
 }
 
 static void
-go32_mourn_inferior (void)
+go32_mourn_inferior (struct target_ops *ops)
 {
   /* We need to make sure all the breakpoint enable bits in the DR7
      register are reset when the inferior exits.  Otherwise, if they
diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c
index cd69e19..8d2e65b 100644
--- a/gdb/hpux-thread.c
+++ b/gdb/hpux-thread.c
@@ -144,9 +144,9 @@ hpux_thread_open (char *arg, int from_tty)
    and wait for the trace-trap that results from attaching.  */
 
 static void
-hpux_thread_attach (char *args, int from_tty)
+hpux_thread_attach (struct target_ops *ops, char *args, int from_tty)
 {
-  deprecated_child_ops.to_attach (args, from_tty);
+  deprecated_child_ops.to_attach (&deprecated_child_ops, args, from_tty);
 
   /* XXX - might want to iterate over all the threads and register them. */
 }
@@ -160,9 +160,9 @@ hpux_thread_attach (char *args, int from_tty)
    started via the normal ptrace (PTRACE_TRACEME).  */
 
 static void
-hpux_thread_detach (char *args, int from_tty)
+hpux_thread_detach (struct target_ops *ops, char *args, int from_tty)
 {
-  deprecated_child_ops.to_detach (args, from_tty);
+  deprecated_child_ops.to_detach (&deprecated_child_ops, args, from_tty);
 }
 
 /* Resume execution of process PID.  If STEP is nozero, then
@@ -431,10 +431,11 @@ hpux_thread_notice_signals (ptid_t ptid)
 /* Fork an inferior process, and start debugging it with /proc.  */
 
 static void
-hpux_thread_create_inferior (char *exec_file, char *allargs, char **env,
-			     int from_tty)
+hpux_thread_create_inferior (struct target_ops *ops, char *exec_file,
+			     char *allargs, char **env, int from_tty)
 {
-  deprecated_child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
+  deprecated_child_ops.to_create_inferior (&deprecated_child_ops, 
+					   exec_file, allargs, env, from_tty);
 
   if (hpux_thread_active)
     {
@@ -487,7 +488,7 @@ hpux_thread_new_objfile (struct objfile *objfile)
 static void
 hpux_thread_mourn_inferior (void)
 {
-  deprecated_child_ops.to_mourn_inferior ();
+  deprecated_child_ops.to_mourn_inferior (&deprecated_child_ops);
 }
 
 /* Mark our target-struct as eligible for stray "run" and "attach" commands.  */
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index ee2c8fa..ae33920 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -34,8 +34,6 @@
 
 #include "inf-child.h"
 
-/* HACK: Save the ptrace ops returned by inf_ptrace_target.  */
-static struct target_ops *ptrace_ops_hack;
 \f
 
 #ifdef PT_GET_PROCESS_STATE
@@ -100,12 +98,20 @@ inf_ptrace_me (void)
   ptrace (PT_TRACE_ME, 0, (PTRACE_TYPE_ARG3)0, 0);
 }
 
-/* Start tracing PID.  */
+/* Start a new inferior Unix child process.  EXEC_FILE is the file to
+   run, ALLARGS is a string containing the arguments to the program.
+   ENV is the environment vector to pass.  If FROM_TTY is non-zero, be
+   chatty about it.  */
 
 static void
-inf_ptrace_him (int pid)
+inf_ptrace_create_inferior (struct target_ops *ops,
+			    char *exec_file, char *allargs, char **env,
+			    int from_tty)
 {
-  push_target (ptrace_ops_hack);
+  int pid = fork_inferior (exec_file, allargs, env, inf_ptrace_me, NULL,
+			   NULL, NULL);
+
+  push_target (ops);
 
   /* On some targets, there must be some explicit synchronization
      between the parent and child processes after the debugger
@@ -124,19 +130,6 @@ inf_ptrace_him (int pid)
   target_post_startup_inferior (pid_to_ptid (pid));
 }
 
-/* Start a new inferior Unix child process.  EXEC_FILE is the file to
-   run, ALLARGS is a string containing the arguments to the program.
-   ENV is the environment vector to pass.  If FROM_TTY is non-zero, be
-   chatty about it.  */
-
-static void
-inf_ptrace_create_inferior (char *exec_file, char *allargs, char **env,
-			    int from_tty)
-{
-  fork_inferior (exec_file, allargs, env, inf_ptrace_me, inf_ptrace_him,
-		 NULL, NULL);
-}
-
 #ifdef PT_GET_PROCESS_STATE
 
 static void
@@ -157,7 +150,7 @@ inf_ptrace_post_startup_inferior (ptid_t pid)
 /* Clean up a rotting corpse of an inferior after it died.  */
 
 static void
-inf_ptrace_mourn_inferior (void)
+inf_ptrace_mourn_inferior (struct target_ops *ops)
 {
   int status;
 
@@ -167,7 +160,7 @@ inf_ptrace_mourn_inferior (void)
      only report its exit status to its original parent.  */
   waitpid (ptid_get_pid (inferior_ptid), &status, 0);
 
-  unpush_target (ptrace_ops_hack);
+  unpush_target (ops);
   generic_mourn_inferior ();
 }
 
@@ -175,7 +168,7 @@ inf_ptrace_mourn_inferior (void)
    be chatty about it.  */
 
 static void
-inf_ptrace_attach (char *args, int from_tty)
+inf_ptrace_attach (struct target_ops *ops, char *args, int from_tty)
 {
   char *exec_file;
   pid_t pid;
@@ -218,7 +211,7 @@ inf_ptrace_attach (char *args, int from_tty)
 #endif
 
   inferior_ptid = pid_to_ptid (pid);
-  push_target (ptrace_ops_hack);
+  push_target (ops);
 }
 
 #ifdef PT_GET_PROCESS_STATE
@@ -242,7 +235,7 @@ inf_ptrace_post_attach (int pid)
    specified by ARGS.  If FROM_TTY is non-zero, be chatty about it.  */
 
 static void
-inf_ptrace_detach (char *args, int from_tty)
+inf_ptrace_detach (struct target_ops *ops, char *args, int from_tty)
 {
   pid_t pid = ptid_get_pid (inferior_ptid);
   int sig = 0;
@@ -274,7 +267,7 @@ inf_ptrace_detach (char *args, int from_tty)
 #endif
 
   inferior_ptid = null_ptid;
-  unpush_target (ptrace_ops_hack);
+  unpush_target (ops);
 }
 
 /* Kill the inferior.  */
@@ -602,7 +595,6 @@ inf_ptrace_target (void)
   t->to_stop = inf_ptrace_stop;
   t->to_xfer_partial = inf_ptrace_xfer_partial;
 
-  ptrace_ops_hack = t;
   return t;
 }
 \f
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index c0b75c7..96898a4 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -627,8 +627,8 @@ inf_ttrace_him (int pid)
 }
 
 static void
-inf_ttrace_create_inferior (char *exec_file, char *allargs, char **env,
-			    int from_tty)
+inf_ttrace_create_inferior (struct target_ops *ops, char *exec_file, 
+			    char *allargs, char **env, int from_tty)
 {
   gdb_assert (inf_ttrace_num_lwps == 0);
   gdb_assert (inf_ttrace_num_lwps_in_syscall == 0);
@@ -641,7 +641,7 @@ inf_ttrace_create_inferior (char *exec_file, char *allargs, char **env,
 }
 
 static void
-inf_ttrace_mourn_inferior (void)
+inf_ttrace_mourn_inferior (struct target_ops *ops)
 {
   const int num_buckets = ARRAY_SIZE (inf_ttrace_page_dict.buckets);
   int bucket;
@@ -669,7 +669,7 @@ inf_ttrace_mourn_inferior (void)
 }
 
 static void
-inf_ttrace_attach (char *args, int from_tty)
+inf_ttrace_attach (struct target_ops *ops, char *args, int from_tty)
 {
   char *exec_file;
   pid_t pid;
@@ -726,7 +726,7 @@ inf_ttrace_attach (char *args, int from_tty)
 }
 
 static void
-inf_ttrace_detach (char *args, int from_tty)
+inf_ttrace_detach (struct target_ops *ops, char *args, int from_tty)
 {
   pid_t pid = ptid_get_pid (inferior_ptid);
   int sig = 0;
diff --git a/gdb/inferior.h b/gdb/inferior.h
index f53af8b..10ffb99 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -207,9 +207,9 @@ extern ptid_t procfs_first_available (void);
 
 /* From fork-child.c */
 
-extern void fork_inferior (char *, char *, char **,
-			   void (*)(void),
-			   void (*)(int), void (*)(void), char *);
+extern int fork_inferior (char *, char *, char **,
+			  void (*)(void),
+			  void (*)(int), void (*)(void), char *);
 
 
 extern void startup_inferior (int);
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 126f7dc..35ddee0 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1276,7 +1276,8 @@ lin_lwp_attach_lwp (ptid_t ptid)
 }
 
 static void
-linux_nat_create_inferior (char *exec_file, char *allargs, char **env,
+linux_nat_create_inferior (struct target_ops *ops, 
+			   char *exec_file, char *allargs, char **env,
 			   int from_tty)
 {
   int saved_async = 0;
@@ -1323,7 +1324,7 @@ linux_nat_create_inferior (char *exec_file, char *allargs, char **env,
     }
 #endif /* HAVE_PERSONALITY */
 
-  linux_ops->to_create_inferior (exec_file, allargs, env, from_tty);
+  linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty);
 
 #ifdef HAVE_PERSONALITY
   if (personality_set)
@@ -1341,14 +1342,14 @@ linux_nat_create_inferior (char *exec_file, char *allargs, char **env,
 }
 
 static void
-linux_nat_attach (char *args, int from_tty)
+linux_nat_attach (struct target_ops *ops, char *args, int from_tty)
 {
   struct lwp_info *lp;
   int status;
 
   /* FIXME: We should probably accept a list of process id's, and
      attach all of them.  */
-  linux_ops->to_attach (args, from_tty);
+  linux_ops->to_attach (ops, args, from_tty);
 
   if (!target_can_async_p ())
     {
@@ -1536,7 +1537,7 @@ detach_callback (struct lwp_info *lp, void *data)
 }
 
 static void
-linux_nat_detach (char *args, int from_tty)
+linux_nat_detach (struct target_ops *ops, char *args, int from_tty)
 {
   int pid;
   int status;
@@ -1577,7 +1578,7 @@ linux_nat_detach (char *args, int from_tty)
 
   pid = GET_PID (inferior_ptid);
   inferior_ptid = pid_to_ptid (pid);
-  linux_ops->to_detach (args, from_tty);
+  linux_ops->to_detach (ops, args, from_tty);
 
   if (target_can_async_p ())
     drain_queued_events (pid);
@@ -3121,7 +3122,7 @@ linux_nat_kill (void)
 }
 
 static void
-linux_nat_mourn_inferior (void)
+linux_nat_mourn_inferior (struct target_ops *ops)
 {
   /* Destroy LWP info; it's no longer valid.  */
   init_lwp_list ();
@@ -3131,7 +3132,7 @@ linux_nat_mourn_inferior (void)
       /* Normal case, no other forks available.  */
       if (target_can_async_p ())
 	linux_nat_async (NULL, 0);
-      linux_ops->to_mourn_inferior ();
+      linux_ops->to_mourn_inferior (ops);
     }
   else
     /* Multi-fork case.  The current inferior_ptid has exited, but
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 650cbaa..4597e29 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -780,11 +780,11 @@ detach_thread (ptid_t ptid)
 }
 
 static void
-thread_db_detach (char *args, int from_tty)
+thread_db_detach (struct target_ops *ops, char *args, int from_tty)
 {
   disable_thread_event_reporting ();
 
-  target_beneath->to_detach (args, from_tty);
+  target_beneath->to_detach (target_beneath, args, from_tty);
 
   /* Should this be done by detach_command?  */
   target_mourn_inferior ();
@@ -927,20 +927,20 @@ thread_db_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
 }
 
 static void
-thread_db_mourn_inferior (void)
+thread_db_mourn_inferior (struct target_ops *ops)
 {
   /* Forget about the child's process ID.  We shouldn't need it
      anymore.  */
   proc_handle.pid = 0;
 
-  target_beneath->to_mourn_inferior ();
+  target_beneath->to_mourn_inferior (target_beneath);
 
   /* Delete the old thread event breakpoints.  Do this after mourning
      the inferior, so that we don't try to uninsert them.  */
   remove_thread_event_breakpoints ();
 
   /* Detach thread_db target ops.  */
-  unpush_target (&thread_db_ops);
+  unpush_target (ops);
   using_thread_db = 0;
 }
 
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 69632f6..6c7ea09 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -851,7 +851,7 @@ monitor_close (int quitting)
    when you want to detach and do something else with your gdb.  */
 
 static void
-monitor_detach (char *args, int from_tty)
+monitor_detach (struct target_ops *ops, char *args, int from_tty)
 {
   pop_target ();		/* calls monitor_close to do the real work */
   if (from_tty)
@@ -1993,8 +1993,8 @@ monitor_kill (void)
 /* All we actually do is set the PC to the start address of exec_bfd.  */
 
 static void
-monitor_create_inferior (char *exec_file, char *args, char **env,
-			 int from_tty)
+monitor_create_inferior (struct target_ops *ops, char *exec_file,
+			 char *args, char **env, int from_tty)
 {
   if (args && (*args != '\000'))
     error (_("Args are not supported by the monitor."));
@@ -2010,7 +2010,7 @@ monitor_create_inferior (char *exec_file, char *args, char **env,
    instructions.  */
 
 static void
-monitor_mourn_inferior (void)
+monitor_mourn_inferior (struct target_ops *ops)
 {
   unpush_target (targ_ops);
   generic_mourn_inferior ();	/* Do all the proper things now */
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 028394b..cfbfb0f 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -508,7 +508,7 @@ procfs_can_run (void)
 
 /* Attach to process PID, then initialize for debugging it.  */
 static void
-procfs_attach (char *args, int from_tty)
+procfs_attach (struct target_ops *ops, char *args, int from_tty)
 {
   char *exec_file;
   int pid;
@@ -767,7 +767,7 @@ procfs_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int dowrite,
    on signals, etc.  We'd better not have left any breakpoints
    in the program or it'll die when it hits one.  */
 static void
-procfs_detach (char *args, int from_tty)
+procfs_detach (struct target_ops *ops, char *args, int from_tty)
 {
   int siggnal = 0;
 
@@ -897,7 +897,7 @@ procfs_resume (ptid_t ptid, int step, enum target_signal signo)
 }
 
 static void
-procfs_mourn_inferior (void)
+procfs_mourn_inferior (struct target_ops *ops)
 {
   if (!ptid_equal (inferior_ptid, null_ptid))
     {
@@ -972,8 +972,8 @@ breakup_args (char *scratch, char **argv)
 }
 
 static void
-procfs_create_inferior (char *exec_file, char *allargs, char **env,
-			int from_tty)
+procfs_create_inferior (struct target_ops *ops, char *exec_file,
+			char *allargs, char **env, int from_tty)
 {
   struct inheritance inherit;
   pid_t pid;
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 3551dd9..81c39a3 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -112,8 +112,8 @@
  */
 
 static void procfs_open (char *, int);
-static void procfs_attach (char *, int);
-static void procfs_detach (char *, int);
+static void procfs_attach (struct target_ops *, char *, int);
+static void procfs_detach (struct target_ops *, char *, int);
 static void procfs_resume (ptid_t, int, enum target_signal);
 static int procfs_can_run (void);
 static void procfs_stop (ptid_t);
@@ -123,8 +123,9 @@ static void procfs_store_registers (struct regcache *, int);
 static void procfs_notice_signals (ptid_t);
 static void procfs_prepare_to_store (struct regcache *);
 static void procfs_kill_inferior (void);
-static void procfs_mourn_inferior (void);
-static void procfs_create_inferior (char *, char *, char **, int);
+static void procfs_mourn_inferior (struct target_ops *ops);
+static void procfs_create_inferior (struct target_ops *, char *, 
+				    char *, char **, int);
 static ptid_t procfs_wait (ptid_t, struct target_waitstatus *);
 static int procfs_xfer_memory (CORE_ADDR, char *, int, int,
 			       struct mem_attrib *attrib,
@@ -3602,7 +3603,7 @@ procfs_debug_inferior (procinfo *pi)
 }
 
 static void
-procfs_attach (char *args, int from_tty)
+procfs_attach (struct target_ops *ops, char *args, int from_tty)
 {
   char *exec_file;
   int   pid;
@@ -3632,7 +3633,7 @@ procfs_attach (char *args, int from_tty)
 }
 
 static void
-procfs_detach (char *args, int from_tty)
+procfs_detach (struct target_ops *ops, char *args, int from_tty)
 {
   int sig = 0;
 
@@ -4853,7 +4854,7 @@ procfs_kill_inferior (void)
  */
 
 static void
-procfs_mourn_inferior (void)
+procfs_mourn_inferior (struct target_ops *ops)
 {
   procinfo *pi;
 
@@ -5113,8 +5114,8 @@ procfs_set_exec_trap (void)
  */
 
 static void
-procfs_create_inferior (char *exec_file, char *allargs, char **env,
-			int from_tty)
+procfs_create_inferior (struct target_ops *ops, char *exec_file,
+			char *allargs, char **env, int from_tty)
 {
   char *shell_file = getenv ("SHELL");
   char *tryname;
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index 1caff52..815abb6 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -316,7 +316,8 @@ check_mmu_status (void)
 /* This is called not only when we first attach, but also when the
    user types "run" after having attached.  */
 static void
-m32r_create_inferior (char *execfile, char *args, char **env, int from_tty)
+m32r_create_inferior (struct target_ops *ops, char *execfile,
+		      char *args, char **env, int from_tty)
 {
   CORE_ADDR entry_pt;
 
@@ -872,7 +873,7 @@ m32r_wait (ptid_t ptid, struct target_waitstatus *status)
    Use this when you want to detach and do something else
    with your gdb.  */
 static void
-m32r_detach (char *args, int from_tty)
+m32r_detach (struct target_ops *ops, char *args, int from_tty)
 {
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "m32r_detach(%d)\n", from_tty);
@@ -1147,7 +1148,7 @@ m32r_kill (void)
    instructions.  */
 
 static void
-m32r_mourn_inferior (void)
+m32r_mourn_inferior (struct target_ops *ops)
 {
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "m32r_mourn_inferior()\n");
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index df17051..d49e308 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -84,7 +84,7 @@ static void lsi_open (char *name, int from_tty);
 
 static void mips_close (int quitting);
 
-static void mips_detach (char *args, int from_tty);
+static void mips_detach (struct target_ops *ops, char *args, int from_tty);
 
 static void mips_resume (ptid_t ptid, int step,
                          enum target_signal siggnal);
@@ -1653,7 +1653,7 @@ mips_close (int quitting)
 /* Detach from the remote board.  */
 
 static void
-mips_detach (char *args, int from_tty)
+mips_detach (struct target_ops *ops, char *args, int from_tty)
 {
   if (args)
     error ("Argument given to \"detach\" when remotely debugging.");
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 9d014e1..c1917a7 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -84,7 +84,7 @@ static void gdbsim_open (char *args, int from_tty);
 
 static void gdbsim_close (int quitting);
 
-static void gdbsim_detach (char *args, int from_tty);
+static void gdbsim_detach (struct target_ops *ops, char *args, int from_tty);
 
 static void gdbsim_resume (ptid_t ptid, int step, enum target_signal siggnal);
 
@@ -603,7 +603,7 @@ gdbsim_close (int quitting)
    Use this when you want to detach and do something else with your gdb.  */
 
 static void
-gdbsim_detach (char *args, int from_tty)
+gdbsim_detach (struct target_ops *ops, char *args, int from_tty)
 {
   if (remote_debug)
     printf_filtered ("gdbsim_detach: args \"%s\"\n", args);
diff --git a/gdb/remote.c b/gdb/remote.c
index af3b0b8..43d1a3b 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -102,11 +102,11 @@ static void remote_close (int quitting);
 
 static void remote_store_registers (struct regcache *regcache, int regno);
 
-static void remote_mourn (void);
+static void remote_mourn (struct target_ops *ops);
 
 static void extended_remote_restart (void);
 
-static void extended_remote_mourn (void);
+static void extended_remote_mourn (struct target_ops *);
 
 static void remote_mourn_1 (struct target_ops *);
 
@@ -130,7 +130,7 @@ static void remote_async (void (*callback) (enum inferior_event_type event_type,
 
 static int remote_async_mask (int new_mask);
 
-static void remote_detach (char *args, int from_tty);
+static void remote_detach (struct target_ops *ops, char *args, int from_tty);
 
 static void remote_interrupt (int signo);
 
@@ -2905,13 +2905,13 @@ remote_detach_1 (char *args, int from_tty, int extended)
 }
 
 static void
-remote_detach (char *args, int from_tty)
+remote_detach (struct target_ops *ops, char *args, int from_tty)
 {
   remote_detach_1 (args, from_tty, 0);
 }
 
 static void
-extended_remote_detach (char *args, int from_tty)
+extended_remote_detach (struct target_ops *ops, char *args, int from_tty)
 {
   remote_detach_1 (args, from_tty, 1);
 }
@@ -3002,9 +3002,9 @@ extended_remote_attach_1 (struct target_ops *target, char *args, int from_tty)
 }
 
 static void
-extended_remote_attach (char *args, int from_tty)
+extended_remote_attach (struct target_ops *ops, char *args, int from_tty)
 {
-  extended_remote_attach_1 (&extended_remote_ops, args, from_tty);
+  extended_remote_attach_1 (ops, args, from_tty);
 }
 
 /* Convert hex digit A to a number.  */
@@ -5187,9 +5187,9 @@ remote_kill (void)
 }
 
 static void
-remote_mourn (void)
+remote_mourn (struct target_ops *ops)
 {
-  remote_mourn_1 (&remote_ops);
+  remote_mourn_1 (ops);
 }
 
 /* Worker function for remote_mourn.  */
@@ -5233,9 +5233,9 @@ extended_remote_mourn_1 (struct target_ops *target)
 }
 
 static void
-extended_remote_mourn (void)
+extended_remote_mourn (struct target_ops *ops)
 {
-  extended_remote_mourn_1 (&extended_remote_ops);
+  extended_remote_mourn_1 (ops);
 }
 
 static int
@@ -5347,7 +5347,8 @@ extended_remote_create_inferior_1 (char *exec_file, char *args,
 }
 
 static void
-extended_remote_create_inferior (char *exec_file, char *args,
+extended_remote_create_inferior (struct target_ops *ops, 
+				 char *exec_file, char *args,
 				 char **env, int from_tty)
 {
   extended_remote_create_inferior_1 (exec_file, args, env, from_tty);
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 27632d3..6501def 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -966,17 +966,18 @@ vmap_exec (void)
 /* Set the current architecture from the host running GDB.  Called when
    starting a child process. */
 
-static void (*super_create_inferior) (char *exec_file, char *allargs,
-				      char **env, int from_tty);
+static void (*super_create_inferior) (struct target_ops *,char *exec_file, 
+				      char *allargs, char **env, int from_tty);
 static void
-rs6000_create_inferior (char *exec_file, char *allargs, char **env, int from_tty)
+rs6000_create_inferior (struct target_ops * ops, char *exec_file,
+			char *allargs, char **env, int from_tty)
 {
   enum bfd_architecture arch;
   unsigned long mach;
   bfd abfd;
   struct gdbarch_info info;
 
-  super_create_inferior (exec_file, allargs, env, from_tty);
+  super_create_inferior (ops, exec_file, allargs, env, from_tty);
 
   if (__power_rs ())
     {
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index ab7ec5d..ea10a6a 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -348,9 +348,9 @@ sol_thread_open (char *arg, int from_tty)
    for the trace-trap that results from attaching.  */
 
 static void
-sol_thread_attach (char *args, int from_tty)
+sol_thread_attach (struct target_ops *ops, char *args, int from_tty)
 {
-  procfs_ops.to_attach (args, from_tty);
+  procfs_ops.to_attach (&procfs_ops, args, from_tty);
 
   /* Must get symbols from shared libraries before libthread_db can run!  */
   solib_add (NULL, from_tty, (struct target_ops *) 0, auto_solib_add);
@@ -379,11 +379,11 @@ sol_thread_attach (char *args, int from_tty)
    program was started via the normal ptrace (PTRACE_TRACEME).  */
 
 static void
-sol_thread_detach (char *args, int from_tty)
+sol_thread_detach (struct target_ops *ops, char *args, int from_tty)
 {
   inferior_ptid = pid_to_ptid (PIDGET (main_ph.ptid));
   unpush_target (&sol_thread_ops);
-  procfs_ops.to_detach (args, from_tty);
+  procfs_ops.to_detach (&procfs_ops, args, from_tty);
 }
 
 /* Resume execution of process PTID.  If STEP is nozero, then just
@@ -751,10 +751,10 @@ sol_thread_notice_signals (ptid_t ptid)
 /* Fork an inferior process, and start debugging it with /proc.  */
 
 static void
-sol_thread_create_inferior (char *exec_file, char *allargs, char **env,
-			    int from_tty)
+sol_thread_create_inferior (struct target_ops *ops, char *exec_file,
+			    char *allargs, char **env, int from_tty)
 {
-  procfs_ops.to_create_inferior (exec_file, allargs, env, from_tty);
+  procfs_ops.to_create_inferior (&procfs_ops, exec_file, allargs, env, from_tty);
 
   if (sol_thread_active && !ptid_equal (inferior_ptid, null_ptid))
     {
@@ -820,10 +820,10 @@ sol_thread_new_objfile (struct objfile *objfile)
 /* Clean up after the inferior dies.  */
 
 static void
-sol_thread_mourn_inferior (void)
+sol_thread_mourn_inferior (struct target_ops *ops)
 {
   unpush_target (&sol_thread_ops);
-  procfs_ops.to_mourn_inferior ();
+  procfs_ops.to_mourn_inferior (&procfs_ops);
 }
 
 /* Mark our target-struct as eligible for stray "run" and "attach"
@@ -1408,10 +1408,10 @@ sol_core_close (int quitting)
 }
 
 static void
-sol_core_detach (char *args, int from_tty)
+sol_core_detach (struct target_ops *ops, char *args, int from_tty)
 {
   unpush_target (&core_ops);
-  orig_core_ops.to_detach (args, from_tty);
+  orig_core_ops.to_detach (&orig_core_ops, args, from_tty);
 }
 
 static void
diff --git a/gdb/target.c b/gdb/target.c
index 1f65819..464c190 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -99,9 +99,9 @@ static void debug_to_open (char *, int);
 
 static void debug_to_close (int);
 
-static void debug_to_attach (char *, int);
+static void debug_to_attach (struct target_ops *ops, char *, int);
 
-static void debug_to_detach (char *, int);
+static void debug_to_detach (struct target_ops *ops, char *, int);
 
 static void debug_to_resume (ptid_t, int, enum target_signal);
 
@@ -156,7 +156,7 @@ static void debug_to_load (char *, int);
 
 static int debug_to_lookup_symbol (char *, CORE_ADDR *);
 
-static void debug_to_mourn_inferior (void);
+static void debug_to_mourn_inferior (struct target_ops *);
 
 static int debug_to_can_run (void);
 
@@ -286,6 +286,24 @@ target_load (char *arg, int from_tty)
   (*current_target.to_load) (arg, from_tty);
 }
 
+void target_create_inferior (char *exec_file, char *args,
+			     char **env, int from_tty)
+{
+  struct target_ops *t;
+  for (t = current_target.beneath; t != NULL; t = t->beneath)
+    {
+      if (t->to_create_inferior != NULL)	
+	{
+	  t->to_create_inferior (t, exec_file, args, env, from_tty);
+	  return;
+	}
+    }
+
+  internal_error (__FILE__, __LINE__,
+		  "could not find a target to create inferior");
+}
+
+
 static int
 nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
 	  struct target_ops *t)
@@ -387,10 +405,10 @@ update_current_target (void)
       INHERIT (to_doc, t);
       INHERIT (to_open, t);
       INHERIT (to_close, t);
-      INHERIT (to_attach, t);
+      /* Do not inherit to_attach.  */
       INHERIT (to_post_attach, t);
       INHERIT (to_attach_no_wait, t);
-      INHERIT (to_detach, t);
+      /* Do not inherit to_detach.  */
       /* Do not inherit to_disconnect.  */
       INHERIT (to_resume, t);
       INHERIT (to_wait, t);
@@ -421,7 +439,7 @@ update_current_target (void)
       INHERIT (to_kill, t);
       INHERIT (to_load, t);
       INHERIT (to_lookup_symbol, t);
-      INHERIT (to_create_inferior, t);
+      /* Do no inherit to_create_inferior.  */
       INHERIT (to_post_startup_inferior, t);
       INHERIT (to_acknowledge_created_inferior, t);
       INHERIT (to_insert_fork_catchpoint, t);
@@ -432,7 +450,7 @@ update_current_target (void)
       INHERIT (to_insert_exec_catchpoint, t);
       INHERIT (to_remove_exec_catchpoint, t);
       INHERIT (to_has_exited, t);
-      INHERIT (to_mourn_inferior, t);
+      /* Do no inherit to_mourn_inferiour.  */
       INHERIT (to_can_run, t);
       INHERIT (to_notice_signals, t);
       INHERIT (to_thread_alive, t);
@@ -486,9 +504,6 @@ update_current_target (void)
   de_fault (to_post_attach,
 	    (void (*) (int))
 	    target_ignore);
-  de_fault (to_detach,
-	    (void (*) (char *, int))
-	    target_ignore);
   de_fault (to_resume,
 	    (void (*) (ptid_t, int, enum target_signal))
 	    noprocess);
@@ -592,9 +607,6 @@ update_current_target (void)
   de_fault (to_has_exited,
 	    (int (*) (int, int, int *))
 	    return_zero);
-  de_fault (to_mourn_inferior,
-	    (void (*) (void))
-	    noprocess);
   de_fault (to_can_run,
 	    return_zero);
   de_fault (to_notice_signals,
@@ -1769,11 +1781,22 @@ target_preopen (int from_tty)
 void
 target_detach (char *args, int from_tty)
 {
+  struct target_ops *t;
+
   /* If we're in breakpoints-always-inserted mode, have to
      remove them before detaching.  */
   remove_breakpoints ();
 
-  (current_target.to_detach) (args, from_tty);
+  for (t = current_target.beneath; t != NULL; t = t->beneath)
+    {
+      if (t->to_detach != NULL)
+	{
+	  t->to_detach (t, args, from_tty);
+	  return;
+	}
+    }
+
+  internal_error (__FILE__, __LINE__, "could not find a target to detach");
 }
 
 void
@@ -1831,6 +1854,23 @@ target_follow_fork (int follow_child)
 		  "could not find a target to follow fork");
 }
 
+void
+target_mourn_inferior (void)
+{
+  struct target_ops *t;
+  for (t = current_target.beneath; t != NULL; t = t->beneath)
+    {
+      if (t->to_mourn_inferior != NULL)	
+	{
+	  t->to_mourn_inferior (t);
+	  return;
+	}
+    }
+
+  internal_error (__FILE__, __LINE__,
+		  "could not find a target to follow mourn inferiour");
+}
+
 /* Look for a target which can describe architectural features, starting
    from TARGET.  If we find one, return its description.  */
 
@@ -2076,23 +2116,24 @@ find_default_run_target (char *do_mesg)
 }
 
 void
-find_default_attach (char *args, int from_tty)
+find_default_attach (struct target_ops *ops, char *args, int from_tty)
 {
   struct target_ops *t;
 
   t = find_default_run_target ("attach");
-  (t->to_attach) (args, from_tty);
+  (t->to_attach) (t, args, from_tty);
   return;
 }
 
 void
-find_default_create_inferior (char *exec_file, char *allargs, char **env,
+find_default_create_inferior (struct target_ops *ops,
+			      char *exec_file, char *allargs, char **env,
 			      int from_tty)
 {
   struct target_ops *t;
 
   t = find_default_run_target ("run");
-  (t->to_create_inferior) (exec_file, allargs, env, from_tty);
+  (t->to_create_inferior) (t, exec_file, allargs, env, from_tty);
   return;
 }
 
@@ -2420,6 +2461,8 @@ init_dummy_target (void)
   dummy_target.to_longname = "None";
   dummy_target.to_doc = "";
   dummy_target.to_attach = find_default_attach;
+  dummy_target.to_detach = 
+    (void (*)(struct target_ops *, char *, int))target_ignore;
   dummy_target.to_create_inferior = find_default_create_inferior;
   dummy_target.to_can_async_p = find_default_can_async_p;
   dummy_target.to_is_async_p = find_default_is_async_p;
@@ -2456,10 +2499,28 @@ target_close (struct target_ops *targ, int quitting)
     targ->to_close (quitting);
 }
 
+void
+target_attach (char *args, int from_tty)
+{
+  struct target_ops *t;
+  for (t = current_target.beneath; t != NULL; t = t->beneath)
+    {
+      if (t->to_attach != NULL)	
+	{
+	  t->to_attach (t, args, from_tty);
+	  return;
+	}
+    }
+
+  internal_error (__FILE__, __LINE__,
+		  "could not find a target to attach");
+}
+
+
 static void
-debug_to_attach (char *args, int from_tty)
+debug_to_attach (struct target_ops *ops, char *args, int from_tty)
 {
-  debug_target.to_attach (args, from_tty);
+  debug_target.to_attach (&debug_target, args, from_tty);
 
   fprintf_unfiltered (gdb_stdlog, "target_attach (%s, %d)\n", args, from_tty);
 }
@@ -2474,9 +2535,9 @@ debug_to_post_attach (int pid)
 }
 
 static void
-debug_to_detach (char *args, int from_tty)
+debug_to_detach (struct target_ops *ops, char *args, int from_tty)
 {
-  debug_target.to_detach (args, from_tty);
+  debug_target.to_detach (&debug_target, args, from_tty);
 
   fprintf_unfiltered (gdb_stdlog, "target_detach (%s, %d)\n", args, from_tty);
 }
@@ -2880,10 +2941,11 @@ debug_to_lookup_symbol (char *name, CORE_ADDR *addrp)
 }
 
 static void
-debug_to_create_inferior (char *exec_file, char *args, char **env,
+debug_to_create_inferior (struct target_ops *ops,
+			  char *exec_file, char *args, char **env,
 			  int from_tty)
 {
-  debug_target.to_create_inferior (exec_file, args, env, from_tty);
+  debug_target.to_create_inferior (ops, exec_file, args, env, from_tty);
 
   fprintf_unfiltered (gdb_stdlog, "target_create_inferior (%s, %s, xxx, %d)\n",
 		      exec_file, args, from_tty);
@@ -2987,9 +3049,9 @@ debug_to_has_exited (int pid, int wait_status, int *exit_status)
 }
 
 static void
-debug_to_mourn_inferior (void)
+debug_to_mourn_inferior (struct target_ops *ops)
 {
-  debug_target.to_mourn_inferior ();
+  debug_target.to_mourn_inferior (&debug_target);
 
   fprintf_unfiltered (gdb_stdlog, "target_mourn_inferior ()\n");
 }
diff --git a/gdb/target.h b/gdb/target.h
index 067c031..a9e7f67 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -323,9 +323,9 @@ struct target_ops
        to xfree everything (including the "struct target_ops").  */
     void (*to_xclose) (struct target_ops *targ, int quitting);
     void (*to_close) (int);
-    void (*to_attach) (char *, int);
+    void (*to_attach) (struct target_ops *ops, char *, int);
     void (*to_post_attach) (int);
-    void (*to_detach) (char *, int);
+    void (*to_detach) (struct target_ops *ops, char *, int);
     void (*to_disconnect) (struct target_ops *, char *, int);
     void (*to_resume) (ptid_t, int, enum target_signal);
     ptid_t (*to_wait) (ptid_t, struct target_waitstatus *);
@@ -383,7 +383,8 @@ struct target_ops
     void (*to_kill) (void);
     void (*to_load) (char *, int);
     int (*to_lookup_symbol) (char *, CORE_ADDR *);
-    void (*to_create_inferior) (char *, char *, char **, int);
+    void (*to_create_inferior) (struct target_ops *, 
+				char *, char *, char **, int);
     void (*to_post_startup_inferior) (ptid_t);
     void (*to_acknowledge_created_inferior) (int);
     void (*to_insert_fork_catchpoint) (int);
@@ -394,7 +395,7 @@ struct target_ops
     void (*to_insert_exec_catchpoint) (int);
     int (*to_remove_exec_catchpoint) (int);
     int (*to_has_exited) (int, int, int *);
-    void (*to_mourn_inferior) (void);
+    void (*to_mourn_inferior) (struct target_ops *);
     int (*to_can_run) (void);
     void (*to_notice_signals) (ptid_t ptid);
     int (*to_thread_alive) (ptid_t ptid);
@@ -563,8 +564,7 @@ void target_close (struct target_ops *targ, int quitting);
    should be ready to deliver the status of the process immediately
    (without waiting) to an upcoming target_wait call.  */
 
-#define	target_attach(args, from_tty)	\
-     (*current_target.to_attach) (args, from_tty)
+void target_attach (char *, int);
 
 /* Some targets don't generate traps when attaching to the inferior,
    or their target_attach implementation takes care of the waiting.
@@ -808,9 +808,8 @@ extern void target_load (char *arg, int from_tty);
    ENV is the environment vector to pass.  Errors reported with error().
    On VxWorks and various standalone systems, we ignore exec_file.  */
 
-#define	target_create_inferior(exec_file, args, env, FROM_TTY)	\
-     (*current_target.to_create_inferior) (exec_file, args, env, (FROM_TTY))
-
+void target_create_inferior (char *exec_file, char *args,
+			     char **env, int from_tty);
 
 /* Some targets (such as ttrace-based HPUX) don't allow us to request
    notification of inferior events such as fork and vork immediately
@@ -880,8 +879,7 @@ int target_follow_fork (int follow_child);
 
 /* The inferior process has died.  Do what is right.  */
 
-#define	target_mourn_inferior()	\
-     (*current_target.to_mourn_inferior) ()
+void target_mourn_inferior (void);
 
 /* Does target have enough data to do a run or attach command? */
 
@@ -1238,9 +1236,10 @@ extern void noprocess (void);
 
 extern void target_require_runnable (void);
 
-extern void find_default_attach (char *, int);
+extern void find_default_attach (struct target_ops *, char *, int);
 
-extern void find_default_create_inferior (char *, char *, char **, int);
+extern void find_default_create_inferior (struct target_ops *,
+					  char *, char *, char **, int);
 
 extern struct target_ops *find_run_target (void);
 
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index e84214d..91c7a38 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -1670,7 +1670,7 @@ out:
 
 /* Attach to process PID, then initialize for debugging it.  */
 static void
-win32_attach (char *args, int from_tty)
+win32_attach (struct target_ops *ops, char *args, int from_tty)
 {
   BOOL ok;
   DWORD pid;
@@ -1728,7 +1728,7 @@ win32_attach (char *args, int from_tty)
 }
 
 static void
-win32_detach (char *args, int from_tty)
+win32_detach (struct target_ops *ops, char *args, int from_tty)
 {
   int detached = 1;
 
@@ -1805,8 +1805,8 @@ win32_open (char *arg, int from_tty)
    ENV is the environment vector to pass.  Errors reported with error().  */
 
 static void
-win32_create_inferior (char *exec_file, char *allargs, char **in_env,
-		       int from_tty)
+win32_create_inferior (struct target_ops *ops, char *exec_file,
+		       char *allargs, char **in_env, int from_tty)
 {
   STARTUPINFO si;
   PROCESS_INFORMATION pi;
@@ -1935,7 +1935,7 @@ win32_create_inferior (char *exec_file, char *allargs, char **in_env,
 }
 
 static void
-win32_mourn_inferior (void)
+win32_mourn_inferior (struct target_ops *ops)
 {
   (void) win32_continue (DBG_CONTINUE, -1);
   i386_cleanup_dregs();
-- 
1.5.3.5


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Kill ptrace_ops_hack
  2008-08-19 17:34 [RFA] Kill ptrace_ops_hack Vladimir Prus
@ 2008-09-13 15:34 ` Daniel Jacobowitz
  2008-09-18  0:57 ` Joel Brobecker
  1 sibling, 0 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2008-09-13 15:34 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches

On Tue, Aug 19, 2008 at 09:33:34PM +0400, Vladimir Prus wrote:
> 
> This is the complete patch to kill ptrace_ops_hack. The approach is
> outlined at http://permalink.gmane.org/gmane.comp.gdb.patches/43085
> is involves adding 'struct target_ops *' parameter to enough target
> methods to make ptrace_ops_hack unnecessary.
> 
> This patch mechanically adjusts all other targets to the changes,
> but does not try to make those target take advantage of the new
> parameter. It appears there there's a lot of target that have a 
> static variable poiting either to themself, or to the target beneath,
> and each such target probably should be fixed individually, but somebody
> who can test on this target.
> 
> OK?

Yes, this is OK.  Thanks for cleaning this up!

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Kill ptrace_ops_hack
  2008-08-19 17:34 [RFA] Kill ptrace_ops_hack Vladimir Prus
  2008-09-13 15:34 ` Daniel Jacobowitz
@ 2008-09-18  0:57 ` Joel Brobecker
  2008-11-04 10:20   ` Vladimir Prus
  1 sibling, 1 reply; 9+ messages in thread
From: Joel Brobecker @ 2008-09-18  0:57 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches

Looks like the following patch was approved, but hasn't been checked in.
> 
> 	* target.h (struct target_ops): Make to_attach, to_detach,
> 	to_create_inferior and to_mourn_inferior accept a pointer
> 	to struct target_ops.
> 	(target_attach, target_create_inferior, target_create_inferior):
> 	Convert from macros to function.  Find the right target to
> 	invoke a method of.
> 	(find_default_attach, find_default_create_inferior): New parameter
> 	ops.
> 	* corefile.c (core_file_command): Pass target to to_detach.
> 	* corelow.c (core_detach): Add 'ops' parameter.
> 	* fork-child.c (fork_inferior): Return the pid.  Allow
> 	init_trace_fun to be NULL.
> 	* inf-ptrace (ptrace_ops_hack): Remove.
> 	(inf_ptrace_him): Remove, moving all logic into....
> 	(inf_ptrace_create_inferior): ... here.  Push the target
> 	passed as parameter.

Just noticed a minor thing:

  -  push_target (ptrace_ops_hack);
  +  int pid = fork_inferior (exec_file, allargs, env, inf_ptrace_me, NULL,
  +                          NULL, NULL);
  +
  +  push_target (ops);

Mark mentioned that he would prefer to have:

   int pid;

   pid = fork_inferior (...)

I have been hoping to contribute a couple of things, which include
thread support on Tru64. Hopefully I will get to that soon, and if
I beat to checking my patch in, you'll have to fix one extra file
(just teasing you :-).

-- 
Joel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Kill ptrace_ops_hack
  2008-09-18  0:57 ` Joel Brobecker
@ 2008-11-04 10:20   ` Vladimir Prus
  2008-11-05 13:32     ` Joel Brobecker
  2008-11-11 22:51     ` Thiago Jung Bauermann
  0 siblings, 2 replies; 9+ messages in thread
From: Vladimir Prus @ 2008-11-04 10:20 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1800 bytes --]

On Thursday 18 September 2008 04:57:19 Joel Brobecker wrote:
> Looks like the following patch was approved, but hasn't been checked in.
> > 
> > 	* target.h (struct target_ops): Make to_attach, to_detach,
> > 	to_create_inferior and to_mourn_inferior accept a pointer
> > 	to struct target_ops.
> > 	(target_attach, target_create_inferior, target_create_inferior):
> > 	Convert from macros to function.  Find the right target to
> > 	invoke a method of.
> > 	(find_default_attach, find_default_create_inferior): New parameter
> > 	ops.
> > 	* corefile.c (core_file_command): Pass target to to_detach.
> > 	* corelow.c (core_detach): Add 'ops' parameter.
> > 	* fork-child.c (fork_inferior): Return the pid.  Allow
> > 	init_trace_fun to be NULL.
> > 	* inf-ptrace (ptrace_ops_hack): Remove.
> > 	(inf_ptrace_him): Remove, moving all logic into....
> > 	(inf_ptrace_create_inferior): ... here.  Push the target
> > 	passed as parameter.
> 
> Just noticed a minor thing:
> 
>   -  push_target (ptrace_ops_hack);
>   +  int pid = fork_inferior (exec_file, allargs, env, inf_ptrace_me, NULL,
>   +                          NULL, NULL);
>   +
>   +  push_target (ops);
> 
> Mark mentioned that he would prefer to have:
> 
>    int pid;
> 
>    pid = fork_inferior (...)

I've made this change.

> 
> I have been hoping to contribute a couple of things, which include
> thread support on Tru64. Hopefully I will get to that soon, and if
> I beat to checking my patch in, you'll have to fix one extra file
> (just teasing you :-).

I've finally got back to this patch. I attach revised version that
differs only by handling dec-thread.c, in addition to other target
is previously used to handle. Would you like to verify this
patch does not break Tru64, or I can commit it right away?

Thanks,
Volodya






[-- Attachment #2: ptrace_hack.diff --]
[-- Type: text/x-diff, Size: 47253 bytes --]

commit a8689b72f892ac85f2f4e0eb0caa5b5c236be568
Author: Vladimir Prus <vladimir@codesourcery.com>
Date:   Fri Aug 15 16:38:44 2008 +0400

    Kill pthread_ops_hack
    
    	* target.h (struct target_ops): Make to_attach, to_detach,
    	to_create_inferior and to_mourn_inferior accept a pointer
    	to struct target_ops.
    	(target_attach, target_create_inferior, target_create_inferior):
    	Convert from macros to function.  Find the right target to
    	invoke a method of.
    	(find_default_attach, find_default_create_inferior): New parameter
    	ops.
    	* corefile.c (core_file_command): Pass target to to_detach.
    	* corelow.c (core_detach): Add 'ops' parameter.
    	* fork-child.c (fork_inferior): Return the pid.  Allow
    	init_trace_fun to be NULL.
    	* inf-ptrace (ptrace_ops_hack): Remove.
    	(inf_ptrace_him): Remove, moving all logic into....
    	(inf_ptrace_create_inferior): ... here.  Push the target
    	passed as parameter.
    	(inf_ptrace_mourn_inferior, inf_ptrace_attach, inf_ptrace_detach):
    	Push/pop target passed as parameter, no ptrace_ops_hack.
    	(inf_ptrace_target): Don't remember result.
    	* inferior.h (fork_inferior): Adjust prototype.
    	* linux-nat.c (linux_nat_create_inferior, linux_nat_attach)
    	(linux_nat_detach, linux_nat_mourn_inferior): New parameter ops.
    	Pass it to linux_ops target.
    	* linux-thread-db.c (thread_db_detach, thread_db_mourn_inferior):
    	New parameter ops. Pass it to the target beneath.
    	* remote.c (remote_mourn, extended_remote_mourn, remote_detach)
    	(extended_remote_create_inferior): New parameter ops. Pass it
    	further.
    	* target.c (debug_to_attach, debug_to_detach)
    	(debug_to_mourn_inferior): New parameter ops.
    	(target_create_inferior): New.
    	(update_current_target): Do not inherit to_attach, to_detach,
    	to_create_inferiour, to_mourn_inferior.  Do not default
    	to_detach and to_mourn_inferior.
    	(target_detach): Find the right target to use.
    	(target_mourn_inferior): New.
    	(find_default_attach, find_default_create_inferior): New parameter
    	ops.  Pass the found target when calling its method.
    	(init_dummy_target): Provide fallback definition of to_detach.
    	(target_attach): New.
    	(debug_to_attach, debug_to_detach, debug_to_create_inferior)
    	(debug_to_mourn_inferiour): New parameter ops.
            * aix-thread.c: Adjust.
            * bsd-uthread.c: Adjust.
            * gnu-nat.c: Adjust.
            * go32-nat.c: Adjust.
            * hpux-thread.c: Adjust.
            * inf-ttrace.c: Ajust.
            * monitor.c: Adjust.
            * nto-procfs.c: Adjust.
            * procfs.c: Adjust.
            * remote-m32r-sdi.c: Adjust.
            * remote-mips.c: Adjust.
            * remote-sim.c: Adjust.
            * rs6000-nat.c: Adjust.
            * sol-thread.c: Adjust.
            * win32-nat.c: Adjust.
    	* dec-thread.c: Adjust.

diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 3377d50..5514094 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -938,19 +938,19 @@ new_objfile (struct objfile *objfile)
 /* Attach to process specified by ARGS.  */
 
 static void
-aix_thread_attach (char *args, int from_tty)
+aix_thread_attach (struct target_ops *ops, char *args, int from_tty)
 {
-  base_target.to_attach (args, from_tty);
+  base_target.to_attach (&base_target, args, from_tty);
   pd_activate (1);
 }
 
 /* Detach from the process attached to by aix_thread_attach().  */
 
 static void
-aix_thread_detach (char *args, int from_tty)
+aix_thread_detach (struct target_ops *ops, char *args, int from_tty)
 {
   pd_disable ();
-  base_target.to_detach (args, from_tty);
+  base_target.to_detach (&base_target, args, from_tty);
 }
 
 /* Tell the inferior process to continue running thread PID if != -1
@@ -1667,10 +1667,10 @@ aix_thread_kill (void)
 /* Clean up after the inferior exits.  */
 
 static void
-aix_thread_mourn_inferior (void)
+aix_thread_mourn_inferior (struct target_ops *ops)
 {
   pd_deactivate ();
-  base_target.to_mourn_inferior ();
+  base_target.to_mourn_inferior (&base_target);
 }
 
 /* Return whether thread PID is still valid.  */
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 59853ce..f38c825 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -270,9 +270,10 @@ bsd_uthread_solib_unloaded (struct so_list *so)
 }
 
 static void
-bsd_uthread_mourn_inferior (void)
+bsd_uthread_mourn_inferior (struct target_ops *ops)
 {
-  find_target_beneath (bsd_uthread_ops_hack)->to_mourn_inferior ();
+  struct target_ops *beneath = find_target_beneath (bsd_uthread_ops_hack);
+  beneath->to_mourn_inferior (beneath);
   bsd_uthread_deactivate ();
 }
 
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 2be4e26..af2d1a3 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -74,7 +74,7 @@ core_file_command (char *filename, int from_tty)
     error (_("GDB can't read core files on this machine."));
 
   if (!filename)
-    (t->to_detach) (filename, from_tty);
+    (t->to_detach) (t, filename, from_tty);
   else
     (t->to_open) (filename, from_tty);
 }
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 14868e2..35c998c 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -75,7 +75,7 @@ static int gdb_check_format (bfd *);
 
 static void core_open (char *, int);
 
-static void core_detach (char *, int);
+static void core_detach (struct target_ops *ops, char *, int);
 
 static void core_close (int);
 
@@ -413,11 +413,11 @@ core_open (char *filename, int from_tty)
 }
 
 static void
-core_detach (char *args, int from_tty)
+core_detach (struct target_ops *ops, char *args, int from_tty)
 {
   if (args)
     error (_("Too many arguments"));
-  unpush_target (&core_ops);
+  unpush_target (ops);
   reinit_frame_cache ();
   if (from_tty)
     printf_filtered (_("No core file now.\n"));
diff --git a/gdb/dec-thread.c b/gdb/dec-thread.c
index 7f26166..3de06ed 100644
--- a/gdb/dec-thread.c
+++ b/gdb/dec-thread.c
@@ -429,7 +429,7 @@ dec_thread_detach (char *args, int from_tty)
   debug ("dec_thread_detach");
 
   disable_dec_thread ();
-  base_target.to_detach (args, from_tty);
+  base_target.to_detach (&base_target, args, from_tty);
 }
 
 /* Return the ptid of the thread that is currently active.  */
@@ -605,7 +605,7 @@ dec_thread_mourn_inferior (void)
   debug ("dec_thread_mourn_inferior");
 
   disable_dec_thread ();
-  base_target.to_mourn_inferior ();
+  base_target.to_mourn_inferior (&base_target);
 }
 
 /* The "to_thread_alive" method of the dec_thread_ops.  */
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index ec6d8cf..75b9d4e 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -118,7 +118,7 @@ escape_bang_in_quoted_argument (const char *shell_file)
 /* This function is NOT reentrant.  Some of the variables have been
    made static to ensure that they survive the vfork call.  */
 
-void
+int
 fork_inferior (char *exec_file_arg, char *allargs, char **env,
 	       void (*traceme_fun) (void), void (*init_trace_fun) (int),
 	       void (*pre_trace_fun) (void), char *shell_file_arg)
@@ -408,11 +408,13 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
   /* Now that we have a child process, make it our target, and
      initialize anything target-vector-specific that needs
      initializing.  */
-  (*init_trace_fun) (pid);
+  if (init_trace_fun)
+    (*init_trace_fun) (pid);
 
   /* We are now in the child process of interest, having exec'd the
      correct program, and are poised at the first instruction of the
      new program.  */
+  return pid;
 }
 
 /* Accept NTRAPS traps from the inferior.  */
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 0ebdfe8..56a8b1f 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2042,7 +2042,7 @@ gnu_kill_inferior (void)
 
 /* Clean up after the inferior dies.  */
 static void
-gnu_mourn_inferior (void)
+gnu_mourn_inferior (struct target_ops *ops)
 {
   inf_debug (gnu_current_inf, "rip");
   inf_detach (gnu_current_inf);
@@ -2074,7 +2074,8 @@ cur_inf (void)
 }
 
 static void
-gnu_create_inferior (char *exec_file, char *allargs, char **env,
+gnu_create_inferior (struct target_ops *ops, 
+		     char *exec_file, char *allargs, char **env,
 		     int from_tty)
 {
   struct inf *inf = cur_inf ();
@@ -2139,7 +2140,7 @@ gnu_can_run (void)
 /* Attach to process PID, then initialize for debugging it
    and wait for the trace-trap that results from attaching.  */
 static void
-gnu_attach (char *args, int from_tty)
+gnu_attach (struct target_ops *ops, char *args, int from_tty)
 {
   int pid;
   char *exec_file;
@@ -2205,7 +2206,7 @@ gnu_attach (char *args, int from_tty)
    previously attached.  It *might* work if the program was
    started via fork.  */
 static void
-gnu_detach (char *args, int from_tty)
+gnu_detach (struct target_ops *ops, char *args, int from_tty)
 {
   int pid;
 
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index d978303..a7ab137 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -184,8 +184,9 @@ static int go32_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
 static void go32_files_info (struct target_ops *target);
 static void go32_stop (ptid_t);
 static void go32_kill_inferior (void);
-static void go32_create_inferior (char *exec_file, char *args, char **env, int from_tty);
-static void go32_mourn_inferior (void);
+static void go32_create_inferior (struct target_ops *ops, char *exec_file,
+				  char *args, char **env, int from_tty);
+static void go32_mourn_inferior (struct target_ops *ops);
 static int go32_can_run (void);
 
 static struct target_ops go32_ops;
@@ -306,7 +307,7 @@ go32_close (int quitting)
 }
 
 static void
-go32_attach (char *args, int from_tty)
+go32_attach (struct target_ops *ops, char *args, int from_tty)
 {
   error (_("\
 You cannot attach to a running program on this platform.\n\
@@ -314,7 +315,7 @@ Use the `run' command to run DJGPP programs."));
 }
 
 static void
-go32_detach (char *args, int from_tty)
+go32_detach (struct target_ops *ops, char *args, int from_tty)
 {
 }
 
@@ -674,7 +675,7 @@ go32_create_inferior (char *exec_file, char *args, char **env, int from_tty)
 }
 
 static void
-go32_mourn_inferior (void)
+go32_mourn_inferior (struct target_ops *ops)
 {
   /* We need to make sure all the breakpoint enable bits in the DR7
      register are reset when the inferior exits.  Otherwise, if they
diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c
index cd69e19..8d2e65b 100644
--- a/gdb/hpux-thread.c
+++ b/gdb/hpux-thread.c
@@ -144,9 +144,9 @@ hpux_thread_open (char *arg, int from_tty)
    and wait for the trace-trap that results from attaching.  */
 
 static void
-hpux_thread_attach (char *args, int from_tty)
+hpux_thread_attach (struct target_ops *ops, char *args, int from_tty)
 {
-  deprecated_child_ops.to_attach (args, from_tty);
+  deprecated_child_ops.to_attach (&deprecated_child_ops, args, from_tty);
 
   /* XXX - might want to iterate over all the threads and register them. */
 }
@@ -160,9 +160,9 @@ hpux_thread_attach (char *args, int from_tty)
    started via the normal ptrace (PTRACE_TRACEME).  */
 
 static void
-hpux_thread_detach (char *args, int from_tty)
+hpux_thread_detach (struct target_ops *ops, char *args, int from_tty)
 {
-  deprecated_child_ops.to_detach (args, from_tty);
+  deprecated_child_ops.to_detach (&deprecated_child_ops, args, from_tty);
 }
 
 /* Resume execution of process PID.  If STEP is nozero, then
@@ -431,10 +431,11 @@ hpux_thread_notice_signals (ptid_t ptid)
 /* Fork an inferior process, and start debugging it with /proc.  */
 
 static void
-hpux_thread_create_inferior (char *exec_file, char *allargs, char **env,
-			     int from_tty)
+hpux_thread_create_inferior (struct target_ops *ops, char *exec_file,
+			     char *allargs, char **env, int from_tty)
 {
-  deprecated_child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
+  deprecated_child_ops.to_create_inferior (&deprecated_child_ops, 
+					   exec_file, allargs, env, from_tty);
 
   if (hpux_thread_active)
     {
@@ -487,7 +488,7 @@ hpux_thread_new_objfile (struct objfile *objfile)
 static void
 hpux_thread_mourn_inferior (void)
 {
-  deprecated_child_ops.to_mourn_inferior ();
+  deprecated_child_ops.to_mourn_inferior (&deprecated_child_ops);
 }
 
 /* Mark our target-struct as eligible for stray "run" and "attach" commands.  */
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 57af79a..bf3d0a8 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -35,8 +35,6 @@
 #include "inf-child.h"
 #include "gdbthread.h"
 
-/* HACK: Save the ptrace ops returned by inf_ptrace_target.  */
-static struct target_ops *ptrace_ops_hack;
 \f
 
 #ifdef PT_GET_PROCESS_STATE
@@ -132,12 +130,22 @@ inf_ptrace_me (void)
   ptrace (PT_TRACE_ME, 0, (PTRACE_TYPE_ARG3)0, 0);
 }
 
-/* Start tracing PID.  */
+/* Start a new inferior Unix child process.  EXEC_FILE is the file to
+   run, ALLARGS is a string containing the arguments to the program.
+   ENV is the environment vector to pass.  If FROM_TTY is non-zero, be
+   chatty about it.  */
 
 static void
-inf_ptrace_him (int pid)
+inf_ptrace_create_inferior (struct target_ops *ops,
+			    char *exec_file, char *allargs, char **env,
+			    int from_tty)
 {
-  push_target (ptrace_ops_hack);
+  int pid;
+
+  pid = fork_inferior (exec_file, allargs, env, inf_ptrace_me, NULL,
+		       NULL, NULL);
+
+  push_target (ops);
 
   /* On some targets, there must be some explicit synchronization
      between the parent and child processes after the debugger
@@ -156,19 +164,6 @@ inf_ptrace_him (int pid)
   target_post_startup_inferior (pid_to_ptid (pid));
 }
 
-/* Start a new inferior Unix child process.  EXEC_FILE is the file to
-   run, ALLARGS is a string containing the arguments to the program.
-   ENV is the environment vector to pass.  If FROM_TTY is non-zero, be
-   chatty about it.  */
-
-static void
-inf_ptrace_create_inferior (char *exec_file, char *allargs, char **env,
-			    int from_tty)
-{
-  fork_inferior (exec_file, allargs, env, inf_ptrace_me, inf_ptrace_him,
-		 NULL, NULL);
-}
-
 #ifdef PT_GET_PROCESS_STATE
 
 static void
@@ -189,7 +184,7 @@ inf_ptrace_post_startup_inferior (ptid_t pid)
 /* Clean up a rotting corpse of an inferior after it died.  */
 
 static void
-inf_ptrace_mourn_inferior (void)
+inf_ptrace_mourn_inferior (struct target_ops *ops)
 {
   int status;
 
@@ -199,7 +194,7 @@ inf_ptrace_mourn_inferior (void)
      only report its exit status to its original parent.  */
   waitpid (ptid_get_pid (inferior_ptid), &status, 0);
 
-  unpush_target (ptrace_ops_hack);
+  unpush_target (ops);
   generic_mourn_inferior ();
 }
 
@@ -207,7 +202,7 @@ inf_ptrace_mourn_inferior (void)
    be chatty about it.  */
 
 static void
-inf_ptrace_attach (char *args, int from_tty)
+inf_ptrace_attach (struct target_ops *ops, char *args, int from_tty)
 {
   char *exec_file;
   pid_t pid;
@@ -258,7 +253,7 @@ inf_ptrace_attach (char *args, int from_tty)
      target, it should decorate the ptid later with more info.  */
   add_thread_silent (inferior_ptid);
 
-  push_target (ptrace_ops_hack);
+  push_target(ops);
 }
 
 #ifdef PT_GET_PROCESS_STATE
@@ -282,7 +277,7 @@ inf_ptrace_post_attach (int pid)
    specified by ARGS.  If FROM_TTY is non-zero, be chatty about it.  */
 
 static void
-inf_ptrace_detach (char *args, int from_tty)
+inf_ptrace_detach (struct target_ops *ops, char *args, int from_tty)
 {
   pid_t pid = ptid_get_pid (inferior_ptid);
   int sig = 0;
@@ -314,7 +309,7 @@ inf_ptrace_detach (char *args, int from_tty)
 
   inferior_ptid = null_ptid;
   detach_inferior (pid);
-  unpush_target (ptrace_ops_hack);
+  unpush_target (ops);
 }
 
 /* Kill the inferior.  */
@@ -644,7 +639,6 @@ inf_ptrace_target (void)
   t->to_stop = inf_ptrace_stop;
   t->to_xfer_partial = inf_ptrace_xfer_partial;
 
-  ptrace_ops_hack = t;
   return t;
 }
 \f
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index 643cfa2..e8b2971 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -662,8 +662,8 @@ inf_ttrace_him (int pid)
 }
 
 static void
-inf_ttrace_create_inferior (char *exec_file, char *allargs, char **env,
-			    int from_tty)
+inf_ttrace_create_inferior (struct target_ops *ops, char *exec_file, 
+			    char *allargs, char **env, int from_tty)
 {
   gdb_assert (inf_ttrace_num_lwps == 0);
   gdb_assert (inf_ttrace_num_lwps_in_syscall == 0);
@@ -676,7 +676,7 @@ inf_ttrace_create_inferior (char *exec_file, char *allargs, char **env,
 }
 
 static void
-inf_ttrace_mourn_inferior (void)
+inf_ttrace_mourn_inferior (struct target_ops *ops)
 {
   const int num_buckets = ARRAY_SIZE (inf_ttrace_page_dict.buckets);
   int bucket;
@@ -704,7 +704,7 @@ inf_ttrace_mourn_inferior (void)
 }
 
 static void
-inf_ttrace_attach (char *args, int from_tty)
+inf_ttrace_attach (struct target_ops *ops, char *args, int from_tty)
 {
   char *exec_file;
   pid_t pid;
@@ -769,7 +769,7 @@ inf_ttrace_attach (char *args, int from_tty)
 }
 
 static void
-inf_ttrace_detach (char *args, int from_tty)
+inf_ttrace_detach (struct target_ops *ops, char *args, int from_tty)
 {
   pid_t pid = ptid_get_pid (inferior_ptid);
   int sig = 0;
diff --git a/gdb/inferior.h b/gdb/inferior.h
index cc5bf9f..be4cffd 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -197,9 +197,9 @@ extern ptid_t procfs_first_available (void);
 
 /* From fork-child.c */
 
-extern void fork_inferior (char *, char *, char **,
-			   void (*)(void),
-			   void (*)(int), void (*)(void), char *);
+extern int fork_inferior (char *, char *, char **,
+			  void (*)(void),
+			  void (*)(int), void (*)(void), char *);
 
 
 extern void startup_inferior (int);
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 56ec9cb..913bfec 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1317,7 +1317,8 @@ lin_lwp_attach_lwp (ptid_t ptid)
 }
 
 static void
-linux_nat_create_inferior (char *exec_file, char *allargs, char **env,
+linux_nat_create_inferior (struct target_ops *ops, 
+			   char *exec_file, char *allargs, char **env,
 			   int from_tty)
 {
   int saved_async = 0;
@@ -1364,7 +1365,7 @@ linux_nat_create_inferior (char *exec_file, char *allargs, char **env,
     }
 #endif /* HAVE_PERSONALITY */
 
-  linux_ops->to_create_inferior (exec_file, allargs, env, from_tty);
+  linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty);
 
 #ifdef HAVE_PERSONALITY
   if (personality_set)
@@ -1382,7 +1383,7 @@ linux_nat_create_inferior (char *exec_file, char *allargs, char **env,
 }
 
 static void
-linux_nat_attach (char *args, int from_tty)
+linux_nat_attach (struct target_ops *ops, char *args, int from_tty)
 {
   struct lwp_info *lp;
   int status;
@@ -1390,7 +1391,7 @@ linux_nat_attach (char *args, int from_tty)
 
   /* FIXME: We should probably accept a list of process id's, and
      attach all of them.  */
-  linux_ops->to_attach (args, from_tty);
+  linux_ops->to_attach (ops, args, from_tty);
 
   if (!target_can_async_p ())
     {
@@ -1571,7 +1572,7 @@ detach_callback (struct lwp_info *lp, void *data)
 }
 
 static void
-linux_nat_detach (char *args, int from_tty)
+linux_nat_detach (struct target_ops *ops, char *args, int from_tty)
 {
   int pid;
   int status;
@@ -1612,7 +1613,7 @@ linux_nat_detach (char *args, int from_tty)
 
   pid = GET_PID (inferior_ptid);
   inferior_ptid = pid_to_ptid (pid);
-  linux_ops->to_detach (args, from_tty);
+  linux_ops->to_detach (ops, args, from_tty);
 
   if (target_can_async_p ())
     drain_queued_events (pid);
@@ -3176,7 +3177,7 @@ linux_nat_kill (void)
 }
 
 static void
-linux_nat_mourn_inferior (void)
+linux_nat_mourn_inferior (struct target_ops *ops)
 {
   /* Destroy LWP info; it's no longer valid.  */
   init_lwp_list ();
@@ -3186,7 +3187,7 @@ linux_nat_mourn_inferior (void)
       /* Normal case, no other forks available.  */
       if (target_can_async_p ())
 	linux_nat_async (NULL, 0);
-      linux_ops->to_mourn_inferior ();
+      linux_ops->to_mourn_inferior (ops);
     }
   else
     /* Multi-fork case.  The current inferior_ptid has exited, but
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index fc85be5..5f98e99 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -780,11 +780,11 @@ detach_thread (ptid_t ptid)
 }
 
 static void
-thread_db_detach (char *args, int from_tty)
+thread_db_detach (struct target_ops *ops, char *args, int from_tty)
 {
   disable_thread_event_reporting ();
 
-  target_beneath->to_detach (args, from_tty);
+  target_beneath->to_detach (target_beneath, args, from_tty);
 
   /* Should this be done by detach_command?  */
   target_mourn_inferior ();
@@ -927,20 +927,20 @@ thread_db_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
 }
 
 static void
-thread_db_mourn_inferior (void)
+thread_db_mourn_inferior (struct target_ops *ops)
 {
   /* Forget about the child's process ID.  We shouldn't need it
      anymore.  */
   proc_handle.pid = 0;
 
-  target_beneath->to_mourn_inferior ();
+  target_beneath->to_mourn_inferior (target_beneath);
 
   /* Delete the old thread event breakpoints.  Do this after mourning
      the inferior, so that we don't try to uninsert them.  */
   remove_thread_event_breakpoints ();
 
   /* Detach thread_db target ops.  */
-  unpush_target (&thread_db_ops);
+  unpush_target (ops);
   using_thread_db = 0;
 }
 
diff --git a/gdb/monitor.c b/gdb/monitor.c
index c5b0ec6..6b5f820 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -853,7 +853,7 @@ monitor_close (int quitting)
    when you want to detach and do something else with your gdb.  */
 
 static void
-monitor_detach (char *args, int from_tty)
+monitor_detach (struct target_ops *ops, char *args, int from_tty)
 {
   pop_target ();		/* calls monitor_close to do the real work */
   if (from_tty)
@@ -1995,8 +1995,8 @@ monitor_kill (void)
 /* All we actually do is set the PC to the start address of exec_bfd.  */
 
 static void
-monitor_create_inferior (char *exec_file, char *args, char **env,
-			 int from_tty)
+monitor_create_inferior (struct target_ops *ops, char *exec_file,
+			 char *args, char **env, int from_tty)
 {
   if (args && (*args != '\000'))
     error (_("Args are not supported by the monitor."));
@@ -2012,7 +2012,7 @@ monitor_create_inferior (char *exec_file, char *args, char **env,
    instructions.  */
 
 static void
-monitor_mourn_inferior (void)
+monitor_mourn_inferior (struct target_ops *ops)
 {
   unpush_target (targ_ops);
   generic_mourn_inferior ();	/* Do all the proper things now */
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index f69aaf2..9bcd2f8 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -518,7 +518,7 @@ procfs_can_run (void)
 
 /* Attach to process PID, then initialize for debugging it.  */
 static void
-procfs_attach (char *args, int from_tty)
+procfs_attach (struct target_ops *ops, char *args, int from_tty)
 {
   char *exec_file;
   int pid;
@@ -781,7 +781,7 @@ procfs_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int dowrite,
    on signals, etc.  We'd better not have left any breakpoints
    in the program or it'll die when it hits one.  */
 static void
-procfs_detach (char *args, int from_tty)
+procfs_detach (struct target_ops *ops, char *args, int from_tty)
 {
   int siggnal = 0;
   int pid;
@@ -914,7 +914,7 @@ procfs_resume (ptid_t ptid, int step, enum target_signal signo)
 }
 
 static void
-procfs_mourn_inferior (void)
+procfs_mourn_inferior (struct target_ops *ops)
 {
   if (!ptid_equal (inferior_ptid, null_ptid))
     {
@@ -988,8 +988,8 @@ breakup_args (char *scratch, char **argv)
 }
 
 static void
-procfs_create_inferior (char *exec_file, char *allargs, char **env,
-			int from_tty)
+procfs_create_inferior (struct target_ops *ops, char *exec_file,
+			char *allargs, char **env, int from_tty)
 {
   struct inheritance inherit;
   pid_t pid;
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 248dd3a..f1f4d96 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -112,8 +112,8 @@
  */
 
 static void procfs_open (char *, int);
-static void procfs_attach (char *, int);
-static void procfs_detach (char *, int);
+static void procfs_attach (struct target_ops *, char *, int);
+static void procfs_detach (struct target_ops *, char *, int);
 static void procfs_resume (ptid_t, int, enum target_signal);
 static int procfs_can_run (void);
 static void procfs_stop (ptid_t);
@@ -123,8 +123,9 @@ static void procfs_store_registers (struct regcache *, int);
 static void procfs_notice_signals (ptid_t);
 static void procfs_prepare_to_store (struct regcache *);
 static void procfs_kill_inferior (void);
-static void procfs_mourn_inferior (void);
-static void procfs_create_inferior (char *, char *, char **, int);
+static void procfs_mourn_inferior (struct target_ops *ops);
+static void procfs_create_inferior (struct target_ops *, char *, 
+				    char *, char **, int);
 static ptid_t procfs_wait (ptid_t, struct target_waitstatus *);
 static int procfs_xfer_memory (CORE_ADDR, gdb_byte *, int, int,
 			       struct mem_attrib *attrib,
@@ -3602,7 +3603,7 @@ procfs_debug_inferior (procinfo *pi)
 }
 
 static void
-procfs_attach (char *args, int from_tty)
+procfs_attach (struct target_ops *ops, char *args, int from_tty)
 {
   char *exec_file;
   int   pid;
@@ -3632,7 +3633,7 @@ procfs_attach (char *args, int from_tty)
 }
 
 static void
-procfs_detach (char *args, int from_tty)
+procfs_detach (struct target_ops *ops, char *args, int from_tty)
 {
   int sig = 0;
   int pid = PIDGET (inferior_ptid);
@@ -4842,7 +4843,7 @@ procfs_kill_inferior (void)
  */
 
 static void
-procfs_mourn_inferior (void)
+procfs_mourn_inferior (struct target_ops *ops)
 {
   procinfo *pi;
 
@@ -5111,8 +5112,8 @@ procfs_set_exec_trap (void)
  */
 
 static void
-procfs_create_inferior (char *exec_file, char *allargs, char **env,
-			int from_tty)
+procfs_create_inferior (struct target_ops *ops, char *exec_file,
+			char *allargs, char **env, int from_tty)
 {
   char *shell_file = getenv ("SHELL");
   char *tryname;
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index 5ac6e38..302e063 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -316,7 +316,8 @@ check_mmu_status (void)
 /* This is called not only when we first attach, but also when the
    user types "run" after having attached.  */
 static void
-m32r_create_inferior (char *execfile, char *args, char **env, int from_tty)
+m32r_create_inferior (struct target_ops *ops, char *execfile,
+		      char *args, char **env, int from_tty)
 {
   CORE_ADDR entry_pt;
 
@@ -872,7 +873,7 @@ m32r_wait (ptid_t ptid, struct target_waitstatus *status)
    Use this when you want to detach and do something else
    with your gdb.  */
 static void
-m32r_detach (char *args, int from_tty)
+m32r_detach (struct target_ops *ops, char *args, int from_tty)
 {
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "m32r_detach(%d)\n", from_tty);
@@ -1147,7 +1148,7 @@ m32r_kill (void)
    instructions.  */
 
 static void
-m32r_mourn_inferior (void)
+m32r_mourn_inferior (struct target_ops *ops)
 {
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "m32r_mourn_inferior()\n");
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index a996124..b4423d5 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -84,7 +84,7 @@ static void lsi_open (char *name, int from_tty);
 
 static void mips_close (int quitting);
 
-static void mips_detach (char *args, int from_tty);
+static void mips_detach (struct target_ops *ops, char *args, int from_tty);
 
 static void mips_resume (ptid_t ptid, int step,
                          enum target_signal siggnal);
@@ -1652,7 +1652,7 @@ mips_close (int quitting)
 /* Detach from the remote board.  */
 
 static void
-mips_detach (char *args, int from_tty)
+mips_detach (struct target_ops *ops, char *args, int from_tty)
 {
   if (args)
     error ("Argument given to \"detach\" when remotely debugging.");
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index be89db9..62f9cb1 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -84,7 +84,7 @@ static void gdbsim_open (char *args, int from_tty);
 
 static void gdbsim_close (int quitting);
 
-static void gdbsim_detach (char *args, int from_tty);
+static void gdbsim_detach (struct target_ops *ops, char *args, int from_tty);
 
 static void gdbsim_resume (ptid_t ptid, int step, enum target_signal siggnal);
 
@@ -604,7 +604,7 @@ gdbsim_close (int quitting)
    Use this when you want to detach and do something else with your gdb.  */
 
 static void
-gdbsim_detach (char *args, int from_tty)
+gdbsim_detach (struct target_ops *ops, char *args, int from_tty)
 {
   if (remote_debug)
     printf_filtered ("gdbsim_detach: args \"%s\"\n", args);
diff --git a/gdb/remote.c b/gdb/remote.c
index 32ff2ea..994c916 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -105,11 +105,11 @@ static void remote_close (int quitting);
 
 static void remote_store_registers (struct regcache *regcache, int regno);
 
-static void remote_mourn (void);
+static void remote_mourn (struct target_ops *ops);
 
 static void extended_remote_restart (void);
 
-static void extended_remote_mourn (void);
+static void extended_remote_mourn (struct target_ops *);
 
 static void remote_mourn_1 (struct target_ops *);
 
@@ -133,7 +133,7 @@ static void remote_async (void (*callback) (enum inferior_event_type event_type,
 
 static int remote_async_mask (int new_mask);
 
-static void remote_detach (char *args, int from_tty);
+static void remote_detach (struct target_ops *ops, char *args, int from_tty);
 
 static void remote_interrupt (int signo);
 
@@ -3316,13 +3316,13 @@ remote_detach_1 (char *args, int from_tty, int extended)
 }
 
 static void
-remote_detach (char *args, int from_tty)
+remote_detach (struct target_ops *ops, char *args, int from_tty)
 {
   remote_detach_1 (args, from_tty, 0);
 }
 
 static void
-extended_remote_detach (char *args, int from_tty)
+extended_remote_detach (struct target_ops *ops, char *args, int from_tty)
 {
   remote_detach_1 (args, from_tty, 1);
 }
@@ -3445,9 +3445,9 @@ extended_remote_attach_1 (struct target_ops *target, char *args, int from_tty)
 }
 
 static void
-extended_remote_attach (char *args, int from_tty)
+extended_remote_attach (struct target_ops *ops, char *args, int from_tty)
 {
-  extended_remote_attach_1 (&extended_remote_ops, args, from_tty);
+  extended_remote_attach_1 (ops, args, from_tty);
 }
 
 /* Convert hex digit A to a number.  */
@@ -6462,9 +6462,9 @@ extended_remote_kill (void)
 }
 
 static void
-remote_mourn (void)
+remote_mourn (struct target_ops *ops)
 {
-  remote_mourn_1 (&remote_ops);
+  remote_mourn_1 (ops);
 }
 
 /* Worker function for remote_mourn.  */
@@ -6547,9 +6547,9 @@ extended_remote_mourn_1 (struct target_ops *target)
 }
 
 static void
-extended_remote_mourn (void)
+extended_remote_mourn (struct target_ops *ops)
 {
-  extended_remote_mourn_1 (&extended_remote_ops);
+  extended_remote_mourn_1 (ops);
 }
 
 static int
@@ -6665,7 +6665,8 @@ extended_remote_create_inferior_1 (char *exec_file, char *args,
 }
 
 static void
-extended_remote_create_inferior (char *exec_file, char *args,
+extended_remote_create_inferior (struct target_ops *ops, 
+				 char *exec_file, char *args,
 				 char **env, int from_tty)
 {
   extended_remote_create_inferior_1 (exec_file, args, env, from_tty);
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 27632d3..6501def 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -966,17 +966,18 @@ vmap_exec (void)
 /* Set the current architecture from the host running GDB.  Called when
    starting a child process. */
 
-static void (*super_create_inferior) (char *exec_file, char *allargs,
-				      char **env, int from_tty);
+static void (*super_create_inferior) (struct target_ops *,char *exec_file, 
+				      char *allargs, char **env, int from_tty);
 static void
-rs6000_create_inferior (char *exec_file, char *allargs, char **env, int from_tty)
+rs6000_create_inferior (struct target_ops * ops, char *exec_file,
+			char *allargs, char **env, int from_tty)
 {
   enum bfd_architecture arch;
   unsigned long mach;
   bfd abfd;
   struct gdbarch_info info;
 
-  super_create_inferior (exec_file, allargs, env, from_tty);
+  super_create_inferior (ops, exec_file, allargs, env, from_tty);
 
   if (__power_rs ())
     {
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 8f99ac1..103a697 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -348,10 +348,10 @@ sol_thread_open (char *arg, int from_tty)
    for the trace-trap that results from attaching.  */
 
 static void
-sol_thread_attach (char *args, int from_tty)
+sol_thread_attach (struct target_ops *ops, char *args, int from_tty)
 {
   sol_thread_active = 0;
-  procfs_ops.to_attach (args, from_tty);
+  procfs_ops.to_attach (&procfs_ops, args, from_tty);
 
   /* Must get symbols from shared libraries before libthread_db can run!  */
   solib_add (NULL, from_tty, (struct target_ops *) 0, auto_solib_add);
@@ -379,12 +379,12 @@ sol_thread_attach (char *args, int from_tty)
    program was started via the normal ptrace (PTRACE_TRACEME).  */
 
 static void
-sol_thread_detach (char *args, int from_tty)
+sol_thread_detach (struct target_ops *ops, char *args, int from_tty)
 {
   sol_thread_active = 0;
   inferior_ptid = pid_to_ptid (PIDGET (main_ph.ptid));
   unpush_target (&sol_thread_ops);
-  procfs_ops.to_detach (args, from_tty);
+  procfs_ops.to_detach (&procfs_ops, args, from_tty);
 }
 
 /* Resume execution of process PTID.  If STEP is nozero, then just
@@ -753,11 +753,11 @@ sol_thread_notice_signals (ptid_t ptid)
 /* Fork an inferior process, and start debugging it with /proc.  */
 
 static void
-sol_thread_create_inferior (char *exec_file, char *allargs, char **env,
-			    int from_tty)
+sol_thread_create_inferior (struct target_ops *ops, char *exec_file,
+			    char *allargs, char **env, int from_tty)
 {
   sol_thread_active = 0;
-  procfs_ops.to_create_inferior (exec_file, allargs, env, from_tty);
+  procfs_ops.to_create_inferior (&procfs_ops, exec_file, allargs, env, from_tty);
 
   if (sol_thread_active && !ptid_equal (inferior_ptid, null_ptid))
     {
@@ -822,11 +822,11 @@ sol_thread_new_objfile (struct objfile *objfile)
 /* Clean up after the inferior dies.  */
 
 static void
-sol_thread_mourn_inferior (void)
+sol_thread_mourn_inferior (struct target_ops *ops)
 {
   sol_thread_active = 0;
   unpush_target (&sol_thread_ops);
-  procfs_ops.to_mourn_inferior ();
+  procfs_ops.to_mourn_inferior (&procfs_ops);
 }
 
 /* Mark our target-struct as eligible for stray "run" and "attach"
@@ -1411,10 +1411,10 @@ sol_core_close (int quitting)
 }
 
 static void
-sol_core_detach (char *args, int from_tty)
+sol_core_detach (struct target_ops *ops, char *args, int from_tty)
 {
   unpush_target (&core_ops);
-  orig_core_ops.to_detach (args, from_tty);
+  orig_core_ops.to_detach (&orig_core_ops, args, from_tty);
 }
 
 static void
diff --git a/gdb/target.c b/gdb/target.c
index fa9a941..3901ee7 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -99,9 +99,9 @@ static void debug_to_open (char *, int);
 
 static void debug_to_close (int);
 
-static void debug_to_attach (char *, int);
+static void debug_to_attach (struct target_ops *ops, char *, int);
 
-static void debug_to_detach (char *, int);
+static void debug_to_detach (struct target_ops *ops, char *, int);
 
 static void debug_to_resume (ptid_t, int, enum target_signal);
 
@@ -156,7 +156,7 @@ static void debug_to_load (char *, int);
 
 static int debug_to_lookup_symbol (char *, CORE_ADDR *);
 
-static void debug_to_mourn_inferior (void);
+static void debug_to_mourn_inferior (struct target_ops *);
 
 static int debug_to_can_run (void);
 
@@ -281,6 +281,24 @@ target_load (char *arg, int from_tty)
   (*current_target.to_load) (arg, from_tty);
 }
 
+void target_create_inferior (char *exec_file, char *args,
+			     char **env, int from_tty)
+{
+  struct target_ops *t;
+  for (t = current_target.beneath; t != NULL; t = t->beneath)
+    {
+      if (t->to_create_inferior != NULL)	
+	{
+	  t->to_create_inferior (t, exec_file, args, env, from_tty);
+	  return;
+	}
+    }
+
+  internal_error (__FILE__, __LINE__,
+		  "could not find a target to create inferior");
+}
+
+
 static int
 nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
 	  struct target_ops *t)
@@ -394,10 +412,10 @@ update_current_target (void)
       INHERIT (to_doc, t);
       /* Do not inherit to_open.  */
       /* Do not inherit to_close.  */
-      INHERIT (to_attach, t);
+      /* Do not inherit to_attach.  */
       INHERIT (to_post_attach, t);
       INHERIT (to_attach_no_wait, t);
-      INHERIT (to_detach, t);
+      /* Do not inherit to_detach.  */
       /* Do not inherit to_disconnect.  */
       INHERIT (to_resume, t);
       INHERIT (to_wait, t);
@@ -428,7 +446,7 @@ update_current_target (void)
       INHERIT (to_kill, t);
       INHERIT (to_load, t);
       INHERIT (to_lookup_symbol, t);
-      INHERIT (to_create_inferior, t);
+      /* Do no inherit to_create_inferior.  */
       INHERIT (to_post_startup_inferior, t);
       INHERIT (to_acknowledge_created_inferior, t);
       INHERIT (to_insert_fork_catchpoint, t);
@@ -439,7 +457,7 @@ update_current_target (void)
       INHERIT (to_insert_exec_catchpoint, t);
       INHERIT (to_remove_exec_catchpoint, t);
       INHERIT (to_has_exited, t);
-      INHERIT (to_mourn_inferior, t);
+      /* Do no inherit to_mourn_inferiour.  */
       INHERIT (to_can_run, t);
       INHERIT (to_notice_signals, t);
       INHERIT (to_thread_alive, t);
@@ -496,9 +514,6 @@ update_current_target (void)
   de_fault (to_post_attach,
 	    (void (*) (int))
 	    target_ignore);
-  de_fault (to_detach,
-	    (void (*) (char *, int))
-	    target_ignore);
   de_fault (to_resume,
 	    (void (*) (ptid_t, int, enum target_signal))
 	    noprocess);
@@ -602,9 +617,6 @@ update_current_target (void)
   de_fault (to_has_exited,
 	    (int (*) (int, int, int *))
 	    return_zero);
-  de_fault (to_mourn_inferior,
-	    (void (*) (void))
-	    noprocess);
   de_fault (to_can_run,
 	    return_zero);
   de_fault (to_notice_signals,
@@ -1797,6 +1809,8 @@ target_preopen (int from_tty)
 void
 target_detach (char *args, int from_tty)
 {
+  struct target_ops* t;
+  
   if (gdbarch_has_global_solist (target_gdbarch))
     /* Don't remove global breakpoints here.  They're removed on
        disconnection from the target.  */
@@ -1806,7 +1820,16 @@ target_detach (char *args, int from_tty)
        them before detaching.  */
     remove_breakpoints ();
 
-  (current_target.to_detach) (args, from_tty);
+  for (t = current_target.beneath; t != NULL; t = t->beneath)
+    {
+      if (t->to_detach != NULL)
+	{
+	  t->to_detach (t, args, from_tty);
+	  return;
+	}
+    }
+
+  internal_error (__FILE__, __LINE__, "could not find a target to detach");
 }
 
 void
@@ -1865,6 +1888,23 @@ target_follow_fork (int follow_child)
 		  "could not find a target to follow fork");
 }
 
+void
+target_mourn_inferior (void)
+{
+  struct target_ops *t;
+  for (t = current_target.beneath; t != NULL; t = t->beneath)
+    {
+      if (t->to_mourn_inferior != NULL)	
+	{
+	  t->to_mourn_inferior (t);
+	  return;
+	}
+    }
+
+  internal_error (__FILE__, __LINE__,
+		  "could not find a target to follow mourn inferiour");
+}
+
 /* Look for a target which can describe architectural features, starting
    from TARGET.  If we find one, return its description.  */
 
@@ -2110,23 +2150,24 @@ find_default_run_target (char *do_mesg)
 }
 
 void
-find_default_attach (char *args, int from_tty)
+find_default_attach (struct target_ops *ops, char *args, int from_tty)
 {
   struct target_ops *t;
 
   t = find_default_run_target ("attach");
-  (t->to_attach) (args, from_tty);
+  (t->to_attach) (t, args, from_tty);
   return;
 }
 
 void
-find_default_create_inferior (char *exec_file, char *allargs, char **env,
+find_default_create_inferior (struct target_ops *ops,
+			      char *exec_file, char *allargs, char **env,
 			      int from_tty)
 {
   struct target_ops *t;
 
   t = find_default_run_target ("run");
-  (t->to_create_inferior) (exec_file, allargs, env, from_tty);
+  (t->to_create_inferior) (t, exec_file, allargs, env, from_tty);
   return;
 }
 
@@ -2454,6 +2495,8 @@ init_dummy_target (void)
   dummy_target.to_longname = "None";
   dummy_target.to_doc = "";
   dummy_target.to_attach = find_default_attach;
+  dummy_target.to_detach = 
+    (void (*)(struct target_ops *, char *, int))target_ignore;
   dummy_target.to_create_inferior = find_default_create_inferior;
   dummy_target.to_can_async_p = find_default_can_async_p;
   dummy_target.to_is_async_p = find_default_is_async_p;
@@ -2490,10 +2533,28 @@ target_close (struct target_ops *targ, int quitting)
     targ->to_close (quitting);
 }
 
+void
+target_attach (char *args, int from_tty)
+{
+  struct target_ops *t;
+  for (t = current_target.beneath; t != NULL; t = t->beneath)
+    {
+      if (t->to_attach != NULL)	
+	{
+	  t->to_attach (t, args, from_tty);
+	  return;
+	}
+    }
+
+  internal_error (__FILE__, __LINE__,
+		  "could not find a target to attach");
+}
+
+
 static void
-debug_to_attach (char *args, int from_tty)
+debug_to_attach (struct target_ops *ops, char *args, int from_tty)
 {
-  debug_target.to_attach (args, from_tty);
+  debug_target.to_attach (&debug_target, args, from_tty);
 
   fprintf_unfiltered (gdb_stdlog, "target_attach (%s, %d)\n", args, from_tty);
 }
@@ -2508,9 +2569,9 @@ debug_to_post_attach (int pid)
 }
 
 static void
-debug_to_detach (char *args, int from_tty)
+debug_to_detach (struct target_ops *ops, char *args, int from_tty)
 {
-  debug_target.to_detach (args, from_tty);
+  debug_target.to_detach (&debug_target, args, from_tty);
 
   fprintf_unfiltered (gdb_stdlog, "target_detach (%s, %d)\n", args, from_tty);
 }
@@ -2913,10 +2974,11 @@ debug_to_lookup_symbol (char *name, CORE_ADDR *addrp)
 }
 
 static void
-debug_to_create_inferior (char *exec_file, char *args, char **env,
+debug_to_create_inferior (struct target_ops *ops,
+			  char *exec_file, char *args, char **env,
 			  int from_tty)
 {
-  debug_target.to_create_inferior (exec_file, args, env, from_tty);
+  debug_target.to_create_inferior (ops, exec_file, args, env, from_tty);
 
   fprintf_unfiltered (gdb_stdlog, "target_create_inferior (%s, %s, xxx, %d)\n",
 		      exec_file, args, from_tty);
@@ -3020,9 +3082,9 @@ debug_to_has_exited (int pid, int wait_status, int *exit_status)
 }
 
 static void
-debug_to_mourn_inferior (void)
+debug_to_mourn_inferior (struct target_ops *ops)
 {
-  debug_target.to_mourn_inferior ();
+  debug_target.to_mourn_inferior (&debug_target);
 
   fprintf_unfiltered (gdb_stdlog, "target_mourn_inferior ()\n");
 }
diff --git a/gdb/target.h b/gdb/target.h
index a010d2d..05b681d 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -327,9 +327,9 @@ struct target_ops
        to xfree everything (including the "struct target_ops").  */
     void (*to_xclose) (struct target_ops *targ, int quitting);
     void (*to_close) (int);
-    void (*to_attach) (char *, int);
+    void (*to_attach) (struct target_ops *ops, char *, int);
     void (*to_post_attach) (int);
-    void (*to_detach) (char *, int);
+    void (*to_detach) (struct target_ops *ops, char *, int);
     void (*to_disconnect) (struct target_ops *, char *, int);
     void (*to_resume) (ptid_t, int, enum target_signal);
     ptid_t (*to_wait) (ptid_t, struct target_waitstatus *);
@@ -387,7 +387,8 @@ struct target_ops
     void (*to_kill) (void);
     void (*to_load) (char *, int);
     int (*to_lookup_symbol) (char *, CORE_ADDR *);
-    void (*to_create_inferior) (char *, char *, char **, int);
+    void (*to_create_inferior) (struct target_ops *, 
+				char *, char *, char **, int);
     void (*to_post_startup_inferior) (ptid_t);
     void (*to_acknowledge_created_inferior) (int);
     void (*to_insert_fork_catchpoint) (int);
@@ -398,7 +399,7 @@ struct target_ops
     void (*to_insert_exec_catchpoint) (int);
     int (*to_remove_exec_catchpoint) (int);
     int (*to_has_exited) (int, int, int *);
-    void (*to_mourn_inferior) (void);
+    void (*to_mourn_inferior) (struct target_ops *);
     int (*to_can_run) (void);
     void (*to_notice_signals) (ptid_t ptid);
     int (*to_thread_alive) (ptid_t ptid);
@@ -580,8 +581,7 @@ void target_close (struct target_ops *targ, int quitting);
    should be ready to deliver the status of the process immediately
    (without waiting) to an upcoming target_wait call.  */
 
-#define	target_attach(args, from_tty)	\
-     (*current_target.to_attach) (args, from_tty)
+void target_attach (char *, int);
 
 /* Some targets don't generate traps when attaching to the inferior,
    or their target_attach implementation takes care of the waiting.
@@ -831,9 +831,8 @@ extern void target_load (char *arg, int from_tty);
    ENV is the environment vector to pass.  Errors reported with error().
    On VxWorks and various standalone systems, we ignore exec_file.  */
 
-#define	target_create_inferior(exec_file, args, env, FROM_TTY)	\
-     (*current_target.to_create_inferior) (exec_file, args, env, (FROM_TTY))
-
+void target_create_inferior (char *exec_file, char *args,
+			     char **env, int from_tty);
 
 /* Some targets (such as ttrace-based HPUX) don't allow us to request
    notification of inferior events such as fork and vork immediately
@@ -903,8 +902,7 @@ int target_follow_fork (int follow_child);
 
 /* The inferior process has died.  Do what is right.  */
 
-#define	target_mourn_inferior()	\
-     (*current_target.to_mourn_inferior) ()
+void target_mourn_inferior (void);
 
 /* Does target have enough data to do a run or attach command? */
 
@@ -1269,9 +1267,10 @@ extern void noprocess (void);
 
 extern void target_require_runnable (void);
 
-extern void find_default_attach (char *, int);
+extern void find_default_attach (struct target_ops *, char *, int);
 
-extern void find_default_create_inferior (char *, char *, char **, int);
+extern void find_default_create_inferior (struct target_ops *,
+					  char *, char *, char **, int);
 
 extern struct target_ops *find_run_target (void);
 
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index cd4d533..5350be6 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -1684,7 +1684,7 @@ out:
 
 /* Attach to process PID, then initialize for debugging it.  */
 static void
-win32_attach (char *args, int from_tty)
+win32_attach (struct target_ops *ops, char *args, int from_tty)
 {
   BOOL ok;
   DWORD pid;
@@ -1740,7 +1740,7 @@ win32_attach (char *args, int from_tty)
 }
 
 static void
-win32_detach (char *args, int from_tty)
+win32_detach (struct target_ops *ops, char *args, int from_tty)
 {
   int detached = 1;
 
@@ -1823,8 +1823,8 @@ win32_open (char *arg, int from_tty)
    ENV is the environment vector to pass.  Errors reported with error().  */
 
 static void
-win32_create_inferior (char *exec_file, char *allargs, char **in_env,
-		       int from_tty)
+win32_create_inferior (struct target_ops *ops, char *exec_file,
+		       char *allargs, char **in_env, int from_tty)
 {
   STARTUPINFO si;
   PROCESS_INFORMATION pi;
@@ -1951,7 +1951,7 @@ win32_create_inferior (char *exec_file, char *allargs, char **in_env,
 }
 
 static void
-win32_mourn_inferior (void)
+win32_mourn_inferior (struct target_ops *ops)
 {
   (void) win32_continue (DBG_CONTINUE, -1);
   i386_cleanup_dregs();

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Kill ptrace_ops_hack
  2008-11-04 10:20   ` Vladimir Prus
@ 2008-11-05 13:32     ` Joel Brobecker
  2008-11-11 22:51     ` Thiago Jung Bauermann
  1 sibling, 0 replies; 9+ messages in thread
From: Joel Brobecker @ 2008-11-05 13:32 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches

> I've finally got back to this patch. I attach revised version that
> differs only by handling dec-thread.c, in addition to other target
> is previously used to handle. Would you like to verify this
> patch does not break Tru64, or I can commit it right away?

Go ahead, and commit right away. The change looks OK..

Thank you,
-- 
Joel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Kill ptrace_ops_hack
  2008-11-04 10:20   ` Vladimir Prus
  2008-11-05 13:32     ` Joel Brobecker
@ 2008-11-11 22:51     ` Thiago Jung Bauermann
  2008-11-13 13:05       ` Joel Brobecker
  1 sibling, 1 reply; 9+ messages in thread
From: Thiago Jung Bauermann @ 2008-11-11 22:51 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: Joel Brobecker, gdb-patches

Hi,

El mar, 04-11-2008 a las 13:19 +0300, Vladimir Prus escribió:
>         * target.h (struct target_ops): Make to_attach, to_detach,
>         to_create_inferior and to_mourn_inferior accept a pointer
>         to struct target_ops.

This patch missed functions in remote-sim.c, giving the following
warning with GCC 4.1.2:

cc1: warnings being treated as errors
/home/bauermann/scratchpad/python/gdb.git/gdb/remote-sim.c: In function ‘init_gdbsim_ops’:
/home/bauermann/scratchpad/python/gdb.git/gdb/remote-sim.c:918: warning: assignment from incompatible pointer type
/home/bauermann/scratchpad/python/gdb.git/gdb/remote-sim.c:919: warning: assignment from incompatible pointer type

GCC 4.3.2 doesn't complain, though.

Committed the following as obvious.
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


2008-11-11  Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* remote-sim.c (gdbsim_create_inferior, gdbsim_mourn_inferior): Add
	missing struct target_ops argument.

Index: gdb.git/gdb/remote-sim.c
===================================================================
--- gdb.git.orig/gdb/remote-sim.c	2008-11-11 10:29:32.000000000 -0800
+++ gdb.git/gdb/remote-sim.c	2008-11-11 13:57:51.000000000 -0800
@@ -94,7 +94,7 @@
 
 static void gdbsim_files_info (struct target_ops *target);
 
-static void gdbsim_mourn_inferior (void);
+static void gdbsim_mourn_inferior (struct target_ops *target);
 
 static void gdbsim_stop (ptid_t ptid);
 
@@ -445,7 +445,8 @@
    user types "run" after having attached.  */
 
 static void
-gdbsim_create_inferior (char *exec_file, char *args, char **env, int from_tty)
+gdbsim_create_inferior (struct target_ops *target, char *exec_file, char *args,
+			char **env, int from_tty)
 {
   int len;
   char *arg_buf, **argv;
@@ -822,7 +823,7 @@
 /* Clear the simulator's notion of what the break points are.  */
 
 static void
-gdbsim_mourn_inferior (void)
+gdbsim_mourn_inferior (struct target_ops *target)
 {
   if (remote_debug)
     printf_filtered ("gdbsim_mourn_inferior:\n");



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Kill ptrace_ops_hack
  2008-11-11 22:51     ` Thiago Jung Bauermann
@ 2008-11-13 13:05       ` Joel Brobecker
  2008-11-13 13:13         ` Joel Brobecker
  0 siblings, 1 reply; 9+ messages in thread
From: Joel Brobecker @ 2008-11-13 13:05 UTC (permalink / raw)
  To: Thiago Jung Bauermann; +Cc: Vladimir Prus, gdb-patches

> This patch missed functions in remote-sim.c, giving the following
> warning with GCC 4.1.2:

As it happens, I had approved a patch that fixes exactly this,
but that didn't get checked in:

http://www.sourceware.org/ml/gdb-patches/2008-11/msg00175.html

The patch is slightly more complete as it removes one reference to
the gdbsim_ops global. I'll commit that part separately.

-- 
Joel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Kill ptrace_ops_hack
  2008-11-13 13:05       ` Joel Brobecker
@ 2008-11-13 13:13         ` Joel Brobecker
  2008-11-13 20:33           ` Thiago Jung Bauermann
  0 siblings, 1 reply; 9+ messages in thread
From: Joel Brobecker @ 2008-11-13 13:13 UTC (permalink / raw)
  To: Thiago Jung Bauermann; +Cc: Vladimir Prus, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 820 bytes --]

> As it happens, I had approved a patch that fixes exactly this,
> but that didn't get checked in:
> 
> http://www.sourceware.org/ml/gdb-patches/2008-11/msg00175.html
> 
> The patch is slightly more complete as it removes one reference to
> the gdbsim_ops global. I'll commit that part separately.

Humpf, in retrospect, I find that the above sounds very ungrateful.
Sorry about that, Thiago. I am in fact pleased that you fixed the
problem this fast!

I committed the following piece. It's really only very very minor,
but it still makes the code slightly cleaner, I think.

2008-11-12  Joel Brobecker  <brobecker@adacore.com>

       From Joel Sherrill  <joel.sherrill@oarcorp.com>
       * remote-sim.c (gdbsim_mourn_inferior): Use "target" parameter
       instead of the "gdbsim_ops" global.

Checked in.

-- 
Joel

[-- Attachment #2: remote-sim.c.diff --]
[-- Type: text/plain, Size: 564 bytes --]

Index: remote-sim.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sim.c,v
retrieving revision 1.79
diff -u -p -r1.79 remote-sim.c
--- remote-sim.c	11 Nov 2008 22:07:40 -0000	1.79
+++ remote-sim.c	13 Nov 2008 01:23:12 -0000
@@ -829,7 +829,7 @@ gdbsim_mourn_inferior (struct target_ops
     printf_filtered ("gdbsim_mourn_inferior:\n");
 
   remove_breakpoints ();
-  target_mark_exited (&gdbsim_ops);
+  target_mark_exited (target);
   generic_mourn_inferior ();
   delete_thread_silent (remote_sim_ptid);
 }

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Kill ptrace_ops_hack
  2008-11-13 13:13         ` Joel Brobecker
@ 2008-11-13 20:33           ` Thiago Jung Bauermann
  0 siblings, 0 replies; 9+ messages in thread
From: Thiago Jung Bauermann @ 2008-11-13 20:33 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Vladimir Prus, gdb-patches

El mié, 12-11-2008 a las 17:28 -0800, Joel Brobecker escribió:
> > As it happens, I had approved a patch that fixes exactly this,
> > but that didn't get checked in:
> > 
> > http://www.sourceware.org/ml/gdb-patches/2008-11/msg00175.html
> > 
> > The patch is slightly more complete as it removes one reference to
> > the gdbsim_ops global. I'll commit that part separately.
> 
> Humpf, in retrospect, I find that the above sounds very ungrateful.
> Sorry about that, Thiago. I am in fact pleased that you fixed the
> problem this fast!

No worries, I didn't get that impression at all. Also, I missed the
patch you mentioned entirely. :-/
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-11-13 15:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-19 17:34 [RFA] Kill ptrace_ops_hack Vladimir Prus
2008-09-13 15:34 ` Daniel Jacobowitz
2008-09-18  0:57 ` Joel Brobecker
2008-11-04 10:20   ` Vladimir Prus
2008-11-05 13:32     ` Joel Brobecker
2008-11-11 22:51     ` Thiago Jung Bauermann
2008-11-13 13:05       ` Joel Brobecker
2008-11-13 13:13         ` Joel Brobecker
2008-11-13 20:33           ` Thiago Jung Bauermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox