diff options
author | Andrew Cagney <cagney@redhat.com> | 2004-06-08 19:58:15 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2004-06-08 19:58:15 +0000 |
commit | d966f0cbf54fc58741ba50659f6e48dab6081148 (patch) | |
tree | 579067a3360adf4ee0a4eeee206a908f87ca4d5f /gdb/inftarg.c | |
parent | d91670b90d86f64037d24b6ce19fc162c373ff45 (diff) | |
download | gdb-d966f0cbf54fc58741ba50659f6e48dab6081148.zip gdb-d966f0cbf54fc58741ba50659f6e48dab6081148.tar.gz gdb-d966f0cbf54fc58741ba50659f6e48dab6081148.tar.bz2 |
2004-06-08 Andrew Cagney <cagney@gnu.org>
* infptrace.c [ATTACH_DETACH]: Remove #ifdef wrappers.
(attach, detach): When neither PT_ATTACH / PT_DETACH nor
PTRACE_ATTACH / PTRACE_DETACH available call error.
(PT_ATTACH, PT_DETACH): Move definition to attach / detach.
* infttrace.c (update_thread_state_after_attach, attach, detach):
Remove #ifdef wrappers.
* inftarg.c (child_attach, child_detach): Remove #ifdef wrappers.
* gnu-nat.c [ATTACH_DETACH]: Remove #ifdef wrappers.
* config/nm-bsd.h (ATTACH_DETACH): Delete.
* config/nm-sysv4.h (ATTACH_DETACH): Delete.
* config/nm-nbsd.h (ATTACH_DETACH): Delete.
* config/nm-linux.h (ATTACH_DETACH): Delete.
* config/rs6000/nm-rs6000.h (ATTACH_DETACH): Delete.
* config/pa/nm-hppah.h (ATTACH_DETACH): Delete.
* config/i386/nm-i386sco5.h (ATTACH_DETACH): Delete.
* config/i386/nm-i386sco4.h (ATTACH_DETACH): Delete.
* config/i386/nm-i386gnu.h (ATTACH_DETACH): Delete.
Index: doc/ChangeLog
2004-06-08 Andrew Cagney <cagney@gnu.org>
* gdbint.texinfo (Native Debugging): Delete documentation on
ATTACH_DETACH.
Diffstat (limited to 'gdb/inftarg.c')
-rw-r--r-- | gdb/inftarg.c | 112 |
1 files changed, 48 insertions, 64 deletions
diff --git a/gdb/inftarg.c b/gdb/inftarg.c index a0e5dc5..384c04e 100644 --- a/gdb/inftarg.c +++ b/gdb/inftarg.c @@ -194,50 +194,40 @@ child_thread_alive (ptid_t ptid) static void child_attach (char *args, int from_tty) { + char *exec_file; + int pid; + char *dummy; + if (!args) error_no_arg ("process-id to attach"); -#ifndef ATTACH_DETACH - error ("Can't attach to a process on this machine."); -#else - { - char *exec_file; - int pid; - char *dummy; - - dummy = args; - pid = strtol (args, &dummy, 0); - /* Some targets don't set errno on errors, grrr! */ - if ((pid == 0) && (args == dummy)) + dummy = args; + pid = strtol (args, &dummy, 0); + /* Some targets don't set errno on errors, grrr! */ + if ((pid == 0) && (args == dummy)) error ("Illegal process-id: %s\n", args); + + if (pid == getpid ()) /* Trying to masturbate? */ + error ("I refuse to debug myself!"); + + if (from_tty) + { + exec_file = (char *) get_exec_file (0); + + if (exec_file) + printf_unfiltered ("Attaching to program: %s, %s\n", exec_file, + target_pid_to_str (pid_to_ptid (pid))); + else + printf_unfiltered ("Attaching to %s\n", + target_pid_to_str (pid_to_ptid (pid))); + + gdb_flush (gdb_stdout); + } - if (pid == getpid ()) /* Trying to masturbate? */ - error ("I refuse to debug myself!"); - - if (from_tty) - { - exec_file = (char *) get_exec_file (0); - - if (exec_file) - printf_unfiltered ("Attaching to program: %s, %s\n", exec_file, - target_pid_to_str (pid_to_ptid (pid))); - else - printf_unfiltered ("Attaching to %s\n", - target_pid_to_str (pid_to_ptid (pid))); - - gdb_flush (gdb_stdout); - } - - attach (pid); - - inferior_ptid = pid_to_ptid (pid); - push_target (&child_ops); - - /* Do this first, before anything has had a chance to query the - inferiors symbol table or similar. */ - observer_notify_inferior_created (¤t_target, from_tty); - } -#endif /* ATTACH_DETACH */ + attach (pid); + + inferior_ptid = pid_to_ptid (pid); + push_target (&child_ops); } #if !defined(CHILD_POST_ATTACH) @@ -260,31 +250,25 @@ child_post_attach (int pid) static void child_detach (char *args, int from_tty) { -#ifdef ATTACH_DETACH - { - int siggnal = 0; - int pid = PIDGET (inferior_ptid); - - if (from_tty) - { - char *exec_file = get_exec_file (0); - if (exec_file == 0) - exec_file = ""; - printf_unfiltered ("Detaching from program: %s, %s\n", exec_file, - target_pid_to_str (pid_to_ptid (pid))); - gdb_flush (gdb_stdout); - } - if (args) - siggnal = atoi (args); - - detach (siggnal); - - inferior_ptid = null_ptid; - unpush_target (&child_ops); - } -#else - error ("This version of Unix does not support detaching a process."); -#endif + int siggnal = 0; + int pid = PIDGET (inferior_ptid); + + if (from_tty) + { + char *exec_file = get_exec_file (0); + if (exec_file == 0) + exec_file = ""; + printf_unfiltered ("Detaching from program: %s, %s\n", exec_file, + target_pid_to_str (pid_to_ptid (pid))); + gdb_flush (gdb_stdout); + } + if (args) + siggnal = atoi (args); + + detach (siggnal); + + inferior_ptid = null_ptid; + unpush_target (&child_ops); } /* Get ready to modify the registers array. On machines which store |