summaryrefslogtreecommitdiffstats
path: root/gdb/infptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/infptrace.c')
-rw-r--r--gdb/infptrace.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/gdb/infptrace.c b/gdb/infptrace.c
index 011224e4ae..0013e91b97 100644
--- a/gdb/infptrace.c
+++ b/gdb/infptrace.c
@@ -1,5 +1,6 @@
/* Low level Unix child interface to ptrace, for GDB when running under Unix.
- Copyright 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+ Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,6 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "frame.h"
#include "inferior.h"
#include "target.h"
+#include "gdb_string.h"
#ifdef USG
#include <sys/types.h>
@@ -69,7 +71,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Don't think this is used anymore. On the sequent (not sure whether it's
dynix or ptx or both), it is included unconditionally by sys/user.h and
not protected against multiple inclusion. */
-#include <sys/stat.h>
+#include "gdb_stat.h"
#endif
#if !defined (FETCH_INFERIOR_REGISTERS)
@@ -110,13 +112,18 @@ kill_inferior ()
if (inferior_pid == 0)
return;
/* ptrace PT_KILL only works if process is stopped!!! So stop it with
- a real signal first, if we can. */
+ a real signal first, if we can. FIXME: This is bogus. When the inferior
+ is not stopped, GDB should just be waiting for it. Either the following
+ line is unecessary, or there is some problem elsewhere in GDB which
+ causes us to get here when the inferior is not stopped. */
kill (inferior_pid, SIGKILL);
ptrace (PT_KILL, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0);
wait ((int *)0);
target_mourn_inferior ();
}
+#ifndef CHILD_RESUME
+
/* Resume execution of the inferior process.
If STEP is nonzero, single-step it.
If SIGNAL is nonzero, give it that signal. */
@@ -131,15 +138,9 @@ child_resume (pid, step, signal)
if (pid == -1)
/* Resume all threads. */
-#ifdef PIDGET
- /* This is for Lynx, and should be cleaned up by having Lynx be
- a separate debugging target, with its own target_resume function. */
- pid = PIDGET (inferior_pid);
-#else
/* I think this only gets used in the non-threaded case, where "resume
all threads" and "resume inferior_pid" are the same. */
pid = inferior_pid;
-#endif
/* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where
it was. (If GDB wanted it to start some other way, we have already
@@ -160,6 +161,8 @@ child_resume (pid, step, signal)
if (errno)
perror_with_name ("ptrace");
}
+#endif /* CHILD_RESUME */
+
#ifdef ATTACH_DETACH
/* Start debugging the process whose number is PID. */
@@ -243,7 +246,8 @@ static void
fetch_register (regno)
int regno;
{
- register unsigned int regaddr;
+ /* This isn't really an address. But ptrace thinks of it as one. */
+ CORE_ADDR regaddr;
char buf[MAX_REGISTER_RAW_SIZE];
char mess[128]; /* For messages */
register int i;
@@ -283,9 +287,14 @@ void
fetch_inferior_registers (regno)
int regno;
{
+ int numregs;
+
if (regno == -1)
- for (regno = 0; regno < NUM_REGS; regno++)
- fetch_register (regno);
+ {
+ numregs = ARCH_NUM_REGS;
+ for (regno = 0; regno < numregs; regno++)
+ fetch_register (regno);
+ }
else
fetch_register (regno);
}
@@ -303,9 +312,10 @@ void
store_inferior_registers (regno)
int regno;
{
- register unsigned int regaddr;
+ /* This isn't really an address. But ptrace thinks of it as one. */
+ CORE_ADDR regaddr;
char buf[80];
- register int i;
+ register int i, numregs;
unsigned int offset = U_REGS_OFFSET;
@@ -327,7 +337,8 @@ store_inferior_registers (regno)
}
else
{
- for (regno = 0; regno < NUM_REGS; regno++)
+ numregs = ARCH_NUM_REGS;
+ for (regno = 0; regno < numregs; regno++)
{
if (CANNOT_STORE_REGISTER (regno))
continue;
OpenPOWER on IntegriCloud