aboutsummaryrefslogtreecommitdiff
path: root/gdb/infptrace.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-06-08 19:58:15 +0000
committerAndrew Cagney <cagney@redhat.com>2004-06-08 19:58:15 +0000
commitd966f0cbf54fc58741ba50659f6e48dab6081148 (patch)
tree579067a3360adf4ee0a4eeee206a908f87ca4d5f /gdb/infptrace.c
parentd91670b90d86f64037d24b6ce19fc162c373ff45 (diff)
downloadgdb-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/infptrace.c')
-rw-r--r--gdb/infptrace.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/gdb/infptrace.c b/gdb/infptrace.c
index ef86f90..28419d9 100644
--- a/gdb/infptrace.c
+++ b/gdb/infptrace.c
@@ -76,13 +76,6 @@
#define PT_KILL 8 /* Send child a SIGKILL signal */
#endif
-#ifndef PT_ATTACH
-#define PT_ATTACH PTRACE_ATTACH
-#endif
-#ifndef PT_DETACH
-#define PT_DETACH PTRACE_DETACH
-#endif
-
#include "gdbcore.h"
#ifndef NO_SYS_FILE
#include <sys/file.h>
@@ -279,18 +272,25 @@ child_resume (ptid_t ptid, int step, enum target_signal signal)
}
#endif /* CHILD_RESUME */
-
-#ifdef ATTACH_DETACH
/* Start debugging the process whose number is PID. */
int
attach (int pid)
{
errno = 0;
+#ifndef PT_ATTACH
+#ifdef PTRACE_ATTACH
+#define PT_ATTACH PTRACE_ATTACH
+#endif
+#endif
+#ifdef PT_ATTACH
ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0);
if (errno)
perror_with_name ("ptrace");
attach_flag = 1;
return pid;
+#else
+ error ("This system does not support attaching to a process");
+#endif
}
/* Stop debugging the process whose number is PID
@@ -301,13 +301,21 @@ void
detach (int signal)
{
errno = 0;
+#ifndef PT_DETACH
+#ifdef PTRACE_DETACH
+#define PT_DETACH PTRACE_DETACH
+#endif
+#endif
+#ifdef PT_DETACH
ptrace (PT_DETACH, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) 1,
signal);
if (errno)
print_sys_errmsg ("ptrace", errno);
attach_flag = 0;
+#else
+ error ("This system does not support detaching from a process");
+#endif
}
-#endif /* ATTACH_DETACH */
/* Default the type of the ptrace transfer to int. */
#ifndef PTRACE_XFER_TYPE