aboutsummaryrefslogtreecommitdiff
path: root/gdb/infptrace.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-08-21 08:56:38 +0000
committerMark Kettenis <kettenis@gnu.org>2004-08-21 08:56:38 +0000
commit11003ae34025182d5fb4bfedf2fdc2427c4c54a1 (patch)
tree54d8e8276728dcaa746b6b2e91f3e1e8fc7fab87 /gdb/infptrace.c
parentea5158d820d069db7995f69bd84663394bb299f1 (diff)
downloadgdb-11003ae34025182d5fb4bfedf2fdc2427c4c54a1.zip
gdb-11003ae34025182d5fb4bfedf2fdc2427c4c54a1.tar.gz
gdb-11003ae34025182d5fb4bfedf2fdc2427c4c54a1.tar.bz2
* gdb_ptrace.h: New file.
* infptrace.c: Include "gdb_ptrace.h" instead of <ptrace.h> or <sys/ptrace.h>. (PT_READ_I, PT_READ_D, PT_READ_U, PT_WRITE_I, PT_WRITE_D) (PT_WRITE_U, PT_CONTINUE, PT_STEP, PT_KILL): Remove defines. (attach): Don't define PT_ATTACH. (detach): Don't define PT_DETACH. * Makefile.in (gdb_ptrace_h): New variable. (infptrace.o): Update dependencies.
Diffstat (limited to 'gdb/infptrace.c')
-rw-r--r--gdb/infptrace.c50
1 files changed, 3 insertions, 47 deletions
diff --git a/gdb/infptrace.c b/gdb/infptrace.c
index f95bf13..fb4629a 100644
--- a/gdb/infptrace.c
+++ b/gdb/infptrace.c
@@ -40,41 +40,7 @@
#include <signal.h>
#include <sys/ioctl.h>
-#ifdef HAVE_PTRACE_H
-#include <ptrace.h>
-#else
-#ifdef HAVE_SYS_PTRACE_H
-#include <sys/ptrace.h>
-#endif
-#endif
-
-#if !defined (PT_READ_I)
-#define PT_READ_I 1 /* Read word from text space */
-#endif
-#if !defined (PT_READ_D)
-#define PT_READ_D 2 /* Read word from data space */
-#endif
-#if !defined (PT_READ_U)
-#define PT_READ_U 3 /* Read word from kernel user struct */
-#endif
-#if !defined (PT_WRITE_I)
-#define PT_WRITE_I 4 /* Write word to text space */
-#endif
-#if !defined (PT_WRITE_D)
-#define PT_WRITE_D 5 /* Write word to data space */
-#endif
-#if !defined (PT_WRITE_U)
-#define PT_WRITE_U 6 /* Write word to kernel user struct */
-#endif
-#if !defined (PT_CONTINUE)
-#define PT_CONTINUE 7 /* Continue after signal */
-#endif
-#if !defined (PT_STEP)
-#define PT_STEP 9 /* Set flag for single stepping */
-#endif
-#if !defined (PT_KILL)
-#define PT_KILL 8 /* Send child a SIGKILL signal */
-#endif
+#include "gdb_ptrace.h"
#include "gdbcore.h"
#ifdef HAVE_SYS_FILE_H
@@ -272,13 +238,8 @@ child_resume (ptid_t ptid, int step, enum target_signal signal)
int
attach (int pid)
{
- errno = 0;
-#ifndef PT_ATTACH
-#ifdef PTRACE_ATTACH
-#define PT_ATTACH PTRACE_ATTACH
-#endif
-#endif
#ifdef PT_ATTACH
+ errno = 0;
ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3) 0, 0);
if (errno)
perror_with_name ("ptrace");
@@ -296,13 +257,8 @@ attach (int pid)
void
detach (int signal)
{
- errno = 0;
-#ifndef PT_DETACH
-#ifdef PTRACE_DETACH
-#define PT_DETACH PTRACE_DETACH
-#endif
-#endif
#ifdef PT_DETACH
+ errno = 0;
ptrace (PT_DETACH, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) 1,
signal);
if (errno)