#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>
return wstate;
}
+#ifndef KILL_INFERIOR
void
kill_inferior (void)
{
ptrace_wait (null_ptid, &status);
target_mourn_inferior ();
}
+#endif /* KILL_INFERIOR */
#ifndef CHILD_RESUME
}
#endif /* CHILD_RESUME */
\f
-
-#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
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 && errno != ESRCH)
- perror_with_name ("ptrace");
+ 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 */
\f
/* Default the type of the ptrace transfer to int. */
#ifndef PTRACE_XFER_TYPE
/* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr;
char mess[128]; /* For messages */
- register int i;
+ int i;
unsigned int offset; /* Offset of registers within the u area. */
char buf[MAX_REGISTER_SIZE];
int tid;
if (CANNOT_FETCH_REGISTER (regno))
{
- memset (buf, '\0', REGISTER_RAW_SIZE (regno)); /* Supply zeroes */
+ memset (buf, '\0', DEPRECATED_REGISTER_RAW_SIZE (regno)); /* Supply zeroes */
supply_register (regno, buf);
return;
}
offset = U_REGS_OFFSET;
regaddr = register_addr (regno, offset);
- for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE))
+ for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE))
{
errno = 0;
*(PTRACE_XFER_TYPE *) & buf[i] = ptrace (PT_READ_U, tid,
/* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr;
char mess[128]; /* For messages */
- register int i;
+ int i;
unsigned int offset; /* Offset of registers within the u area. */
int tid;
char buf[MAX_REGISTER_SIZE];
regcache_collect (regno, buf);
/* Store the local buffer into the inferior a chunk at the time. */
- for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE))
+ for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE))
{
errno = 0;
ptrace (PT_WRITE_U, tid, (PTRACE_ARG3_TYPE) regaddr,
if (errno)
return 0;
}
-#ifdef CLEAR_INSN_CACHE
- CLEAR_INSN_CACHE ();
-#endif
}
else
{