aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-11-20 16:52:22 +0000
committerMark Kettenis <kettenis@gnu.org>2004-11-20 16:52:22 +0000
commitf1bc22da7241ea978b2ac518c3cb9fb3cb04c836 (patch)
tree25736124bf143b9e6842d5a931237b0500e5556b
parente31272c3a60f748be9b91fca572af74ca0f0d111 (diff)
downloadgdb-f1bc22da7241ea978b2ac518c3cb9fb3cb04c836.zip
gdb-f1bc22da7241ea978b2ac518c3cb9fb3cb04c836.tar.gz
gdb-f1bc22da7241ea978b2ac518c3cb9fb3cb04c836.tar.bz2
* gdb_ptrace.h [PTRACE_TYPE_ARG5] (ptrace): New macro.
* infptrace.c (call_ptrace): Simply call ptrace with four arguments.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/gdb_ptrace.h10
-rw-r--r--gdb/infptrace.c77
3 files changed, 15 insertions, 76 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4c8cfe3..f280853 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2004-11-20 Mark Kettenis <kettenis@gnu.org>
+ * gdb_ptrace.h [PTRACE_TYPE_ARG5] (ptrace): New macro.
+ * infptrace.c (call_ptrace): Simply call ptrace with four
+ arguments.
+
* dbxread.c (process_one_symbol): Fix a few coding standard
issues. Improve code formatting.
diff --git a/gdb/gdb_ptrace.h b/gdb/gdb_ptrace.h
index 62a9949..f060ce6 100644
--- a/gdb/gdb_ptrace.h
+++ b/gdb/gdb_ptrace.h
@@ -107,8 +107,18 @@
/* Some systems, in particular DEC OSF/1, Digital Unix, Compaq Tru64
or whatever it's called these days, don't provide a prototype for
ptrace. Provide one to silence compiler warnings. */
+
#ifndef HAVE_DECL_PTRACE
extern PTRACE_TYPE_RET ptrace();
#endif
+/* Some systems, at least AIX and HP-UX have a ptrace with five
+ arguments. Since we never use the fifth argument, define a ptrace
+ macro that calls the real ptrace with the last argument set to
+ zero. */
+
+#ifdef PTRACE_TYPE_ARG5
+# define ptrace(request, pid, addr, data) ptrace (request, pid, addr, data, 0)
+#endif
+
#endif /* gdb_ptrace.h */
diff --git a/gdb/infptrace.c b/gdb/infptrace.c
index ec4ad16..1a15029 100644
--- a/gdb/infptrace.c
+++ b/gdb/infptrace.c
@@ -54,87 +54,12 @@ static void udot_info (char *, int);
void _initialize_infptrace (void);
-/* This function simply calls ptrace with the given arguments.
- It exists so that all calls to ptrace are isolated in this
- machine-dependent file. */
int
call_ptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data)
{
- int pt_status = 0;
-
-#if 0
- int saved_errno;
-
- printf ("call_ptrace(request=%d, pid=%d, addr=0x%x, data=0x%x)",
- request, pid, addr, data);
-#endif
-#if defined(PT_SETTRC)
- /* If the parent can be told to attach to us, try to do it. */
- if (request == PT_SETTRC)
- {
- errno = 0;
-#ifndef PTRACE_TYPE_ARG5
- pt_status = ptrace (PT_SETTRC, pid, addr, data);
-#else
- /* Deal with HPUX 8.0 braindamage. We never use the
- calls which require the fifth argument. */
- pt_status = ptrace (PT_SETTRC, pid, addr, data, 0);
-#endif
- if (errno)
- perror_with_name ("ptrace");
-#if 0
- printf (" = %d\n", pt_status);
-#endif
- if (pt_status < 0)
- return pt_status;
- else
- return parent_attach_all (pid, addr, data);
- }
-#endif
-
-#if defined(PT_CONTIN1)
- /* On HPUX, PT_CONTIN1 is a form of continue that preserves pending
- signals. If it's available, use it. */
- if (request == PT_CONTINUE)
- request = PT_CONTIN1;
-#endif
-
-#if defined(PT_SINGLE1)
- /* On HPUX, PT_SINGLE1 is a form of step that preserves pending
- signals. If it's available, use it. */
- if (request == PT_STEP)
- request = PT_SINGLE1;
-#endif
-
-#if 0
- saved_errno = errno;
- errno = 0;
-#endif
-#ifndef PTRACE_TYPE_ARG5
- pt_status = ptrace (request, pid, addr, data);
-#else
- /* Deal with HPUX 8.0 braindamage. We never use the
- calls which require the fifth argument. */
- pt_status = ptrace (request, pid, addr, data, 0);
-#endif
-
-#if 0
- if (errno)
- printf (" [errno = %d]", errno);
-
- errno = saved_errno;
- printf (" = 0x%x\n", pt_status);
-#endif
- return pt_status;
+ return ptrace (request, pid, addr, data);
}
-
-#if defined (DEBUG_PTRACE) || defined (PTRACE_TYPE_ARG5)
-/* For the rest of the file, use an extra level of indirection */
-/* This lets us breakpoint usefully on call_ptrace. */
-#define ptrace call_ptrace
-#endif
-
/* Wait for a process to finish, possibly running a target-specific
hook before returning. */