aboutsummaryrefslogtreecommitdiff
path: root/gdb/infptrace.c
diff options
context:
space:
mode:
authorJ.T. Conklin <jtc@acorntoolworks.com>1995-08-01 20:14:27 +0000
committerJ.T. Conklin <jtc@acorntoolworks.com>1995-08-01 20:14:27 +0000
commit2b57629364528ef2fd913154e58f626123d51f1c (patch)
tree649b55da772d6aa5e9190ebcfa4bee6a5a31f998 /gdb/infptrace.c
parenta1bdcf913a6f7ee2bbb715dd48b1a75e10a43414 (diff)
downloadgdb-2b57629364528ef2fd913154e58f626123d51f1c.zip
gdb-2b57629364528ef2fd913154e58f626123d51f1c.tar.gz
gdb-2b57629364528ef2fd913154e58f626123d51f1c.tar.bz2
* configure.in: Check for working mmap, ansi headers, string.h,
strings.h, and memory.h. * configure: Regenerated. * gdb_stat.h: New file, "portable" <sys/stat.h>. * gdb_string.h: New file, "portable" <string.h>. * altos-xdep.c, arm-tdep.c, arm-xdep.c, convex-tdep.c, convex-xdep.c, coredep.c, cxux-nat.c, dbxread.c, exec.c, gould-xdep.c, hppa-tdep.c, i386aix-nat.c, i386b-nat.c, i386mach-nat.c, i386v-nat.c, infptrace.c, m88k-nat.c, main.c, mdebugread.c, objfiles.c, os9kread.c, procfs.c, pyr-xdep.c, rs6000-nat.c, source.c, standalone.c, stuff.c, sun386-nat.c, symfile.c, symm-nat.c, symm-tdep.c, symtab.c, top.c, ultra3-nat.c, ultra3-xdep.c, umax-xdep.c, xcoffread.c: Include "gdb_stat.h" instead of <sys/stat.h>. * alpha-tdep.c, breakpoint.c, buildsym.c, c-typeprint.c, ch-typeprint.c, coffread.c, command.c, core-sol2.c, core-svr4.c, core.c, corelow.c, cp-valprint.c, dbxread.c, dcache.c, demangle.c, dpx2-nat.c, dstread.c, dwarfread.c, elfread.c, environ.c, eval.c, exec.c, f-lang.c, f-typeprint.c, f-valprint.c, findvar.c, fork-child.c, gdbtypes.c, hpread.c, i386-tdep.c, infcmd.c, inflow.c, infptrace.c, infrun.c, irix5-nat.c, language.c, m2-typeprint.c, main.c, mdebugread.c, minsyms.c, mipsread.c, monitor.c, nlmread.c, objfiles.c, os9kread.c, osfsolib.c, parse.c, printcmd.c, procfs.c, regex.c, remote-adapt.c, remote-arc.c, remote-array.c, remote-bug.c, remote-e7000.c, remote-eb.c, remote-es.c, remote-hms.c, remote-mm.c, remote-os9k.c, remote-pa.c, remote-sim.c, remote-st.c, remote-udi.c, remote-utils.c, remote-vx.c, remote-vx29k.c, remote-vx68.c, remote-vx960.c, remote-vxmips.c, remote-vxsparc.c, remote.c, solib.c, somread.c, source.c, stabsread.c, stack.c, symfile.c, symmisc.c, symtab.c, target.c, top.c, typeprint.c, utils.c, valarith.c, valops.c, valprint.c, values.c, xcoffread.c: Include "gdb_string.h" instead of <string.h>. * gdbtk.c: Likewise. * config/xm-sysv4.h, i386/xm-ptx.h, m68k/xm-sun3os4.h, sparc/xm-sun4os4.h (HAVE_MMAP): Removed. * config/xm-lynx.h, config/i386/xm-ptx.h, config/m68k/nm-apollo68b.h, config/m68k/xm-hp300hpux.h, config/mips/xm-irix3.h, config/mips/xm-mips.h, config/mips/xm-news-mips.h, config/mips/xm-riscos.h, config/pa/hppah.h, config/rs6000/xm-rs6000.h, config/sparc/xm-sun4os4.h, config/sparc/xm-sun4sol2.h, config/vax/xm-vaxbsd.h, config/vax/xm-vaxult.h, config/vax/xm-vaxult2.h (MEM_FNS_DECLARED): Removed. * config/mips/xm-irix3.h, config/mips/xm-mips.h, config/pa/xm-hppah.h (memcpy, memset): Removed declarations.
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 011224e..0013e91 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;