]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove args from target detach
authorSimon Marchi <simon.marchi@ericsson.com>
Fri, 19 Jan 2018 16:47:24 +0000 (11:47 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Fri, 19 Jan 2018 16:47:24 +0000 (11:47 -0500)
I was looking into adding a parameter to target_detach, and was
wondering what the args parameter was.  It seems like in the distant
past, it was possible to specify a signal number when detaching.  That
signal was injected in the process before it was detached.  There is an
example of code handling this in linux_nat_detach.  With today's GDB, I
can't get this to work.  Doing "detach 15" (15 == SIGTERM) doesn't work,
because detach is a prefix command and doesn't recognize the sub-command
15.  Doing "detach inferiors 15" doesn't work because it expects a list
of inferior id to detach.  Therefore, I don't think there's a way of
invoking detach_command with a non-NULL args.  I also didn't find any
documentation related to this feature.

I assume that this feature stopped working when detach was made a prefix
command, which is in f73adfeb8bae36885e6ea248d12223ab0d5eb9cb (sorry,
there's no commit title) from 2006.  Given that this feature was broken
for such a long time and we haven't heard anything (AFAIK, I did not
find any related bug), I think it's safe to remove it, as well as the
args parameter to target_detach.  If someone wants to re-introduce it, I
would suggest rethinking the user interface, and in particular would
suggest using signal name instead of numbers.

I tried to fix all the impacted code, but I might have forgotten some
spots.  It shouldn't be hard to fix if that's the case.  I also couldn't
build-test everything I changed, especially the nto and solaris stuff.

gdb/ChangeLog:

* target.h (struct target_ops) <to_detach>: Remove args
parameter.
(target_detach): Likewise.
* target.c (dispose_inferior): Adjust.
(target_detach): Remove args parameter, adjust.
* aix-thread.c (aix_thread_detach): Adjust.
* corefile.c (core_file_command): Adjust.
* corelow.c (core_detach): Adjust.
* darwin-nat.c (darwin_detach): Adjust.
* gnu-nat.c (gnu_detach): Adjust.
* inf-ptrace.c (inf_ptrace_detach): Adjust.
* infcmd.c (detach_command): Adjust
* infrun.c (follow_fork_inferior): Adjust.
(handle_vfork_child_exec_or_exit): Adjust.
* linux-fork.c (linux_fork_detach): Remove args parameter.
* linux-fork.h (linux_fork_detach): Likewise.
* linux-nat.c (linux_nat_detach): Likewise, and adjust.
* linux-thread-db.c (thread_db_detach): Likewise.
* nto-procfs.c (procfs_detach): Likewise.
* procfs.c (procfs_detach): Likewise.
(do_detach): Remove signo parameter.
* record.c (record_detach): Remove args parameter.
* record.h (record_detach): Likewise.
* remote-sim.c (gdbsim_detach): Likewise.
* remote.c (remote_detach_1): Likewise.
(remote_detach): Likewise.
(extended_remote_detach): Likewise.
* sol-thread.c (sol_thread_detach): Likewise.
* target-delegates.c: Re-generate.
* top.c (struct qt_args) <args>: Remove field.
(kill_or_detach): Don't pass args.
(quit_force): Don't set args.
* windows-nat.c (windows_detach): Remove args parameter.

25 files changed:
gdb/ChangeLog
gdb/aix-thread.c
gdb/corefile.c
gdb/corelow.c
gdb/darwin-nat.c
gdb/gnu-nat.c
gdb/inf-ptrace.c
gdb/infcmd.c
gdb/infrun.c
gdb/linux-fork.c
gdb/linux-fork.h
gdb/linux-nat.c
gdb/linux-thread-db.c
gdb/nto-procfs.c
gdb/procfs.c
gdb/record.c
gdb/record.h
gdb/remote-sim.c
gdb/remote.c
gdb/sol-thread.c
gdb/target-delegates.c
gdb/target.c
gdb/target.h
gdb/top.c
gdb/windows-nat.c

index 53fde81fca3b52a933104f76d1fdaa83be34f9b5..d96da26eb846313066472c9e83afb260e27074df 100644 (file)
@@ -1,3 +1,39 @@
+2018-01-19  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * target.h (struct target_ops) <to_detach>: Remove args
+       parameter.
+       (target_detach): Likewise.
+       * target.c (dispose_inferior): Adjust.
+       (target_detach): Remove args parameter, adjust.
+       * aix-thread.c (aix_thread_detach): Adjust.
+       * corefile.c (core_file_command): Adjust.
+       * corelow.c (core_detach): Adjust.
+       * darwin-nat.c (darwin_detach): Adjust.
+       * gnu-nat.c (gnu_detach): Adjust.
+       * inf-ptrace.c (inf_ptrace_detach): Adjust.
+       * infcmd.c (detach_command): Adjust
+       * infrun.c (follow_fork_inferior): Adjust.
+       (handle_vfork_child_exec_or_exit): Adjust.
+       * linux-fork.c (linux_fork_detach): Remove args parameter.
+       * linux-fork.h (linux_fork_detach): Likewise.
+       * linux-nat.c (linux_nat_detach): Likewise, and adjust.
+       * linux-thread-db.c (thread_db_detach): Likewise.
+       * nto-procfs.c (procfs_detach): Likewise.
+       * procfs.c (procfs_detach): Likewise.
+       (do_detach): Remove signo parameter.
+       * record.c (record_detach): Remove args parameter.
+       * record.h (record_detach): Likewise.
+       * remote-sim.c (gdbsim_detach): Likewise.
+       * remote.c (remote_detach_1): Likewise.
+       (remote_detach): Likewise.
+       (extended_remote_detach): Likewise.
+       * sol-thread.c (sol_thread_detach): Likewise.
+       * target-delegates.c: Re-generate.
+       * top.c (struct qt_args) <args>: Remove field.
+       (kill_or_detach): Don't pass args.
+       (quit_force): Don't set args.
+       * windows-nat.c (windows_detach): Remove args parameter.
+
 2018-01-19  Yao Qi  <yao.qi@linaro.org>
 
        * arm-linux-tdep.c (arm_linux_gcc_target_options): New function.
index f15845f7bfe9f369332d1114ce44a0468d3f616a..0f0404f0139ec727c6c6b7547a295cc6a185d6e0 100644 (file)
@@ -981,12 +981,12 @@ aix_thread_inferior_created (struct target_ops *ops, int from_tty)
 /* Detach from the process attached to by aix_thread_attach().  */
 
 static void
-aix_thread_detach (struct target_ops *ops, const char *args, int from_tty)
+aix_thread_detach (struct target_ops *ops, int from_tty)
 {
   struct target_ops *beneath = find_target_beneath (ops);
 
   pd_disable ();
-  beneath->to_detach (beneath, args, from_tty);
+  beneath->to_detach (beneath, from_tty);
 }
 
 /* Tell the inferior process to continue running thread PID if != -1
index e39df42c63a94536f5e0d3697bda193d7580cb8c..c5e4f91a07c909102a89e245260add8d0a870b6a 100644 (file)
@@ -68,7 +68,7 @@ core_file_command (const char *filename, int from_tty)
   gdb_assert (core_target != NULL);
 
   if (!filename)
-    (core_target->to_detach) (core_target, filename, from_tty);
+    (core_target->to_detach) (core_target, from_tty);
   else
     (core_target->to_open) (filename, from_tty);
 }
index 3a5256cb1704ecb653579af8404f66e84c96bab5..250f46aa051920ebbd8c04dbd55099241a9473a0 100644 (file)
@@ -464,10 +464,8 @@ core_open (const char *arg, int from_tty)
 }
 
 static void
-core_detach (struct target_ops *ops, const char *args, int from_tty)
+core_detach (struct target_ops *ops, int from_tty)
 {
-  if (args)
-    error (_("Too many arguments"));
   unpush_target (ops);
   reinit_frame_cache ();
   if (from_tty)
index a51d8b11d661143e7e4af2fcd1e5a371d201c974..1441a6ad6d67fdea9c80d6ae04df557679a2f76b 100644 (file)
@@ -1938,7 +1938,7 @@ darwin_attach (struct target_ops *ops, const char *args, int from_tty)
    previously attached.  It *might* work if the program was
    started via fork.  */
 static void
-darwin_detach (struct target_ops *ops, const char *args, int from_tty)
+darwin_detach (struct target_ops *ops, int from_tty)
 {
   pid_t pid = ptid_get_pid (inferior_ptid);
   struct inferior *inf = current_inferior ();
index f2d5fcaa50f965aa747a84d530ab3a2b104c6bda..0debb02ee68186ce903d95ef87f3529e30d1df8f 100644 (file)
@@ -2255,7 +2255,7 @@ gnu_attach (struct target_ops *ops, const char *args, int from_tty)
    previously attached.  It *might* work if the program was
    started via fork.  */
 static void
-gnu_detach (struct target_ops *ops, const char *args, int from_tty)
+gnu_detach (struct target_ops *ops, int from_tty)
 {
   int pid;
 
index c91f15a34555facfa3d3475c2ab37db102381e06..44216c45d621df4899147acfe1ae72e9de25104c 100644 (file)
@@ -241,18 +241,14 @@ inf_ptrace_post_attach (struct target_ops *self, int pid)
 
 #endif
 
-/* Detach from the inferior, optionally passing it the signal
-   specified by ARGS.  If FROM_TTY is non-zero, be chatty about it.  */
+/* Detach from the inferior.  If FROM_TTY is non-zero, be chatty about it.  */
 
 static void
-inf_ptrace_detach (struct target_ops *ops, const char *args, int from_tty)
+inf_ptrace_detach (struct target_ops *ops, int from_tty)
 {
   pid_t pid = ptid_get_pid (inferior_ptid);
-  int sig = 0;
 
   target_announce_detach (from_tty);
-  if (args)
-    sig = atoi (args);
 
 #ifdef PT_DETACH
   /* We'd better not have left any breakpoints in the program or it'll
@@ -260,7 +256,7 @@ inf_ptrace_detach (struct target_ops *ops, const char *args, int from_tty)
      previously attached to the inferior.  It *might* work if we
      started the process ourselves.  */
   errno = 0;
-  ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3)1, sig);
+  ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3)1, 0);
   if (errno != 0)
     perror_with_name (("ptrace"));
 #else
