* remote.c (remote_disconnect): Add TARGET argument.
authorDaniel Jacobowitz <drow@false.org>
Fri, 5 May 2006 20:08:45 +0000 (20:08 +0000)
committerDaniel Jacobowitz <drow@false.org>
Fri, 5 May 2006 20:08:45 +0000 (20:08 +0000)
* target.c (debug_to_disconnect): Delete.
(update_current_target): Do not inherit to_disconnect.
(target_disconnect): Search for a target to implement to_disconnect.
(setup_target_debug): Do not reference to_disconnect.
* target.h (struct target_ops): Add target argument to
to_disconnect.

gdb/ChangeLog
gdb/remote.c
gdb/target.c
gdb/target.h

index 7b146dfc2159d8640ca60cc4001c485fdcb5153f..f3b1b23519b07d599b3776384d601a2eaef57e32 100644 (file)
@@ -1,3 +1,13 @@
+2006-05-05  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * remote.c (remote_disconnect): Add TARGET argument.
+       * target.c (debug_to_disconnect): Delete.
+       (update_current_target): Do not inherit to_disconnect.
+       (target_disconnect): Search for a target to implement to_disconnect.
+       (setup_target_debug): Do not reference to_disconnect.
+       * target.h (struct target_ops): Add target argument to
+       to_disconnect.
+
 2006-05-06  Fred Fish  <fnf@specifix.com>
 
        * mips-tdep.c (mips_o64_push_dummy_call): Left shift big endian
index d1ffdb55d8dbc9b6d7c082b2e5b3237da5476833..c6ed900f893e9ce4fa1a3793ed79d09d8fe77f54 100644 (file)
@@ -2187,7 +2187,7 @@ remote_detach (char *args, int from_tty)
 /* Same as remote_detach, but don't send the "D" packet; just disconnect.  */
 
 static void
-remote_disconnect (char *args, int from_tty)
+remote_disconnect (struct target_ops *target, char *args, int from_tty)
 {
   if (args)
     error (_("Argument given to \"detach\" when remotely debugging."));
index 52e45270afbfd9d58ed6119991224344f6df3b09..bcb47deec381c54a82656b399f5809dbd9497a4e 100644 (file)
@@ -97,8 +97,6 @@ static void debug_to_attach (char *, int);
 
 static void debug_to_detach (char *, int);
 
-static void debug_to_disconnect (char *, int);
-
 static void debug_to_resume (ptid_t, int, enum target_signal);
 
 static ptid_t debug_to_wait (ptid_t, struct target_waitstatus *);
@@ -388,7 +386,7 @@ update_current_target (void)
       INHERIT (to_attach, t);
       INHERIT (to_post_attach, t);
       INHERIT (to_detach, t);
-      INHERIT (to_disconnect, t);
+      /* Do not inherit to_disconnect.  */
       INHERIT (to_resume, t);
       INHERIT (to_wait, t);
       INHERIT (to_fetch_registers, t);
@@ -483,9 +481,6 @@ update_current_target (void)
   de_fault (to_detach, 
            (void (*) (char *, int)) 
            target_ignore);
-  de_fault (to_disconnect, 
-           (void (*) (char *, int)) 
-           tcomplain);
   de_fault (to_resume, 
            (void (*) (ptid_t, int, enum target_signal)) 
            noprocess);
@@ -1490,7 +1485,19 @@ target_detach (char *args, int from_tty)
 void
 target_disconnect (char *args, int from_tty)
 {
-  (current_target.to_disconnect) (args, from_tty);
+  struct target_ops *t;
+
+  for (t = current_target.beneath; t != NULL; t = t->beneath)
+    if (t->to_disconnect != NULL)
+       {
+         if (targetdebug)
+           fprintf_unfiltered (gdb_stdlog, "target_disconnect (%s, %d)\n",
+                               args, from_tty);
+         t->to_disconnect (t, args, from_tty);
+         return;
+       }
+
+  tcomplain ();
 }
 
 int
@@ -1906,15 +1913,6 @@ debug_to_detach (char *args, int from_tty)
   fprintf_unfiltered (gdb_stdlog, "target_detach (%s, %d)\n", args, from_tty);
 }
 
-static void
-debug_to_disconnect (char *args, int from_tty)
-{
-  debug_target.to_disconnect (args, from_tty);
-
-  fprintf_unfiltered (gdb_stdlog, "target_disconnect (%s, %d)\n",
-                     args, from_tty);
-}
-
 static void
 debug_to_resume (ptid_t ptid, int step, enum target_signal siggnal)
 {
@@ -2521,7 +2519,6 @@ setup_target_debug (void)
   current_target.to_attach = debug_to_attach;
   current_target.to_post_attach = debug_to_post_attach;
   current_target.to_detach = debug_to_detach;
-  current_target.to_disconnect = debug_to_disconnect;
   current_target.to_resume = debug_to_resume;
   current_target.to_wait = debug_to_wait;
   current_target.to_fetch_registers = debug_to_fetch_registers;
@@ -2569,7 +2566,6 @@ setup_target_debug (void)
   current_target.to_enable_exception_callback = debug_to_enable_exception_callback;
   current_target.to_get_current_exception_event = debug_to_get_current_exception_event;
   current_target.to_pid_to_exec_file = debug_to_pid_to_exec_file;
-
 }
 \f
 
index 7decfd7f954f0b895aedc459dbf7767119658733..bf4917fed6d32e3658dcd5aae456cb3efc9f909d 100644 (file)
@@ -303,7 +303,7 @@ struct target_ops
     void (*to_attach) (char *, int);
     void (*to_post_attach) (int);
     void (*to_detach) (char *, int);
-    void (*to_disconnect) (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 *);
     void (*to_fetch_registers) (int);
This page took 0.034174 seconds and 4 git commands to generate.