aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/config/i386/.Sanitize8
-rw-r--r--gdb/config/i386/nm-ptx4.h58
-rw-r--r--gdb/config/i386/ptx.mh4
-rw-r--r--gdb/config/i386/ptx.mt3
-rw-r--r--gdb/config/i386/ptx4.mh7
-rw-r--r--gdb/config/i386/ptx4.mt3
-rw-r--r--gdb/config/i386/tm-ptx.h232
-rw-r--r--gdb/config/i386/tm-ptx4.h24
-rw-r--r--gdb/config/i386/xm-ptx.h48
-rw-r--r--gdb/config/i386/xm-ptx4.h25
-rw-r--r--gdb/configure.in5
-rw-r--r--gdb/ptx4-nat.c209
-rw-r--r--gdb/symm-nat.c50
14 files changed, 680 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dfc305d..4c8419d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+Fri Mar 25 12:40:41 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+
+ * valprint.c (val_print): Remove inaccurate comment about what
+ types can be stub types.
+
+ * config/i386/ptx.mh (XDEPFILES): Add coredep.o. Delete infptrace.o.
+ * symm-nat.c (child_wait, _initialize_symm_nat, kill_inferior):
+ Supply alternate version if ATTACH_DETACH is not defined.
+ * ptx4-nat.c, config/i386/{nm-ptx4.h, ptx4.mh, ptx.mt, ptx4.mt,
+ tm-ptx.h, tm-ptx4.h, xm-ptx.h, xm-ptx4.h}: New files.
+ * configure.in: Recognize i[34]86-sequent-sysv4* host.
+
Fri Mar 25 10:14:03 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
* hppa-tdep.c (skip_prologue): Return "pc" not zero
diff --git a/gdb/config/i386/.Sanitize b/gdb/config/i386/.Sanitize
index 647400c..5ce8e5e 100644
--- a/gdb/config/i386/.Sanitize
+++ b/gdb/config/i386/.Sanitize
@@ -58,9 +58,13 @@ nm-i386sco4.h
nm-i386v.h
nm-i386v4.h
nm-linux.h
+nm-ptx4.h
nm-sun386.h
nm-symmetry.h
ptx.mh
+ptx.mt
+ptx4.mh
+ptx4.mt
sun386.mh
sun386.mt
symmetry.mh
@@ -75,6 +79,8 @@ tm-i386os9k.h
tm-i386v.h
tm-i386v4.h
tm-linux.h
+tm-ptx.h
+tm-ptx4.h
tm-sun386.h
tm-symmetry.h
xm-go32.h
@@ -89,6 +95,8 @@ xm-i386v.h
xm-i386v32.h
xm-i386v4.h
xm-linux.h
+xm-ptx.h
+xm-ptx4.h
xm-sun386.h
xm-symmetry.h
diff --git a/gdb/config/i386/nm-ptx4.h b/gdb/config/i386/nm-ptx4.h
index e69de29..654f9b4 100644
--- a/gdb/config/i386/nm-ptx4.h
+++ b/gdb/config/i386/nm-ptx4.h
@@ -0,0 +1,58 @@
+/* Definitions to make GDB run on a Sequent Symmetry under ptx
+ with Weitek 1167 and i387 support.
+ Copyright 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include "nm-sysv4.h"
+
+#undef USE_PROC_FS
+
+#include "nm-symmetry.h"
+
+#define PTRACE_READ_REGS(pid,regaddr) mptrace (XPT_RREGS, (pid), (regaddr), 0)
+#define PTRACE_WRITE_REGS(pid,regaddr) \
+ mptrace (XPT_WREGS, (pid), (regaddr), 0)
+
+/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */
+
+#define FETCH_INFERIOR_REGISTERS
+
+#define CHILD_WAIT
+struct target_waitstatus;
+extern int child_wait PARAMS ((int, struct target_waitstatus *));
+
+/*
+ * ptx does attach as of ptx version 2.1. Prior to that, the interface
+ * exists but does not work.
+ *
+ * FIXME: Using attach/detach requires using the ptx MPDEBUGGER
+ * interface. There are still problems with that, so for now don't
+ * enable attach/detach. If you turn it on anyway, it will mostly
+ * work, but has a number of bugs. -fubar, 2/94.
+ */
+/*#define ATTACH_DETACH 1*/
+#undef ATTACH_DETACH
+#define PTRACE_ATTACH XPT_DEBUG
+#define PTRACE_DETACH XPT_UNDEBUG
+/*
+ * The following drivel is needed because there are two ptrace-ish
+ * calls on ptx: ptrace() and mptrace(), each of which does about half
+ * of the ptrace functions.
+ */
+#define PTRACE_ATTACH_CALL(pid) ptx_do_attach(pid)
+#define PTRACE_DETACH_CALL(pid, signo) ptx_do_detach(pid, signo)
diff --git a/gdb/config/i386/ptx.mh b/gdb/config/i386/ptx.mh
index cd2bedd..20e17d8 100644
--- a/gdb/config/i386/ptx.mh
+++ b/gdb/config/i386/ptx.mh
@@ -1,6 +1,6 @@
# Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387.
-XDEPFILES= infptrace.o inftarg.o fork-child.o symm-nat.o corelow.o
-XM_FILE= xm-symmetry.h
+XDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o coredep.o
+XM_FILE= xm-ptx.h
NAT_FILE= nm-symmetry.h
XM_CLIBS= -lPW -lseq
REGEX=regex.o
diff --git a/gdb/config/i386/ptx.mt b/gdb/config/i386/ptx.mt
index e69de29..cfa8c6e 100644
--- a/gdb/config/i386/ptx.mt
+++ b/gdb/config/i386/ptx.mt
@@ -0,0 +1,3 @@
+# Target: Sequent Symmetry running ptx 2.0, with Weitek 1167 or i387.
+TDEPFILES= exec.o symm-tdep.o i386-pinsn.o i387-tdep.o i386-tdep.o
+TM_FILE= tm-ptx.h
diff --git a/gdb/config/i386/ptx4.mh b/gdb/config/i386/ptx4.mh
index e69de29..dd06a9c 100644
--- a/gdb/config/i386/ptx4.mh
+++ b/gdb/config/i386/ptx4.mh
@@ -0,0 +1,7 @@
+# Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387.
+XDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o coredep.o solib.o core-svr4.o
+XM_FILE= xm-ptx4.h
+NAT_FILE= nm-ptx4.h
+XM_CLIBS= -lseq
+REGEX=regex.o
+REGEX1=regex.o
diff --git a/gdb/config/i386/ptx4.mt b/gdb/config/i386/ptx4.mt
index e69de29..cc1600d 100644
--- a/gdb/config/i386/ptx4.mt
+++ b/gdb/config/i386/ptx4.mt
@@ -0,0 +1,3 @@
+# Target: Sequent Symmetry running ptx 4.0, with Weitek 1167 or i387.
+TDEPFILES= exec.o symm-tdep.o i386-pinsn.o i387-tdep.o i386-tdep.o
+TM_FILE= tm-ptx4.h
diff --git a/gdb/config/i386/tm-ptx.h b/gdb/config/i386/tm-ptx.h
index e69de29..6b556cd 100644
--- a/gdb/config/i386/tm-ptx.h
+++ b/gdb/config/i386/tm-ptx.h
@@ -0,0 +1,232 @@
+/* Target machine definitions for GDB on a Sequent Symmetry under ptx
+ with Weitek 1167 and i387 support.
+ Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
+ Symmetry version by Jay Vosburgh (fubar@sequent.com).
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* I don't know if this will work for cross-debugging, even if you do get
+ a copy of the right include file. */
+#include <sys/reg.h>
+
+/*
+#define SDB_REG_TO_REGNUM(value) ptx_coff_regno_to_gdb(value)
+extern int ptx_coff_regno_to_gdb();
+*/
+
+#define START_INFERIOR_TRAPS_EXPECTED 2
+
+/* Amount PC must be decremented by after a breakpoint.
+ This is often the number of bytes in BREAKPOINT
+ but not always. */
+
+#define DECR_PC_AFTER_BREAK 0
+
+#ifdef SEQUENT_PTX4
+#include "i386/tm-i386v4.h"
+#else /* !SEQUENT_PTX4 */
+#include "i386/tm-i386v.h"
+#endif
+
+#if 0
+ --- this code can't be used unless we know we are running native,
+ since it uses host specific ptrace calls.
+/* code for 80387 fpu. Functions are from i386-dep.c, copied into
+ * symm-dep.c.
+ */
+#define FLOAT_INFO { i386_float_info(); }
+#endif
+
+/* Number of machine registers */
+#undef NUM_REGS
+#define NUM_REGS 49
+
+/* Initializer for an array of names of registers.
+ There should be NUM_REGS strings in this initializer. */
+
+#undef REGISTER_NAMES
+#define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \
+ "esp", "ebp", "esi", "edi", \
+ "eip", "eflags", "st0", "st1", "st2", \
+ "st3", "st4", "st5", "st6", "st7", \
+ "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7", \
+ "fp8", "fp9", "fp10", "fp11", "fp12", \
+ "fp13", "fp14", "fp15", "fp16", "fp17", \
+ "fp18", "fp19", "fp20", "fp21", "fp22", \
+ "fp23", "fp24", "fp25", "fp26", "fp27", \
+ "fp28", "fp29", "fp30", "fp31" }
+
+/* Register numbers of various important registers.
+ Note that some of these values are "real" register numbers,
+ and correspond to the general registers of the machine,
+ and some are "phony" register numbers which are too large
+ to be actual register numbers as far as the user is concerned
+ but do serve to get the desired values when passed to read_register. */
+
+#define EAX_REGNUM 0
+#define ECX_REGNUM 1
+#define EDX_REGNUM 2
+#define EBX_REGNUM 3
+
+#define ESP_REGNUM 4
+#define EBP_REGNUM 5
+
+#define ESI_REGNUM 6
+#define EDI_REGNUM 7
+
+#define EIP_REGNUM 8
+#define EFLAGS_REGNUM 9
+
+#define ST0_REGNUM 10
+#define ST1_REGNUM 11
+#define ST2_REGNUM 12
+#define ST3_REGNUM 13
+
+#define ST4_REGNUM 14
+#define ST5_REGNUM 15
+#define ST6_REGNUM 16
+#define ST7_REGNUM 17
+
+#define FP1_REGNUM 18 /* first 1167 register */
+/* Get %fp2 - %fp31 by addition, since they are contiguous */
+
+#undef SP_REGNUM
+#define SP_REGNUM ESP_REGNUM /* Contains address of top of stack */
+#undef FP_REGNUM
+#define FP_REGNUM EBP_REGNUM /* Contains address of executing stack frame */
+#undef PC_REGNUM
+#define PC_REGNUM EIP_REGNUM /* Contains program counter */
+#undef PS_REGNUM
+#define PS_REGNUM EFLAGS_REGNUM /* Contains processor status */
+
+/*
+ * For ptx, this is a little bit bizarre, since the register block
+ * is below the u area in memory. This means that blockend here ends
+ * up being negative (for the call from coredep.c) since the value in
+ * u.u_ar0 will be less than KERNEL_U_ADDR (and coredep.c passes us
+ * u.u_ar0 - KERNEL_U_ADDR in blockend). Since we also define
+ * FETCH_INFERIOR_REGISTERS (and supply our own functions for that),
+ * the core file case will be the only use of this function.
+ */
+
+#define REGISTER_U_ADDR(addr, blockend, regno) \
+{ (addr) = ptx_register_u_addr((blockend), (regno)); }
+
+extern int
+ptx_register_u_addr PARAMS ((int, int));
+
+
+/* Total amount of space needed to store our copies of the machine's
+ register state, the array `registers'. */
+/* 10 i386 registers, 8 i387 registers, and 31 Weitek 1167 registers */
+#undef REGISTER_BYTES
+#define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4))
+
+/* Index within `registers' of the first byte of the space for
+ register N. */
+
+#undef REGISTER_BYTE
+#define REGISTER_BYTE(N) \
+((N < ST0_REGNUM) ? (N * 4) : \
+ (N < FP1_REGNUM) ? (40 + ((N - ST0_REGNUM) * 10)) : \
+ (40 + 80 + ((N - FP1_REGNUM) * 4)))
+
+/* Number of bytes of storage in the actual machine representation
+ * for register N. All registers are 4 bytes, except 387 st(0) - st(7),
+ * which are 80 bits each.
+ */
+
+#undef REGISTER_RAW_SIZE
+#define REGISTER_RAW_SIZE(N) \
+((N < ST0_REGNUM) ? 4 : \
+ (N < FP1_REGNUM) ? 10 : \
+ 4)
+
+/* Largest value REGISTER_RAW_SIZE can have. */
+
+#undef MAX_REGISTER_RAW_SIZE
+#define MAX_REGISTER_RAW_SIZE 10
+
+/* Nonzero if register N requires conversion
+ from raw format to virtual format. */
+
+#undef REGISTER_CONVERTIBLE
+#define REGISTER_CONVERTIBLE(N) \
+((N < ST0_REGNUM) ? 0 : \
+ (N < FP1_REGNUM) ? 1 : \
+ 0)
+
+/* Convert data from raw format for register REGNUM
+ to virtual format for register REGNUM. */
+extern const struct floatformat floatformat_i387_ext; /* from floatformat.h */
+
+#undef REGISTER_CONVERT_TO_VIRTUAL
+#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
+((REGNUM < ST0_REGNUM) ? (void)memcpy ((TO), (FROM), 4) : \
+ (REGNUM < FP1_REGNUM) ? (void)floatformat_to_double(&floatformat_i387_ext, \
+ (FROM),(TO)) : \
+ (void)memcpy ((TO), (FROM), 4))
+
+/* Convert data from virtual format for register REGNUM
+ to raw format for register REGNUM. */
+
+#undef REGISTER_CONVERT_TO_RAW
+#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
+((REGNUM < ST0_REGNUM) ? (void)memcpy ((TO), (FROM), 4) : \
+ (REGNUM < FP1_REGNUM) ? (void)floatformat_from_double(&floatformat_i387_ext, \
+ (FROM),(TO)) : \
+ (void)memcpy ((TO), (FROM), 4))
+
+/* Return the GDB type object for the "standard" data type
+ of data in register N. */
+/*
+ * Note: the 1167 registers (the last line, builtin_type_float) are
+ * generally used in pairs, with each pair being treated as a double.
+ * It it also possible to use them singly as floats. I'm not sure how
+ * in gdb to treat the register pair pseudo-doubles. -fubar
+ */
+#undef REGISTER_VIRTUAL_TYPE
+#define REGISTER_VIRTUAL_TYPE(N) \
+((N < ST0_REGNUM) ? builtin_type_int : \
+ (N < FP1_REGNUM) ? builtin_type_double : \
+ builtin_type_float)
+
+/* Extract from an array REGBUF containing the (raw) register state
+ a function return value of type TYPE, and copy that, in virtual format,
+ into VALBUF. */
+
+#undef EXTRACT_RETURN_VALUE
+#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+ symmetry_extract_return_value(TYPE, REGBUF, VALBUF)
+
+
+/*
+ * Removed extra PUSH_DUMMY_FRAME, et al: it was identical to the
+ * i386-tdep.c version.
+ */
+
+extern void
+print_387_control_word PARAMS ((unsigned int));
+
+extern void
+print_387_status_word PARAMS ((unsigned int));
+
+/*
+#undef FRAME_FIND_SAVED_REGS
+#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
+{ ptx_frame_find_saved_regs((frame_info), &(frame_saved_regs)); }
+*/
diff --git a/gdb/config/i386/tm-ptx4.h b/gdb/config/i386/tm-ptx4.h
index e69de29..d719b4f 100644
--- a/gdb/config/i386/tm-ptx4.h
+++ b/gdb/config/i386/tm-ptx4.h
@@ -0,0 +1,24 @@
+/* Target machine definitions for GDB on a Sequent Symmetry under ptx
+ with Weitek 1167 and i387 support.
+ Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
+ Symmetry version by Jay Vosburgh (fubar@sequent.com).
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#define SEQUENT_PTX4
+
+#include "tm-ptx.h"
diff --git a/gdb/config/i386/xm-ptx.h b/gdb/config/i386/xm-ptx.h
index e69de29..fe68098 100644
--- a/gdb/config/i386/xm-ptx.h
+++ b/gdb/config/i386/xm-ptx.h
@@ -0,0 +1,48 @@
+/* Definitions to make GDB run on a Sequent Symmetry under ptx, with
+ Weitek 1167 and i387 support. Copyright 1986, 1987, 1989, 1992,
+ 1993 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* Symmetry version by Jay Vosburgh (fubar@sequent.com) */
+
+#ifdef _SEQUENT_PTX4_
+#include "xm-sysv4.h"
+#endif /* _SEQUENT_PTX4_ */
+
+/* This machine doesn't have the siginterrupt call. */
+#define NO_SIGINTERRUPT
+
+#define HAVE_WAIT_STRUCT
+
+#define HAVE_MMAP
+
+#undef HAVE_TERMIO
+#define HAVE_TERMIOS
+#define USG
+
+#define MEM_FNS_DECLARED
+
+#define NEED_POSIX_SETPGID
+
+#define USE_O_NOCTTY
+
+#define HOST_BYTE_ORDER LITTLE_ENDIAN
+
+/* We must fetch all the regs before storing, since we store all at once. */
+
+#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES)
diff --git a/gdb/config/i386/xm-ptx4.h b/gdb/config/i386/xm-ptx4.h
index e69de29..87ebf1a 100644
--- a/gdb/config/i386/xm-ptx4.h
+++ b/gdb/config/i386/xm-ptx4.h
@@ -0,0 +1,25 @@
+/* Definitions to make GDB run on a Sequent Symmetry under ptx, with
+ Weitek 1167 and i387 support. Copyright 1986, 1987, 1989, 1992,
+ 1993 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* Symmetry version by Jay Vosburgh (fubar@sequent.com) */
+
+#include "xm-sysv4.h"
+
+#include "xm-ptx.h"
diff --git a/gdb/configure.in b/gdb/configure.in
index 74dfc9c..07b5cf3 100644
--- a/gdb/configure.in
+++ b/gdb/configure.in
@@ -38,6 +38,7 @@ hppa*-*-osf*) gdb_host=hppabsd ;;
i[34]86-ncr-*) gdb_host=ncr3000 ;;
i[34]86-sequent-bsd*) gdb_host=symmetry ;; #dynix
+i[34]86-sequent-sysv4*) gdb_host=ptx4 ;;
i[34]86-sequent-sysv*) gdb_host=ptx ;;
i[34]86-*-aix*) gdb_host=i386aix ;;
@@ -191,7 +192,9 @@ hppa*-*-hpux*) gdb_target=hppahpux ;;
hppa*-*-hiux*) gdb_target=hppahpux ;;
hppa*-*-osf*) gdb_target=hppaosf ;;
-i[34]86-sequent-*) gdb_target=symmetry ;;
+i[34]86-sequent-bsd*) gdb_target=symmetry ;;
+i[34]86-sequent-sysv4*) gdb_target=ptx4 ;;
+i[34]86-sequent-sysv*) gdb_target=ptx ;;
i[34]86-ncr-*) gdb_target=ncr3000 ;;
i[34]86-*-aout*) gdb_target=i386aout ;;
diff --git a/gdb/ptx4-nat.c b/gdb/ptx4-nat.c
index e69de29..fa6b80f 100644
--- a/gdb/ptx4-nat.c
+++ b/gdb/ptx4-nat.c
@@ -0,0 +1,209 @@
+/* Native-dependent code for ptx 4.0
+ Copyright 1988, 1989, 1991, 1992 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include "defs.h"
+#include "inferior.h"
+#include "gdbcore.h"
+#include <sys/procfs.h>
+#include <sys/ptrace.h>
+#include <sys/param.h>
+#include <fcntl.h>
+
+/* Given a pointer to a general register set in /proc format (gregset_t *),
+ unpack the register contents and supply them as gdb's idea of the current
+ register values. */
+
+void
+supply_gregset (gregsetp)
+ gregset_t *gregsetp;
+{
+ supply_register(EAX_REGNUM, (char *)&(*gregsetp)[EAX]);
+ supply_register(EDX_REGNUM, (char *)&(*gregsetp)[EDX]);
+ supply_register(ECX_REGNUM, (char *)&(*gregsetp)[ECX]);
+ supply_register(EBX_REGNUM, (char *)&(*gregsetp)[EBX]);
+ supply_register(ESI_REGNUM, (char *)&(*gregsetp)[ESI]);
+ supply_register(EDI_REGNUM, (char *)&(*gregsetp)[EDI]);
+ supply_register(ESP_REGNUM, (char *)&(*gregsetp)[UESP]);
+ supply_register(EBP_REGNUM, (char *)&(*gregsetp)[EBP]);
+ supply_register(EIP_REGNUM, (char *)&(*gregsetp)[EIP]);
+ supply_register(EFLAGS_REGNUM, (char *)&(*gregsetp)[EFL]);
+}
+
+void
+fill_gregset (gregsetp, regno)
+ gregset_t *gregsetp;
+ int regno;
+{
+ int regi;
+ extern char registers[];
+
+ for (regi = 0 ; regi < NUM_REGS ; regi++)
+ {
+ if ((regno == -1) || (regno == regi))
+ {
+ (*gregsetp)[regi] = *(greg_t *)&registers[REGISTER_BYTE (regi)];
+ }
+ }
+}
+
+#if defined (FP0_REGNUM)
+
+/* Given a pointer to a floating point register set in /proc format
+ (fpregset_t *), unpack the register contents and supply them as gdb's
+ idea of the current floating point register values. */
+
+void
+supply_fpregset (fpregsetp)
+ fpregset_t *fpregsetp;
+{
+ supply_fpu_registers((struct fpusave *)&fpregsetp->fp_reg_set);
+ supply_fpa_registers((struct fpasave *)&fpregsetp->f_wregs);
+}
+
+/* Given a pointer to a floating point register set in /proc format
+ (fpregset_t *), update the register specified by REGNO from gdb's idea
+ of the current floating point register set. If REGNO is -1, update
+ them all. */
+
+void
+fill_fpregset (fpregsetp, regno)
+ fpregset_t *fpregsetp;
+ int regno;
+{
+ int regi;
+ char *to;
+ char *from;
+ extern char registers[];
+
+ /* FIXME: see m68k-tdep.c for an example, for the m68k. */
+}
+
+#endif /* defined (FP0_REGNUM) */
+
+/*
+ * This doesn't quite do the same thing as the procfs.c version, but give
+ * it the same name so we don't have to put an ifdef in solib.c.
+ */
+/* this could use elf_interpreter() from elfread.c */
+int
+proc_iterate_over_mappings(func)
+ int (*func) PARAMS ((int, CORE_ADDR));
+{
+ vaddr_t curseg, memptr;
+ pt_vseg_t pv;
+ int rv, cmperr;
+ sec_ptr interp_sec;
+ char *interp_content;
+ int interp_fd, funcstat;
+ unsigned int size;
+ char buf1[NBPG], buf2[NBPG];
+
+ /*
+ * The following is really vile. We can get the name of the
+ * shared library from the exec_bfd, and we can get a list of
+ * each virtual memory segment, but there is no simple way to
+ * find the mapped segment from the shared library (ala
+ * procfs's PIOCOPENMEM). As a pretty nasty kludge, we
+ * compare the virtual memory segment to the contents of the
+ * .interp file. If they match, we assume that we've got the
+ * right one.
+ */
+
+ /*
+ * TODO: for attach, use XPT_OPENT to get the executable, in
+ * case we're attached without knowning the executable's
+ * filename.
+ */
+
+#ifdef VERBOSE_DEBUG
+ printf("proc_iter\n");
+#endif
+ interp_sec = bfd_get_section_by_name(exec_bfd, ".interp");
+ if (!interp_sec) {
+ return 0;
+ }
+
+ size = bfd_section_size(exec_bfd, interp_sec);
+ interp_content = alloca(size);
+ if (0 == bfd_get_section_contents(exec_bfd, interp_sec,
+ interp_content, (file_ptr)0, size)) {
+ return 0;
+ }
+
+#ifdef VERBOSE_DEBUG
+ printf("proc_iter: \"%s\"\n", interp_content);
+#endif
+ interp_fd = open(interp_content, O_RDONLY, 0);
+ if (-1 == interp_fd) {
+ return 0;
+ }
+
+ curseg = 0;
+ while (1) {
+ rv = ptrace(PT_NEXT_VSEG, inferior_pid, &pv, curseg);
+#ifdef VERBOSE_DEBUG
+ printf("PT_NEXT_VSEG: rv %d errno %d\n", rv, errno);
+#endif
+ if (-1 == rv)
+ break;
+ if (0 == rv)
+ break;
+#ifdef VERBOSE_DEBUG
+ printf("pv.pv_start 0x%x pv_size 0x%x pv_prot 0x%x\n",
+ pv.pv_start, pv.pv_size, pv.pv_prot);
+#endif
+ curseg = pv.pv_start + pv.pv_size;
+
+ rv = lseek(interp_fd, 0, SEEK_SET);
+ if (-1 == rv) {
+ perror("lseek");
+ close(interp_fd);
+ return 0;
+ }
+ for (memptr = pv.pv_start; memptr < pv.pv_start + pv.pv_size;
+ memptr += NBPG) {
+#ifdef VERBOSE_DEBUG
+ printf("memptr 0x%x\n", memptr);
+#endif
+ rv = read(interp_fd, buf1, NBPG);
+ if (-1 == rv) {
+ perror("read");
+ close(interp_fd);
+ return 0;
+ }
+ rv = ptrace(PT_RDATA_PAGE, inferior_pid, buf2,
+ memptr);
+ if (-1 == rv) {
+ perror("ptrace");
+ close(interp_fd);
+ return 0;
+ }
+ cmperr = memcmp(buf1, buf2, NBPG);
+ if (cmperr)
+ break;
+ }
+ if (0 == cmperr) {
+ /* this is it */
+ funcstat = (*func)(interp_fd, pv.pv_start);
+ break;
+ }
+ }
+ close(interp_fd);
+ return 0;
+}
diff --git a/gdb/symm-nat.c b/gdb/symm-nat.c
index f910d7d..e63ef97 100644
--- a/gdb/symm-nat.c
+++ b/gdb/symm-nat.c
@@ -362,7 +362,7 @@ sigchld_handler(signo)
sigmask(SIGCONT) | sigmask(SIGWINCH) | sigmask(SIGPWR) | \
sigmask(SIGURG) | sigmask(SIGPOLL)
-
+#ifdef ATTACH_DETACH
/*
* Thanks to XPT_MPDEBUGGER, we have to mange child_wait().
*/
@@ -514,6 +514,38 @@ child_wait(pid, status)
return pid;
}
+#else /* !ATTACH_DETACH */
+/*
+ * Simple child_wait() based on inftarg.c child_wait() for use until
+ * the MPDEBUGGER child_wait() works properly. This will go away when
+ * that is fixed.
+ */
+child_wait (pid, ourstatus)
+ int pid;
+ struct target_waitstatus *ourstatus;
+{
+ int save_errno;
+ int status;
+
+ do {
+ pid = wait (&status);
+ save_errno = errno;
+
+ if (pid == -1)
+ {
+ if (save_errno == EINTR)
+ continue;
+ fprintf (stderr, "Child process unexpectedly missing: %s.\n",
+ safe_strerror (save_errno));
+ ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
+ ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
+ return -1;
+ }
+ } while (pid != inferior_pid); /* Some other child died or stopped */
+ store_waitstatus (ourstatus, status);
+ return pid;
+}
+#endif /* ATTACH_DETACH */
@@ -550,12 +582,18 @@ kill_inferior ()
{
if (inferior_pid == 0)
return;
- /*
- * Don't use PT_KILL, since the child will stop again with a PTS_EXIT.
- * Just hit him with SIGKILL (so he stops) and detach.
- */
+
+ /* For MPDEBUGGER, don't use PT_KILL, since the child will stop
+ again with a PTS_EXIT. Just hit him with SIGKILL (so he stops)
+ and detach. */
+
kill (inferior_pid, SIGKILL);
+#ifdef ATTACH_DETACH
detach(SIGKILL);
+#else /* ATTACH_DETACH */
+ ptrace(PT_KILL, inferior_pid, 0, 0);
+ wait((int *)NULL);
+#endif /* ATTACH_DETACH */
target_mourn_inferior ();
}
@@ -737,6 +775,7 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
void
_initialize_symm_nat ()
{
+#ifdef ATTACH_DETACH
/*
* the MPDEBUGGER is necessary for process tree debugging and attach
* to work, but it alters the behavior of debugged processes, so other
@@ -786,4 +825,5 @@ _initialize_symm_nat ()
fatal("_initialize_symm_nat(): sigaction(SIGCHLD): %s",
safe_strerror(errno));
}
+#endif
}