From d966f0cbf54fc58741ba50659f6e48dab6081148 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Tue, 8 Jun 2004 19:58:15 +0000 Subject: 2004-06-08 Andrew Cagney * 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 * gdbint.texinfo (Native Debugging): Delete documentation on ATTACH_DETACH. --- gdb/infptrace.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'gdb/infptrace.c') 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 @@ -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 -- cgit v1.1