index 976276b694f3c8f192033fd9b69307299621e6cb..8865244fd9ba9af49b6a315c0a80054b98525fa3 100644 (file)
@@ -2976,7 +2976,7 @@ detach_command (const char *args, int from_tty)
 
   disconnect_tracing ();
 
-  target_detach (args, from_tty);
+  target_detach (from_tty);
 
   /* The current inferior process was just detached successfully.  Get
      rid of breakpoints that no longer make sense.  Note we don't do
index e1d11234e09f35b7a7d0fbbd686f7a91e493cafd..d240208172b89c34fb44ab9b433e1cc63838258c 100644 (file)
@@ -606,7 +606,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
                                target_pid_to_str (process_ptid));
            }
 
-         target_detach (NULL, 0);
+         target_detach (0);
        }
 
       /* Note that the detach above makes PARENT_INF dangling.  */
@@ -976,7 +976,7 @@ handle_vfork_child_exec_or_exit (int exec)
                }
            }
 
-         target_detach (NULL, 0);
+         target_detach (0);
 
          /* Put it back.  */
          inf->pspace = pspace;
index 3b0e41a43a0c6337d2ccdae9eceecde3347f08d9..8561157d3d9347f3f961a13ade475425437ea204 100644 (file)
@@ -407,7 +407,7 @@ linux_fork_mourn_inferior (void)
    the first available.  */
 
 void
-linux_fork_detach (const char *args, int from_tty)
+linux_fork_detach (int from_tty)
 {
   /* OK, inferior_ptid is the one we are detaching from.  We need to
      delete it from the fork_list, and switch to the next available
index 2c4f53050312aad9504b5fa17b144595029d3b3c..b1e3ba3e4a442ba975d13d7827c171981cf131a0 100644 (file)
@@ -22,6 +22,6 @@ extern struct fork_info *add_fork (pid_t);
 extern struct fork_info *find_fork_pid (pid_t);
 extern void linux_fork_killall (void);
 extern void linux_fork_mourn_inferior (void);
-extern void linux_fork_detach (const char *, int);
+extern void linux_fork_detach (int);
 extern int forks_exist_p (void);
 extern int linux_fork_checkpointing_p (int);
index a47c49609b964df35236c3d8613de4ace8ce4772..99d12f25262c50f9008e4138a6d5114138311950 100644 (file)
@@ -1497,7 +1497,7 @@ detach_callback (struct lwp_info *lp, void *data)
 }
 
 static void
-linux_nat_detach (struct target_ops *ops, const char *args, int from_tty)
+linux_nat_detach (struct target_ops *ops, int from_tty)
 {
   int pid;
   struct lwp_info *main_lwp;
@@ -1527,21 +1527,14 @@ linux_nat_detach (struct target_ops *ops, const char *args, int from_tty)
         from, but there are other viable forks to debug.  Detach from
         the current fork, and context-switch to the first
         available.  */
-      linux_fork_detach (args, from_tty);
+      linux_fork_detach (from_tty);
     }
   else
     {
-      int signo;
-
       target_announce_detach (from_tty);
 
-      /* Pass on any pending signal for the last LWP, unless the user
-        requested detaching with a different signal (most likely 0,
-        meaning, discard the signal).  */
-      if (args != NULL)
-       signo = atoi (args);
-      else
-       signo = get_detach_signal (main_lwp);
+      /* Pass on any pending signal for the last LWP.  */
+      int signo = get_detach_signal (main_lwp);
 
       detach_one_lwp (main_lwp, &signo);
 
index 299c5ed34a9ac98ea0b0945b8fd3fb23aef29ac7..9dcfc0e98bd147c1c73e741720b0ca4f87f1d07a 100644 (file)
@@ -1090,13 +1090,13 @@ record_thread (struct thread_db_info *info,
 }
 
 static void
-thread_db_detach (struct target_ops *ops, const char *args, int from_tty)
+thread_db_detach (struct target_ops *ops, int from_tty)
 {
   struct target_ops *target_beneath = find_target_beneath (ops);
 
   delete_thread_db_info (ptid_get_pid (inferior_ptid));
 
-  target_beneath->to_detach (target_beneath, args, from_tty);
+  target_beneath->to_detach (target_beneath, from_tty);
 
   /* NOTE: From this point on, inferior_ptid is null_ptid.  */
 
index eab96b940ca0e513d84f90d3f1a038bedc5853b3..2fd2dcf79a920e60a7816ddf17f4a245f62c53d7 100644 (file)
@@ -943,18 +943,14 @@ procfs_xfer_partial (struct target_ops *ops, enum target_object object,
    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 (struct target_ops *ops, const char *args, int from_tty)
+procfs_detach (struct target_ops *ops, int from_tty)
 {
-  int siggnal = 0;
   int pid;
 
   target_announce_detach ();
 
-  if (args)
-    siggnal = atoi (args);
-
   if (siggnal)
-    SignalKill (nto_node (), ptid_get_pid (inferior_ptid), 0, siggnal, 0, 0);
+    SignalKill (nto_node (), ptid_get_pid (inferior_ptid), 0, 0, 0, 0);
 
   close (ctl_fd);
   ctl_fd = -1;
index a939dedb0093fead6028d574819086b9968b1302..491970a787f943e6c5694c85b414daea05d0e565 100644 (file)
@@ -1829,7 +1829,7 @@ proc_iterate_over_threads (procinfo *pi,
    friends.  */
 
 static ptid_t do_attach (ptid_t ptid);
-static void do_detach (int signo);
+static void do_detach ();
 static void proc_trace_syscalls_1 (procinfo *pi, int syscallnum,
                                   int entry_or_exit, int mode, int from_tty);
 
@@ -1924,14 +1924,10 @@ procfs_attach (struct target_ops *ops, const char *args, int from_tty)
 }
 
 static void
-procfs_detach (struct target_ops *ops, const char *args, int from_tty)
+procfs_detach (struct target_ops *ops, int from_tty)
 {
-  int sig = 0;
   int pid = ptid_get_pid (inferior_ptid);
 
-  if (args)
-    sig = atoi (args);
-
   if (from_tty)
     {
       const char *exec_file;
@@ -1945,7 +1941,7 @@ procfs_detach (struct target_ops *ops, const char *args, int from_tty)
       gdb_flush (gdb_stdout);
     }
 
-  do_detach (sig);
+  do_detach ();
 
   inferior_ptid = null_ptid;
   detach_inferior (pid);
@@ -2023,16 +2019,13 @@ do_attach (ptid_t ptid)
 }
 
 static void
-do_detach (int signo)
+do_detach ()
 {
   procinfo *pi;
 
   /* Find procinfo for the main process.  */
   pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid),
                             0); /* FIXME: threads */
-  if (signo)
-    if (!proc_set_current_signal (pi, signo))
-      proc_warn (pi, "do_detach, set_current_signal", __LINE__);
 
   if (!proc_set_traced_signals (pi, &pi->saved_sigset))
     proc_warn (pi, "do_detach, set_traced_signal", __LINE__);
@@ -2049,15 +2042,15 @@ do_detach (int signo)
   if (!proc_set_held_signals (pi, &pi->saved_sighold))
     proc_warn (pi, "do_detach, set_held_signals", __LINE__);
 
-  if (signo || (proc_flags (pi) & (PR_STOPPED | PR_ISTOP)))
-    if (signo || !(pi->was_stopped) ||
-       query (_("Was stopped when attached, make it runnable again? ")))
+  if (proc_flags (pi) & (PR_STOPPED | PR_ISTOP))
+    if (!(pi->was_stopped)
+       || query (_("Was stopped when attached, make it runnable again? ")))
       {
        /* Clear any pending signal.  */
        if (!proc_clear_current_fault (pi))
          proc_warn (pi, "do_detach, clear_current_fault", __LINE__);
 
-       if (signo == 0 && !proc_clear_current_signal (pi))
+       if (!proc_clear_current_signal (pi))
          proc_warn (pi, "do_detach, clear_current_signal", __LINE__);
 
        if (!proc_set_run_on_last_close (pi))
index 767b9f6afd434b326ea91bd7837272905e3c8d77..74a14dc07bf08151d55e1c8fcdbcac0be1a1d47f 100644 (file)
@@ -187,7 +187,7 @@ record_disconnect (struct target_ops *t, const char *args, int from_tty)
 /* See record.h.  */
 
 void
-record_detach (struct target_ops *t, const char *args, int from_tty)
+record_detach (struct target_ops *t, int from_tty)
 {
   gdb_assert (t->to_stratum == record_stratum);
 
@@ -196,7 +196,7 @@ record_detach (struct target_ops *t, const char *args, int from_tty)
   record_stop (t);
   record_unpush (t);
 
-  target_detach (args, from_tty);
+  target_detach (from_tty);
 }
 
 /* See record.h.  */
index 8dae4c6775f461ed177bb0c1cae97a2baeb295ea..a0ca84dff3aee67102b1d8fa3468f4c6b0e459f0 100644 (file)
@@ -88,7 +88,7 @@ extern void record_goto (const char *arg);
 extern void record_disconnect (struct target_ops *, const char *, int);
 
 /* The default "to_detach" target method for record targets.  */
-extern void record_detach (struct target_ops *, const char *, int);
+extern void record_detach (struct target_ops *, int);
 
 /* The default "to_mourn_inferior" target method for record targets.  */
 extern void record_mourn_inferior (struct target_ops *);
index fe36f10f5298b06fe5ee860e203240410f8ade72..edc70d5b3ed8eb4f2531a95d18351bab07779c65 100644 (file)
@@ -77,8 +77,7 @@ static void gdbsim_open (const char *args, int from_tty);
 
 static void gdbsim_close (struct target_ops *self);
 
-static void gdbsim_detach (struct target_ops *ops, const char *args,
-                          int from_tty);
+static void gdbsim_detach (struct target_ops *ops, int from_tty);
 
 static void gdbsim_prepare_to_store (struct target_ops *self,
                                     struct regcache *regcache);
@@ -815,17 +814,16 @@ gdbsim_close (struct target_ops *self)
 /* Takes a program previously attached to and detaches it.
    The program may resume execution (some targets do, some don't) and will
    no longer stop on signals, etc.  We better not have left any breakpoints
-   in the program or it'll die when it hits one.  ARGS is arguments
-   typed by the user (e.g. a signal to send the process).  FROM_TTY
-   says whether to be verbose or not.  */
+   in the program or it'll die when it hits one.  FROM_TTY says whether to be
+   verbose or not.  */
 /* Terminate the open connection to the remote debugger.
    Use this when you want to detach and do something else with your gdb.  */
 
 static void
-gdbsim_detach (struct target_ops *ops, const char *args, int from_tty)
+gdbsim_detach (struct target_ops *ops, int from_tty)
 {
   if (remote_debug)
-    fprintf_unfiltered (gdb_stdlog, "gdbsim_detach: args \"%s\"\n", args);
+    fprintf_unfiltered (gdb_stdlog, "gdbsim_detach\n");
 
   unpush_target (ops);         /* calls gdbsim_close to do the real work */
   if (from_tty)
index a1cd9ae1df341ad5b03efbde661350f34069ea69..01b236fcd30276646fed920ce35e20bcf1e93678 100644 (file)
@@ -5126,16 +5126,13 @@ remote_detach_pid (int pid)
    one.  */
 
 static void
-remote_detach_1 (const char *args, int from_tty)
+remote_detach_1 (int from_tty)
 {
   int pid = ptid_get_pid (inferior_ptid);
   struct remote_state *rs = get_remote_state ();
   struct thread_info *tp = find_thread_ptid (inferior_ptid);
   int is_fork_parent;
 
-  if (args)
-    error (_("Argument given to \"detach\" when remotely debugging."));
-
   if (!target_has_execution)
     error (_("No process to detach from."));
 
@@ -5165,15 +5162,15 @@ remote_detach_1 (const char *args, int from_tty)
 }
 
 static void
-remote_detach (struct target_ops *ops, const char *args, int from_tty)
+remote_detach (struct target_ops *ops, int from_tty)
 {
-  remote_detach_1 (args, from_tty);
+  remote_detach_1 (from_tty);
 }
 
 static void
-extended_remote_detach (struct target_ops *ops, const char *args, int from_tty)
+extended_remote_detach (struct target_ops *ops, int from_tty)
 {
-  remote_detach_1 (args, from_tty);
+  remote_detach_1 (from_tty);
 }
 
 /* Target follow-fork function for remote targets.  On entry, and
index 7c08e39652d0e199d4b5ac2d363913c8957788f6..e724c7e0fab5adef8347431f96e20f70711b926d 100644 (file)
@@ -348,14 +348,14 @@ lwp_to_thread (ptid_t lwp)
    program was started via the normal ptrace (PTRACE_TRACEME).  */
 
 static void
-sol_thread_detach (struct target_ops *ops, const char *args, int from_tty)
+sol_thread_detach (struct target_ops *ops, int from_tty)
 {
   struct target_ops *beneath = find_target_beneath (ops);
 
   sol_thread_active = 0;
   inferior_ptid = pid_to_ptid (ptid_get_pid (main_ph.ptid));
   unpush_target (ops);
-  beneath->to_detach (beneath, args, from_tty);
+  beneath->to_detach (beneath, from_tty);
 }
 
 /* Resume execution of process PTID.  If STEP is nozero, then just
index aaf11d81b85d812aea1d38597978e2c19b95d4ba..6bb7d7fba772848db92ffad138466fefc47a109c 100644 (file)
@@ -28,28 +28,26 @@ debug_post_attach (struct target_ops *self, int arg1)
 }
 
 static void
-delegate_detach (struct target_ops *self, const char *arg1, int arg2)
+delegate_detach (struct target_ops *self, int arg1)
 {
   self = self->beneath;
-  self->to_detach (self, arg1, arg2);
+  self->to_detach (self, arg1);
 }
 
 static void
-tdefault_detach (struct target_ops *self, const char *arg1, int arg2)
+tdefault_detach (struct target_ops *self, int arg1)
 {
 }
 
 static void
-debug_detach (struct target_ops *self, const char *arg1, int arg2)
+debug_detach (struct target_ops *self, int arg1)
 {
   fprintf_unfiltered (gdb_stdlog, "-> %s->to_detach (...)\n", debug_target.to_shortname);
-  debug_target.to_detach (&debug_target, arg1, arg2);
+  debug_target.to_detach (&debug_target, arg1);
   fprintf_unfiltered (gdb_stdlog, "<- %s->to_detach (", debug_target.to_shortname);
   target_debug_print_struct_target_ops_p (&debug_target);
   fputs_unfiltered (", ", gdb_stdlog);
-  target_debug_print_const_char_p (arg1);
-  fputs_unfiltered (", ", gdb_stdlog);
-  target_debug_print_int (arg2);
+  target_debug_print_int (arg1);
   fputs_unfiltered (")\n", gdb_stdlog);
 }
 
index 748d5bb7a25ed6e279b2709b513d9990b88cc7e5..b01e1ac64569101bdbc28f199ed07ac53de186cb 100644 (file)
@@ -2108,7 +2108,7 @@ dispose_inferior (struct inferior *inf, void *args)
       if (target_has_execution)
        target_kill ();
       else
-       target_detach (NULL, 0);
+       target_detach (0);
     }
 
   return 0;
@@ -2141,10 +2141,10 @@ target_preopen (int from_tty)
   target_pre_inferior (from_tty);
 }
 
-/* Detach a target after doing deferred register stores.  */
+/* See target.h.  */
 
 void
-target_detach (const char *args, int from_tty)
+target_detach (int from_tty)
 {
   if (gdbarch_has_global_breakpoints (target_gdbarch ()))
     /* Don't remove global breakpoints here.  They're removed on
@@ -2157,7 +2157,7 @@ target_detach (const char *args, int from_tty)
 
   prepare_for_detach ();
 
-  current_target.to_detach (&current_target, args, from_tty);
+  current_target.to_detach (&current_target, from_tty);
 }
 
 void
index 4781fbc59cf0c9d8c37f44471e9555be671a605f..51841a1cbb95980de5e3372ec1480de5f2b34d3a 100644 (file)
@@ -440,7 +440,7 @@ struct target_ops
     void (*to_attach) (struct target_ops *ops, const char *, int);
     void (*to_post_attach) (struct target_ops *, int)
       TARGET_DEFAULT_IGNORE ();
-    void (*to_detach) (struct target_ops *ops, const char *, int)
+    void (*to_detach) (struct target_ops *ops, int)
       TARGET_DEFAULT_IGNORE ();
     void (*to_disconnect) (struct target_ops *, const char *, int)
       TARGET_DEFAULT_NORETURN (tcomplain ());
@@ -1323,11 +1323,10 @@ extern void target_announce_detach (int from_tty);
 /* Takes a program previously attached to and detaches it.
    The program may resume execution (some targets do, some don't) and will
    no longer stop on signals, etc.  We better not have left any breakpoints
-   in the program or it'll die when it hits one.  ARGS is arguments
-   typed by the user (e.g. a signal to send the process).  FROM_TTY
-   says whether to be verbose or not.  */
+   in the program or it'll die when it hits one.  FROM_TTY says whether to be
+   verbose or not.  */
 
-extern void target_detach (const char *, int);
+extern void target_detach (int from_tty);
 
 /* Disconnect from the current target without resuming it (leaving it
    waiting for a debugger).  */
index 4749cf561d71492603ce83a140ced4f7d48de181..1e6d5137b8422d90eb66d11eb9c1f8c800a8b82a 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1461,7 +1461,6 @@ set_prompt (const char *s)
 
 struct qt_args
 {
-  char *args;
   int from_tty;
 };
 
@@ -1486,7 +1485,7 @@ kill_or_detach (struct inferior *inf, void *args)
       if (target_has_execution)
        {
          if (inf->attach_flag)
-           target_detach (qt->args, qt->from_tty);
+           target_detach (qt->from_tty);
          else
            target_kill ();
        }
@@ -1577,7 +1576,6 @@ quit_force (int *exit_arg, int from_tty)
   else if (return_child_result)
     exit_code = return_child_result_value;
 
-  qt.args = NULL;
   qt.from_tty = from_tty;
 
   /* We want to handle any quit errors and exit regardless.  */
index 29b983296e04b284187573a5439ece4755d5980d..4023089a4dababb4fee62e46d29984fface58d49 100644 (file)
@@ -1931,7 +1931,7 @@ windows_attach (struct target_ops *ops, const char *args, int from_tty)
 }
 
 static void
-windows_detach (struct target_ops *ops, const char *args, int from_tty)
+windows_detach (struct target_ops *ops, int from_tty)
 {
   int detached = 1;