diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1998-03-29 22:18:10 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1998-03-29 22:18:10 +0000 |
commit | e67d583556a72a00ae4703b79321b01cf0e166f9 (patch) | |
tree | 294574e30a9ca6c051c5660df5d5de62b6bf7d3a /gnu/usr.bin/binutils | |
parent | 82d7b263d3ef037532ae14b08ba6e5d1297430e8 (diff) |
Adapt the newer of our GDB versions to a.out ports. The main part of this
commit comes from NetBSD. Also, the kernel debugging mode is a bit different
but you will notice when you type gdb -k because it documents the difference
Diffstat (limited to 'gnu/usr.bin/binutils')
42 files changed, 1192 insertions, 208 deletions
diff --git a/gnu/usr.bin/binutils/Makefile.bsd-wrapper b/gnu/usr.bin/binutils/Makefile.bsd-wrapper index 862466366c6..f5884665b33 100644 --- a/gnu/usr.bin/binutils/Makefile.bsd-wrapper +++ b/gnu/usr.bin/binutils/Makefile.bsd-wrapper @@ -1,11 +1,8 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.20 1998/03/29 07:28:04 millert Exp $ - -MAN= binutils/ar.1 binutils/nm.1 \ - binutils/objcopy.1 binutils/objdump.1 binutils/ranlib.1 \ - binutils/size.1 binutils/strings.1 binutils/strip.1 \ - gas/doc/as.1 gprof/gprof.1 ld/ld.1 +# $OpenBSD: Makefile.bsd-wrapper,v 1.21 1998/03/29 22:17:17 niklas Exp $ SUBDIRS= libiberty opcodes bfd +MAN= + # gdb not ready yet .if (${MACHINE_ARCH} != "powerpc") SUBDIRS+= gdb mmalloc readline @@ -16,6 +13,10 @@ MAN+= gdb/gdb.1 .if (${MACHINE_ARCH} == "alpha") || (${MACHINE_ARCH} == "mips") || \ (${MACHINE_ARCH} == "powerpc") SUBDIRS+= binutils ld gas +MAN+= binutils/ar.1 binutils/nm.1 \ + binutils/objcopy.1 binutils/objdump.1 binutils/ranlib.1 \ + binutils/size.1 binutils/strings.1 binutils/strip.1 \ + gas/doc/as.1 gprof/gprof.1 ld/ld.1 .endif # Used by the GNU Makefile diff --git a/gnu/usr.bin/binutils/gdb/config/i386/nbsd.mh b/gnu/usr.bin/binutils/gdb/config/i386/nbsd.mh index 5b3bd2b8c25..96125041759 100644 --- a/gnu/usr.bin/binutils/gdb/config/i386/nbsd.mh +++ b/gnu/usr.bin/binutils/gdb/config/i386/nbsd.mh @@ -1,5 +1,6 @@ # Host: Intel 386 running NetBSD -XDEPFILES= -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386b-nat.o +XDEPFILES= ser-tcp.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h +NAT_CLIBS= -lkvm +NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o kcore-nbsd.o i386nbsd-nat.o diff --git a/gnu/usr.bin/binutils/gdb/config/i386/nm-nbsd.h b/gnu/usr.bin/binutils/gdb/config/i386/nm-nbsd.h index b59fec68214..2a2f72d73bc 100644 --- a/gnu/usr.bin/binutils/gdb/config/i386/nm-nbsd.h +++ b/gnu/usr.bin/binutils/gdb/config/i386/nm-nbsd.h @@ -17,18 +17,8 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef NM_NBSD_H -#define NM_NBSD_H - /* Get generic NetBSD native definitions. */ #include "nm-nbsd.h" -/* #define FLOAT_INFO { i386_float_info(); } */ - -#define REGISTER_U_ADDR(addr, blockend, regno) \ - (addr) = i386_register_u_addr ((blockend),(regno)); - -extern int -i386_register_u_addr PARAMS ((int, int)); - -#endif /* NM_NBSD_H */ +#define FLOAT_INFO extern i386_float_info (); \ + i386_float_info () diff --git a/gnu/usr.bin/binutils/gdb/config/i386/nm-obsd.h b/gnu/usr.bin/binutils/gdb/config/i386/nm-obsd.h index 90972db74bb..953eedb64ac 100644 --- a/gnu/usr.bin/binutils/gdb/config/i386/nm-obsd.h +++ b/gnu/usr.bin/binutils/gdb/config/i386/nm-obsd.h @@ -17,18 +17,8 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef NM_OBSD_H -#define NM_OBSD_H - /* Get generic OpenBSD native definitions. */ #include "nm-obsd.h" -/* #define FLOAT_INFO { i386_float_info(); } */ - -#define REGISTER_U_ADDR(addr, blockend, regno) \ - (addr) = i386_register_u_addr ((blockend),(regno)); - -extern int -i386_register_u_addr PARAMS ((int, int)); - -#endif /* NM_OBSD_H */ +#define FLOAT_INFO extern i386_float_info (); \ + i386_float_info () diff --git a/gnu/usr.bin/binutils/gdb/config/i386/obsd.mh b/gnu/usr.bin/binutils/gdb/config/i386/obsd.mh index ac9b74cfc77..34d97957980 100644 --- a/gnu/usr.bin/binutils/gdb/config/i386/obsd.mh +++ b/gnu/usr.bin/binutils/gdb/config/i386/obsd.mh @@ -1,5 +1,6 @@ # Host: Intel 386 running OpenBSD -XDEPFILES= -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386b-nat.o solib.o +XDEPFILES= ser-tcp.o XM_FILE= xm-obsd.h NAT_FILE= nm-obsd.h +NAT_CLIBS= -lkvm +NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o kcore-nbsd.o i386nbsd-nat.o diff --git a/gnu/usr.bin/binutils/gdb/config/i386/obsd.mt b/gnu/usr.bin/binutils/gdb/config/i386/obsd.mt index dc69ea704c5..21ff99a651b 100644 --- a/gnu/usr.bin/binutils/gdb/config/i386/obsd.mt +++ b/gnu/usr.bin/binutils/gdb/config/i386/obsd.mt @@ -1,3 +1,3 @@ # Target: Intel 386 running OpenBSD -TDEPFILES= i386-tdep.o i387-tdep.o +TDEPFILES= i386-tdep.o i387-tdep.o solib.o TM_FILE= tm-obsd.h diff --git a/gnu/usr.bin/binutils/gdb/config/i386/tm-nbsd.h b/gnu/usr.bin/binutils/gdb/config/i386/tm-nbsd.h index cf5159f2655..5bfdd3f9074 100644 --- a/gnu/usr.bin/binutils/gdb/config/i386/tm-nbsd.h +++ b/gnu/usr.bin/binutils/gdb/config/i386/tm-nbsd.h @@ -20,12 +20,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef TM_NBSD_H #define TM_NBSD_H -#include "i386/tm-i386bsd.h" +#include "i386/tm-i386.h" #include "tm-nbsd.h" +/* NetBSD supports only the first 16 regs. */ #undef NUM_REGS #define NUM_REGS 16 +/* On NetBSD, sigtramp is above the user stack and immediately below + the user area. Using constants here allows for cross debugging. */ +#define SIGTRAMP_END(pc) 0xefbfe000 /* USRSTACK */ +#define SIGTRAMP_START(pc) (SIGTRAMP_END(pc) - 64) + +/* Saved Pc. Get it from sigcontext if within sigtramp. */ +/* Offset to saved PC in sigcontext, from <sys/signal.h>. */ +#define SIGCONTEXT_PC_OFFSET 44 + #define JB_ELEMENT_SIZE sizeof(int) /* jmp_buf[_JBLEN] is array of ints */ #define JB_PC 0 /* Setjmp()'s return PC saved here */ diff --git a/gnu/usr.bin/binutils/gdb/config/i386/tm-obsd.h b/gnu/usr.bin/binutils/gdb/config/i386/tm-obsd.h index b2212c5db99..defa9a9a3a7 100644 --- a/gnu/usr.bin/binutils/gdb/config/i386/tm-obsd.h +++ b/gnu/usr.bin/binutils/gdb/config/i386/tm-obsd.h @@ -20,12 +20,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef TM_OBSD_H #define TM_OBSD_H -#include "i386/tm-i386bsd.h" +#include "i386/tm-i386.h" #include "tm-obsd.h" +/* Net- and OpenBSD supports only the first 16 regs. */ #undef NUM_REGS #define NUM_REGS 16 +/* On Net- and OpenBSD, sigtramp is above the user stack and immediately below + the user area. Using constants here allows for cross debugging. */ +#define SIGTRAMP_END(pc) 0xefbfe000 /* USRSTACK */ +#define SIGTRAMP_START(pc) (SIGTRAMP_END(pc) - 64) + +/* Saved Pc. Get it from sigcontext if within sigtramp. */ +/* Offset to saved PC in sigcontext, from <sys/signal.h>. */ +#define SIGCONTEXT_PC_OFFSET 44 + #define JB_ELEMENT_SIZE sizeof(int) /* jmp_buf[_JBLEN] is array of ints */ #define JB_PC 0 /* Setjmp()'s return PC saved here */ @@ -39,4 +49,4 @@ get_longjmp_target PARAMS ((CORE_ADDR *)); #define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) -#endif /* TM_NBSD_H */ +#endif /* TM_OBSD_H */ diff --git a/gnu/usr.bin/binutils/gdb/config/m68k/nbsd.mh b/gnu/usr.bin/binutils/gdb/config/m68k/nbsd.mh index 2e7fe617757..a3a2cbdd5b4 100644 --- a/gnu/usr.bin/binutils/gdb/config/m68k/nbsd.mh +++ b/gnu/usr.bin/binutils/gdb/config/m68k/nbsd.mh @@ -1,5 +1,6 @@ # Host: Motorola m68k running NetBSD -XDEPFILES= -NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o m68knbsd-nat.o +XDEPFILES= ser-tcp.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h +NAT_CLIBS= -lkvm +NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o kcore-nbsd.o m68knbsd-nat.o diff --git a/gnu/usr.bin/binutils/gdb/config/m68k/obsd.mh b/gnu/usr.bin/binutils/gdb/config/m68k/obsd.mh index 309daf0e491..3c0cd1f8765 100644 --- a/gnu/usr.bin/binutils/gdb/config/m68k/obsd.mh +++ b/gnu/usr.bin/binutils/gdb/config/m68k/obsd.mh @@ -1,5 +1,6 @@ # Host: Motorola m68k running OpenBSD -XDEPFILES= -NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o m68knbsd-nat.o solib.o +XDEPFILES= ser-tcp.o XM_FILE= xm-obsd.h NAT_FILE= nm-obsd.h +NAT_CLIBS= -lkvm +NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o kcore-nbsd.o m68knbsd-nat.o diff --git a/gnu/usr.bin/binutils/gdb/config/m68k/obsd.mt b/gnu/usr.bin/binutils/gdb/config/m68k/obsd.mt index 63708d9c5c6..2a6093bc4f7 100644 --- a/gnu/usr.bin/binutils/gdb/config/m68k/obsd.mt +++ b/gnu/usr.bin/binutils/gdb/config/m68k/obsd.mt @@ -1,3 +1,3 @@ # Target: Motorola m68k running OpenBSD -TDEPFILES= m68k-tdep.o +TDEPFILES= m68k-tdep.o solib.o TM_FILE= tm-obsd.h diff --git a/gnu/usr.bin/binutils/gdb/config/m68k/tm-nbsd.h b/gnu/usr.bin/binutils/gdb/config/m68k/tm-nbsd.h index cc86cc8d4d2..ea6cb6992f7 100644 --- a/gnu/usr.bin/binutils/gdb/config/m68k/tm-nbsd.h +++ b/gnu/usr.bin/binutils/gdb/config/m68k/tm-nbsd.h @@ -1,4 +1,4 @@ -/* Macro definitions for i386 running under NetBSD. +/* Macro definitions for m68k running under NetBSD. Copyright 1994 Free Software Foundation, Inc. This file is part of GDB. @@ -20,22 +20,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef TM_NBSD_H #define TM_NBSD_H -#include <sys/param.h> -#include <machine/vmparam.h> +/* NetBSD uses trap 15 for both user and kernel breakpoints. */ +#define BPT_VECTOR 0xf +#define REMOTE_BPT_VECTOR 0xf -/* Define BPT_VECTOR if it is different than the default. - This is the vector number used by traps to indicate a breakpoint. */ - -#define BPT_VECTOR 0x2 - -/* Address of end of stack space. */ -#define STACK_END_ADDR USRSTACK - -/* For NetBSD, sigtramp is 32 bytes before STACK_END_ADDR. */ -#define SIGTRAMP_START(pc) (STACK_END_ADDR - 32) -#define SIGTRAMP_END(pc) (STACK_END_ADDR) +/* For NetBSD, sigtramp is 32 bytes before STACK_END_ADDR, + but we don't know where that is until run-time! */ +extern int nbsd_in_sigtramp(CORE_ADDR); +#define IN_SIGTRAMP(pc, name) nbsd_in_sigtramp (pc) +/* Generic definitions. */ #include "m68k/tm-m68k.h" #include "tm-nbsd.h" +/* Offset to saved PC in sigcontext, from <m68k/signal.h>. */ +#define SIGCONTEXT_PC_OFFSET 20 + #endif /* TM_NBSD_H */ diff --git a/gnu/usr.bin/binutils/gdb/config/m68k/tm-obsd.h b/gnu/usr.bin/binutils/gdb/config/m68k/tm-obsd.h index f24e530edc1..3773f55f775 100644 --- a/gnu/usr.bin/binutils/gdb/config/m68k/tm-obsd.h +++ b/gnu/usr.bin/binutils/gdb/config/m68k/tm-obsd.h @@ -1,4 +1,4 @@ -/* Macro definitions for i386 running under OpenBSD. +/* Macro definitions for m68k running under OpenBSD. Copyright 1994 Free Software Foundation, Inc. This file is part of GDB. @@ -20,22 +20,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef TM_OBSD_H #define TM_OBSD_H -#include <sys/param.h> -#include <machine/vmparam.h> +/* Net- and OpenBSD uses trap 15 for both user and kernel breakpoints. */ +#define BPT_VECTOR 0xf +#define REMOTE_BPT_VECTOR 0xf -/* Define BPT_VECTOR if it is different than the default. - This is the vector number used by traps to indicate a breakpoint. */ - -#define BPT_VECTOR 0x2 - -/* Address of end of stack space. */ -#define STACK_END_ADDR USRSTACK - -/* For OpenBSD, sigtramp is 32 bytes before STACK_END_ADDR. */ -#define SIGTRAMP_START(pc) (STACK_END_ADDR - 32) -#define SIGTRAMP_END(pc) (STACK_END_ADDR) +/* For Net- and OpenBSD, sigtramp is 32 bytes before STACK_END_ADDR, + but we don't know where that is until run-time! */ +extern int nbsd_in_sigtramp(CORE_ADDR); +#define IN_SIGTRAMP(pc, name) nbsd_in_sigtramp (pc) +/* Generic definitions. */ #include "m68k/tm-m68k.h" #include "tm-obsd.h" +/* Offset to saved PC in sigcontext, from <m68k/signal.h>. */ +#define SIGCONTEXT_PC_OFFSET 20 + #endif /* TM_OBSD_H */ diff --git a/gnu/usr.bin/binutils/gdb/config/nm-nbsd.h b/gnu/usr.bin/binutils/gdb/config/nm-nbsd.h index bc1d6a621ac..3e3663e7b53 100644 --- a/gnu/usr.bin/binutils/gdb/config/nm-nbsd.h +++ b/gnu/usr.bin/binutils/gdb/config/nm-nbsd.h @@ -17,22 +17,32 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ +/* "Support" the NetBSD-specific "-k" option. */ +#define ADDITIONAL_OPTIONS {"k", no_argument, 0, 'k'}, +#define ADDITIONAL_OPTION_CASES case 'k': \ + fprintf_unfiltered (gdb_stderr, \ +"-k: obsolete option. For kernel debugging, start gdb\n" \ +"with just the kernel name as an argument (no core file)\n" \ +"and then use the gdb command `target kcore COREFILE'.\n"); \ + exit (1); +/* End of "-k" stuff. */ -#include <machine/vmparam.h> - -#define KERNEL_U_ADDR USRSTACK - -#define PTRACE_ARG3_TYPE char* +#define ATTACH_DETACH +/* Use this instead of KERNEL_U_ADDR (See gdb/infptrace.c) */ #define FETCH_INFERIOR_REGISTERS -#define ATTACH_DETACH +/* This enables functions needed by kcore-nbsd.c */ +#define FETCH_KCORE_REGISTERS + +#define PTRACE_ARG3_TYPE char* #include "solib.h" /* Support for shared libraries. */ -/* make structure definitions match up with those expected in solib.c */ +#ifndef SVR4_SHARED_LIBS +/* The NetBSD link.h structure definitions have different names + than the SunOS version, but the structures are very similar, + so we can use solib.c by defining the SunOS names. */ #define link_object sod #define lo_name sod_name #define lo_library sod_library @@ -54,7 +64,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define link_dynamic_2 section_dispatch_table #define ld_loaded sdt_loaded #define ld_need sdt_sods -#define ld_rules sdt_filler1 +#define ld_rules sdt_rules #define ld_got sdt_got #define ld_plt sdt_plt #define ld_rel sdt_rel @@ -84,3 +94,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define ldd d_debug #define ld_un d_un #define ld_2 d_sdt + +#endif /* SVR4_SHARED_LIBS */ diff --git a/gnu/usr.bin/binutils/gdb/config/nm-obsd.h b/gnu/usr.bin/binutils/gdb/config/nm-obsd.h index f0c91965eca..f897d68bc5e 100644 --- a/gnu/usr.bin/binutils/gdb/config/nm-obsd.h +++ b/gnu/usr.bin/binutils/gdb/config/nm-obsd.h @@ -17,22 +17,32 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ +/* "Support" the Net- and OpenBSD-specific "-k" option. */ +#define ADDITIONAL_OPTIONS {"k", no_argument, 0, 'k'}, +#define ADDITIONAL_OPTION_CASES case 'k': \ + fprintf_unfiltered (gdb_stderr, \ +"-k: obsolete option. For kernel debugging, start gdb\n" \ +"with just the kernel name as an argument (no core file)\n" \ +"and then use the gdb command `target kcore COREFILE'.\n"); \ + exit (1); +/* End of "-k" stuff. */ -#include <machine/vmparam.h> - -#define KERNEL_U_ADDR USRSTACK - -#define PTRACE_ARG3_TYPE char* +#define ATTACH_DETACH +/* Use this instead of KERNEL_U_ADDR (See gdb/infptrace.c) */ #define FETCH_INFERIOR_REGISTERS -#define ATTACH_DETACH +/* This enables functions needed by kcore-nbsd.c */ +#define FETCH_KCORE_REGISTERS + +#define PTRACE_ARG3_TYPE char* #include "solib.h" /* Support for shared libraries. */ -/* make structure definitions match up with those expected in solib.c */ +#ifndef SVR4_SHARED_LIBS +/* The Net- and OpenBSD link.h structure definitions have different names + than the SunOS version, but the structures are very similar, + so we can use solib.c by defining the SunOS names. */ #define link_object sod #define lo_name sod_name #define lo_library sod_library @@ -54,7 +64,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define link_dynamic_2 section_dispatch_table #define ld_loaded sdt_loaded #define ld_need sdt_sods -#define ld_rules sdt_filler1 +#define ld_rules sdt_rules #define ld_got sdt_got #define ld_plt sdt_plt #define ld_rel sdt_rel @@ -84,3 +94,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define ldd d_debug #define ld_un d_un #define ld_2 d_sdt + +#endif /* SVR4_SHARED_LIBS */ diff --git a/gnu/usr.bin/binutils/gdb/config/ns32k/nbsd.mh b/gnu/usr.bin/binutils/gdb/config/ns32k/nbsd.mh index 96efec59ce5..2179e0655e1 100644 --- a/gnu/usr.bin/binutils/gdb/config/ns32k/nbsd.mh +++ b/gnu/usr.bin/binutils/gdb/config/ns32k/nbsd.mh @@ -1,4 +1,6 @@ # Host: PC532 running NetBSD +XDEPFILES= ser-tcp.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32k-nat.o +NAT_CLIBS= -lkvm +NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o kcore-nbsd.o ns32k-nat.o diff --git a/gnu/usr.bin/binutils/gdb/config/ns32k/nm-nbsd.h b/gnu/usr.bin/binutils/gdb/config/ns32k/nm-nbsd.h index cef536e4050..c28fbcc09fb 100644 --- a/gnu/usr.bin/binutils/gdb/config/ns32k/nm-nbsd.h +++ b/gnu/usr.bin/binutils/gdb/config/ns32k/nm-nbsd.h @@ -23,14 +23,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Get generic NetBSD native definitions. */ #include "nm-nbsd.h" -#if 0 -#define FLOAT_INFO { extern ns32k_float_info(); ns32k_float_info(); } -#endif - -#define REGISTER_U_ADDR(addr, blockend, regno) \ - (addr) = ns32k_register_u_addr ((blockend),(regno)); - -extern int -ns32k_register_u_addr PARAMS ((int, int)); - #endif /* NM_NBSD_H */ diff --git a/gnu/usr.bin/binutils/gdb/config/ns32k/nm-obsd.h b/gnu/usr.bin/binutils/gdb/config/ns32k/nm-obsd.h index 97bd9c0bafe..4f65861dce4 100644 --- a/gnu/usr.bin/binutils/gdb/config/ns32k/nm-obsd.h +++ b/gnu/usr.bin/binutils/gdb/config/ns32k/nm-obsd.h @@ -23,14 +23,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Get generic OpenBSD native definitions. */ #include "nm-obsd.h" -#if 0 -#define FLOAT_INFO { extern ns32k_float_info(); ns32k_float_info(); } -#endif - -#define REGISTER_U_ADDR(addr, blockend, regno) \ - (addr) = ns32k_register_u_addr ((blockend),(regno)); - -extern int -ns32k_register_u_addr PARAMS ((int, int)); - #endif /* NM_OBSD_H */ diff --git a/gnu/usr.bin/binutils/gdb/config/ns32k/obsd.mh b/gnu/usr.bin/binutils/gdb/config/ns32k/obsd.mh index 479e675ea89..a5fb5f624cb 100644 --- a/gnu/usr.bin/binutils/gdb/config/ns32k/obsd.mh +++ b/gnu/usr.bin/binutils/gdb/config/ns32k/obsd.mh @@ -1,4 +1,6 @@ # Host: PC532 running OpenBSD +XDEPFILES= ser-tcp.o XM_FILE= xm-obsd.h NAT_FILE= nm-obsd.h -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32k-nat.o solib.o +NAT_CLIBS= -lkvm +NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o kcore-nbsd.o ns32k-nat.o diff --git a/gnu/usr.bin/binutils/gdb/config/ns32k/obsd.mt b/gnu/usr.bin/binutils/gdb/config/ns32k/obsd.mt index 684b146fc62..4767b9ad1df 100644 --- a/gnu/usr.bin/binutils/gdb/config/ns32k/obsd.mt +++ b/gnu/usr.bin/binutils/gdb/config/ns32k/obsd.mt @@ -1,3 +1,3 @@ # Target: PC532 running OpenBSD -TDEPFILES= ns32k-tdep.o +TDEPFILES= ns32k-tdep.o solib.o TM_FILE= tm-obsd.h diff --git a/gnu/usr.bin/binutils/gdb/config/ns32k/tm-nbsd.h b/gnu/usr.bin/binutils/gdb/config/ns32k/tm-nbsd.h index 5a0fa322a98..2d57bcd2cd3 100644 --- a/gnu/usr.bin/binutils/gdb/config/ns32k/tm-nbsd.h +++ b/gnu/usr.bin/binutils/gdb/config/ns32k/tm-nbsd.h @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Override number of expected traps from sysv. */ #define START_INFERIOR_TRAPS_EXPECTED 2 +#define INVALID_FLOAT(p, s) invalid_float(p, s) /* Most definitions from umax could be used. */ @@ -30,6 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Saved Pc. Get it from sigcontext if within sigtramp. */ +/* We define our own fetch and store methods. */ +#define FETCH_INFERIOR_REGISTERS + /* Offset to saved PC in sigcontext, from <machine/signal.h>. */ #define SIGCONTEXT_PC_OFFSET 20 @@ -39,3 +43,65 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ? sigtramp_saved_pc (FRAME) \ : read_memory_integer ((FRAME)->frame + 4, 4)) \ ) + +#undef FRAME_NUM_ARGS +#define FRAME_NUM_ARGS(numargs, fi) numargs = frame_num_args(fi) + +#undef FRAME_CHAIN +#define FRAME_CHAIN(thisframe) \ + (read_memory_integer ((thisframe)->frame, 4) > (thisframe)->frame ? \ + read_memory_integer ((thisframe)->frame, 4) : 0) + +#define FRAME_CHAIN_VALID(chain, thisframe)\ + ((chain) != 0\ + && !inside_main_func ((thisframe) -> pc)) + +/* tm-umax.h assumes a 32082 fpu. We have a 32382 fpu. */ +#undef REGISTER_NAMES +#undef NUM_REGS +#undef REGISTER_BYTES +#undef REGISTER_BYTE +/* Initializer for an array of names of registers. + There should be NUM_REGS strings in this initializer. */ + +#define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ + "sp", "fp", "pc", "ps", \ + "fsr", \ + "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "xx", \ + } + +#define NUM_REGS 29 + +/* Total amount of space needed to store our copies of the machine's + register state, the array `registers'. */ +#define REGISTER_BYTES \ + ((NUM_REGS - 4) * REGISTER_RAW_SIZE(R0_REGNUM) \ + + 8 * REGISTER_RAW_SIZE(LP0_REGNUM)) + +/* Index within `registers' of the first byte of the space for + register N. */ + +/* This is a bit yuck. The even numbered double precision floating + point long registers occupy the same space as the even:odd numbered + single precision floating point registers, but the extra 32381 fpu + registers are at the end. Doing it this way is compatable for both + 32081 and 32381 equiped machines. */ + +#define REGISTER_BYTE(N) (((N) < LP0_REGNUM? (N)\ + : ((N) - LP0_REGNUM) & 1? (N) - 1 \ + : ((N) - LP0_REGNUM + FP0_REGNUM)) * 4) + + +#undef FRAME_NUM_ARGS +#define FRAME_NUM_ARGS(numargs, fi) numargs = frame_num_args(fi) + +#undef FRAME_CHAIN +#define FRAME_CHAIN(thisframe) \ + (read_memory_integer ((thisframe)->frame, 4) > (thisframe)->frame ? \ + read_memory_integer ((thisframe)->frame, 4) : 0) + +#undef FRAME_CHAIN_VALID +#define FRAME_CHAIN_VALID(chain, thisframe) \ + ((chain) != 0 \ + && !inside_main_func ((thisframe) -> pc)) diff --git a/gnu/usr.bin/binutils/gdb/config/ns32k/tm-obsd.h b/gnu/usr.bin/binutils/gdb/config/ns32k/tm-obsd.h index 41fdb88db3d..1dc3bbcf8a1 100644 --- a/gnu/usr.bin/binutils/gdb/config/ns32k/tm-obsd.h +++ b/gnu/usr.bin/binutils/gdb/config/ns32k/tm-obsd.h @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Override number of expected traps from sysv. */ #define START_INFERIOR_TRAPS_EXPECTED 2 +#define INVALID_FLOAT(p, s) invalid_float(p, s) /* Most definitions from umax could be used. */ @@ -30,6 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Saved Pc. Get it from sigcontext if within sigtramp. */ +/* We define our own fetch and store methods. */ +#define FETCH_INFERIOR_REGISTERS + /* Offset to saved PC in sigcontext, from <machine/signal.h>. */ #define SIGCONTEXT_PC_OFFSET 20 @@ -39,3 +43,65 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ? sigtramp_saved_pc (FRAME) \ : read_memory_integer ((FRAME)->frame + 4, 4)) \ ) + +#undef FRAME_NUM_ARGS +#define FRAME_NUM_ARGS(numargs, fi) numargs = frame_num_args(fi) + +#undef FRAME_CHAIN +#define FRAME_CHAIN(thisframe) \ + (read_memory_integer ((thisframe)->frame, 4) > (thisframe)->frame ? \ + read_memory_integer ((thisframe)->frame, 4) : 0) + +#define FRAME_CHAIN_VALID(chain, thisframe)\ + ((chain) != 0\ + && !inside_main_func ((thisframe) -> pc)) + +/* tm-umax.h assumes a 32082 fpu. We have a 32382 fpu. */ +#undef REGISTER_NAMES +#undef NUM_REGS +#undef REGISTER_BYTES +#undef REGISTER_BYTE +/* Initializer for an array of names of registers. + There should be NUM_REGS strings in this initializer. */ + +#define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ + "sp", "fp", "pc", "ps", \ + "fsr", \ + "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "xx", \ + } + +#define NUM_REGS 29 + +/* Total amount of space needed to store our copies of the machine's + register state, the array `registers'. */ +#define REGISTER_BYTES \ + ((NUM_REGS - 4) * REGISTER_RAW_SIZE(R0_REGNUM) \ + + 8 * REGISTER_RAW_SIZE(LP0_REGNUM)) + +/* Index within `registers' of the first byte of the space for + register N. */ + +/* This is a bit yuck. The even numbered double precision floating + point long registers occupy the same space as the even:odd numbered + single precision floating point registers, but the extra 32381 fpu + registers are at the end. Doing it this way is compatable for both + 32081 and 32381 equiped machines. */ + +#define REGISTER_BYTE(N) (((N) < LP0_REGNUM? (N)\ + : ((N) - LP0_REGNUM) & 1? (N) - 1 \ + : ((N) - LP0_REGNUM + FP0_REGNUM)) * 4) + + +#undef FRAME_NUM_ARGS +#define FRAME_NUM_ARGS(numargs, fi) numargs = frame_num_args(fi) + +#undef FRAME_CHAIN +#define FRAME_CHAIN(thisframe) \ + (read_memory_integer ((thisframe)->frame, 4) > (thisframe)->frame ? \ + read_memory_integer ((thisframe)->frame, 4) : 0) + +#undef FRAME_CHAIN_VALID +#define FRAME_CHAIN_VALID(chain, thisframe) \ + ((chain) != 0 \ + && !inside_main_func ((thisframe) -> pc)) diff --git a/gnu/usr.bin/binutils/gdb/config/sparc/nbsd.mh b/gnu/usr.bin/binutils/gdb/config/sparc/nbsd.mh index 310838d6acf..2d36ed9dab1 100644 --- a/gnu/usr.bin/binutils/gdb/config/sparc/nbsd.mh +++ b/gnu/usr.bin/binutils/gdb/config/sparc/nbsd.mh @@ -2,5 +2,5 @@ XDEPFILES= ser-tcp.o XM_FILE= xm-nbsd.h NAT_FILE= nm-nbsd.h -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o -HOST_IPC=-DBSD_IPC +NAT_CLIBS= -lkvm +NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o kcore-nbsd.o sparcnbsd-nat.o diff --git a/gnu/usr.bin/binutils/gdb/config/sparc/nm-nbsd.h b/gnu/usr.bin/binutils/gdb/config/sparc/nm-nbsd.h index 016772ae372..a39b4581725 100644 --- a/gnu/usr.bin/binutils/gdb/config/sparc/nm-nbsd.h +++ b/gnu/usr.bin/binutils/gdb/config/sparc/nm-nbsd.h @@ -18,40 +18,9 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef NM_NBSD_H -#define NM_NBSD_H - /* Get generic NetBSD native definitions. */ - #include "nm-nbsd.h" -#define FETCH_INFERIOR_REGISTERS - -/* Before storing, we need to read all the registers. */ - -#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) - -/* Make things match up with what is expected in sparc-nat.c. */ - -#define regs trapframe -#define fp_status fpstate - -#define r_g1 tf_global[1] -#define r_ps tf_psr -#define r_pc tf_pc -#define r_npc tf_npc -#define r_y tf_y - -#define fpu fpstate -#define fpu_regs fs_regs -#define fpu_fsr fs_fsr -#define fpu_fr fs_regs -#define Fpu_fsr fs_fsr -#define FPU_FSR_TYPE int - -#define PTRACE_GETREGS PT_GETREGS -#define PTRACE_GETFPREGS PT_GETFPREGS -#define PTRACE_SETREGS PT_SETREGS -#define PTRACE_SETFPREGS PT_SETFPREGS - -#endif /* NM_NBSD_H */ +/* Before storing, read all the registers. (see inftarg.c) */ +#define CHILD_PREPARE_TO_STORE() \ + read_register_bytes (0, NULL, REGISTER_BYTES) diff --git a/gnu/usr.bin/binutils/gdb/config/sparc/nm-obsd.h b/gnu/usr.bin/binutils/gdb/config/sparc/nm-obsd.h index a6330ef39cb..001ab3e5554 100644 --- a/gnu/usr.bin/binutils/gdb/config/sparc/nm-obsd.h +++ b/gnu/usr.bin/binutils/gdb/config/sparc/nm-obsd.h @@ -18,40 +18,9 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef NM_OBSD_H -#define NM_OBSD_H - /* Get generic OpenBSD native definitions. */ - #include "nm-obsd.h" -#define FETCH_INFERIOR_REGISTERS - -/* Before storing, we need to read all the registers. */ - -#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) - -/* Make things match up with what is expected in sparc-nat.c. */ - -#define regs trapframe -#define fp_status fpstate - -#define r_g1 tf_global[1] -#define r_ps tf_psr -#define r_pc tf_pc -#define r_npc tf_npc -#define r_y tf_y - -#define fpu fpstate -#define fpu_regs fs_regs -#define fpu_fsr fs_fsr -#define fpu_fr fs_regs -#define Fpu_fsr fs_fsr -#define FPU_FSR_TYPE int - -#define PTRACE_GETREGS PT_GETREGS -#define PTRACE_GETFPREGS PT_GETFPREGS -#define PTRACE_SETREGS PT_SETREGS -#define PTRACE_SETFPREGS PT_SETFPREGS - -#endif /* NM_OBSD_H */ +/* Before storing, read all the registers. (see inftarg.c) */ +#define CHILD_PREPARE_TO_STORE() \ + read_register_bytes (0, NULL, REGISTER_BYTES) diff --git a/gnu/usr.bin/binutils/gdb/config/sparc/obsd.mh b/gnu/usr.bin/binutils/gdb/config/sparc/obsd.mh index 963a4470493..a7a0940bd90 100644 --- a/gnu/usr.bin/binutils/gdb/config/sparc/obsd.mh +++ b/gnu/usr.bin/binutils/gdb/config/sparc/obsd.mh @@ -2,5 +2,5 @@ XDEPFILES= ser-tcp.o XM_FILE= xm-obsd.h NAT_FILE= nm-obsd.h -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o -HOST_IPC=-DBSD_IPC +NAT_CLIBS= -lkvm +NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o kcore-nbsd.o sparcnbsd-nat.o diff --git a/gnu/usr.bin/binutils/gdb/config/sparc/obsd.mt b/gnu/usr.bin/binutils/gdb/config/sparc/obsd.mt index ae148ac88ca..e7598446aed 100644 --- a/gnu/usr.bin/binutils/gdb/config/sparc/obsd.mt +++ b/gnu/usr.bin/binutils/gdb/config/sparc/obsd.mt @@ -1,3 +1,3 @@ # Target: Sun 4 or Sparcstation, running OpenBSD -TDEPFILES= sparc-tdep.o +TDEPFILES= sparc-tdep.o solib.o TM_FILE= tm-obsd.h diff --git a/gnu/usr.bin/binutils/gdb/config/tm-nbsd.h b/gnu/usr.bin/binutils/gdb/config/tm-nbsd.h index e295d85ea2d..ec4ca2d328c 100644 --- a/gnu/usr.bin/binutils/gdb/config/tm-nbsd.h +++ b/gnu/usr.bin/binutils/gdb/config/tm-nbsd.h @@ -17,3 +17,12 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef SVR4_SHARED_LIBS + +/* Return non-zero if we are in a shared library trampoline code stub. */ + +#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \ + (name && !strcmp(name, "_DYNAMIC")) + +#endif /* !SVR4_SHARED_LIBS */ diff --git a/gnu/usr.bin/binutils/gdb/config/tm-obsd.h b/gnu/usr.bin/binutils/gdb/config/tm-obsd.h index d386e5a5dc9..97f36fdaed8 100644 --- a/gnu/usr.bin/binutils/gdb/config/tm-obsd.h +++ b/gnu/usr.bin/binutils/gdb/config/tm-obsd.h @@ -17,3 +17,12 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef SVR4_SHARED_LIBS + +/* Return non-zero if we are in a shared library trampoline code stub. */ + +#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \ + (name && !strcmp(name, "_DYNAMIC")) + +#endif /* !SVR4_SHARED_LIBS */ diff --git a/gnu/usr.bin/binutils/gdb/config/vax/nbsd.mh b/gnu/usr.bin/binutils/gdb/config/vax/nbsd.mh new file mode 100644 index 00000000000..5ea7a09d838 --- /dev/null +++ b/gnu/usr.bin/binutils/gdb/config/vax/nbsd.mh @@ -0,0 +1,6 @@ +# Host: VAX running NetBSD +XDEPFILES= ser-tcp.o +XM_FILE= xm-nbsd.h +NAT_FILE= nm-nbsd.h +NAT_CLIBS= -lkvm +NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o kcore-nbsd.o vaxnbsd-nat.o diff --git a/gnu/usr.bin/binutils/gdb/config/vax/nm-nbsd.h b/gnu/usr.bin/binutils/gdb/config/vax/nm-nbsd.h new file mode 100644 index 00000000000..cc013378340 --- /dev/null +++ b/gnu/usr.bin/binutils/gdb/config/vax/nm-nbsd.h @@ -0,0 +1,21 @@ +/* Native-dependent definitions for DEC VAX running NetBSD, for GDB. + Copyright 1996 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Get generic NetBSD native definitions. */ +#include "nm-nbsd.h" diff --git a/gnu/usr.bin/binutils/gdb/config/vax/nm-obsd.h b/gnu/usr.bin/binutils/gdb/config/vax/nm-obsd.h new file mode 100644 index 00000000000..06ce32d32e6 --- /dev/null +++ b/gnu/usr.bin/binutils/gdb/config/vax/nm-obsd.h @@ -0,0 +1,21 @@ +/* Native-dependent definitions for DEC VAX running OpenBSD, for GDB. + Copyright 1996 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Get generic OpenBSD native definitions. */ +#include "nm-obsd.h" diff --git a/gnu/usr.bin/binutils/gdb/config/vax/obsd.mt b/gnu/usr.bin/binutils/gdb/config/vax/obsd.mt new file mode 100644 index 00000000000..60acef1d0d3 --- /dev/null +++ b/gnu/usr.bin/binutils/gdb/config/vax/obsd.mt @@ -0,0 +1,3 @@ +# Target: VAX running OpenBSD +TDEPFILES= vax-tdep.o solib.o +TM_FILE= tm-obsd.h diff --git a/gnu/usr.bin/binutils/gdb/config/vax/tm-nbsd.h b/gnu/usr.bin/binutils/gdb/config/vax/tm-nbsd.h new file mode 100644 index 00000000000..82beba5c89f --- /dev/null +++ b/gnu/usr.bin/binutils/gdb/config/vax/tm-nbsd.h @@ -0,0 +1,26 @@ +/* Macro definitions for Sparc running under NetBSD. + Copyright 1994 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef TM_NBSD_H +#define TM_NBSD_H + +#include "vax/tm-vax.h" +#include "tm-nbsd.h" + +#endif /* TM_NBSD_H */ diff --git a/gnu/usr.bin/binutils/gdb/config/vax/tm-obsd.h b/gnu/usr.bin/binutils/gdb/config/vax/tm-obsd.h new file mode 100644 index 00000000000..8a195bda67b --- /dev/null +++ b/gnu/usr.bin/binutils/gdb/config/vax/tm-obsd.h @@ -0,0 +1,26 @@ +/* Macro definitions for Sparc running under OpenBSD. + Copyright 1994 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef TM_OBSD_H +#define TM_OBSD_H + +#include "vax/tm-vax.h" +#include "tm-obsd.h" + +#endif /* TM_OBSD_H */ diff --git a/gnu/usr.bin/binutils/gdb/config/vax/xm-nbsd.h b/gnu/usr.bin/binutils/gdb/config/vax/xm-nbsd.h new file mode 100644 index 00000000000..7e5cb7eafc1 --- /dev/null +++ b/gnu/usr.bin/binutils/gdb/config/vax/xm-nbsd.h @@ -0,0 +1,21 @@ +/* Parameters for execution on a VAX running NetBSD, for GDB. + Copyright 1994 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Get generic NetBSD host definitions. */ +#include "xm-nbsd.h" diff --git a/gnu/usr.bin/binutils/gdb/config/vax/xm-obsd.h b/gnu/usr.bin/binutils/gdb/config/vax/xm-obsd.h new file mode 100644 index 00000000000..88428ad732d --- /dev/null +++ b/gnu/usr.bin/binutils/gdb/config/vax/xm-obsd.h @@ -0,0 +1,21 @@ +/* Parameters for execution on a VAX running OpenBSD, for GDB. + Copyright 1994 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Get generic OpenBSD host definitions. */ +#include "xm-obsd.h" diff --git a/gnu/usr.bin/binutils/gdb/configure.host b/gnu/usr.bin/binutils/gdb/configure.host index f2936eba6b4..cb6ff7b1f31 100644 --- a/gnu/usr.bin/binutils/gdb/configure.host +++ b/gnu/usr.bin/binutils/gdb/configure.host @@ -157,6 +157,7 @@ sparc64-*-*) gdb_host=sun4sol2 ;; tahoe-*-*) gdb_host=tahoe ;; vax-*-bsd*) gdb_host=vaxbsd ;; +vax-*-openbsd*) gdb_host=obsd ;; vax-*-ultrix2*) gdb_host=vaxult2 ;; vax-*-ultrix*) gdb_host=vaxult ;; diff --git a/gnu/usr.bin/binutils/gdb/kcore-nbsd.c b/gnu/usr.bin/binutils/gdb/kcore-nbsd.c new file mode 100644 index 00000000000..b9778657b42 --- /dev/null +++ b/gnu/usr.bin/binutils/gdb/kcore-nbsd.c @@ -0,0 +1,474 @@ +/* Kernel core dump functions below target vector, for GDB. + Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995 + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* + * This works like "remote" but, you use it like this: + * target kcore /dev/mem + * or + * target kcore /var/crash/host/core.0 + * + * This way makes it easy to short-circut the whole bfd monster, + * and direct the inferior stuff to our libkvm implementation. + */ + +#include <sys/param.h> +#include <sys/time.h> +#include <sys/proc.h> +#include <sys/user.h> +#include <errno.h> +#include <signal.h> +#include <fcntl.h> +#include <kvm.h> + +#include "defs.h" +#include "gdb_string.h" +#include "frame.h" /* required by inferior.h */ +#include "inferior.h" +#include "symtab.h" +#include "command.h" +#include "bfd.h" +#include "target.h" +#include "gdbcore.h" + +struct target_ops kcore_ops; + +static void +kcore_files_info PARAMS ((struct target_ops *)); + +static void +kcore_close PARAMS ((int)); + +static void +get_kcore_registers PARAMS ((int)); + +static int +xfer_mem PARAMS ((CORE_ADDR, char *, int, int, struct target_ops *)); + +static int +xfer_umem PARAMS ((CORE_ADDR, char *, int, int)); + +static char *core_file; +static kvm_t *core_kd; +static struct pcb cur_pcb; + + +/* + * Read the "thing" at kernel address 'addr' into the space pointed to + * by point. The length of the "thing" is determined by the type of p. + * Result is non-zero if transfer fails. + */ +#define kvread(addr, p) \ +(target_read_memory((CORE_ADDR)(addr), (char *)(p), sizeof(*(p)))) + + +CORE_ADDR +ksym_lookup(name) + const char *name; +{ + struct minimal_symbol *sym; + + sym = lookup_minimal_symbol(name, NULL, NULL); + if (sym == NULL) + error("kernel symbol `%s' not found.", name); + + return SYMBOL_VALUE_ADDRESS(sym); +} + +/* + * Provide the address of an initial PCB to use. + * If this is a crash dump, try for "dumppcb". + * If no "dumppcb" or it's /dev/mem, use proc0. + * Return the core address of the PCB we found. + */ +static CORE_ADDR +initial_pcb() +{ + struct minimal_symbol *sym; + CORE_ADDR addr; + void *val; + + /* Make sure things are open... */ + if (!core_kd || !core_file) + return (0); + + /* If this is NOT /dev/mem try for dumppcb. */ + if (strncmp(core_file, "/dev/", 5)) { + sym = lookup_minimal_symbol("dumppcb", NULL, NULL); + if (sym != NULL) { + addr = SYMBOL_VALUE_ADDRESS(sym); + return (addr); + } + } + + /* + * OK, just use proc0pcb. Note that curproc might + * not exist, and if it does, it will point to gdb. + * Therefore, just use proc0 and let the user set + * some other context if they care about it. + */ + addr = ksym_lookup("proc0paddr"); + if (kvread(addr, &val)) { + error("cannot read proc0paddr pointer at %x\n", addr); + val = 0; + } + + return ((CORE_ADDR)val); +} + +/* + * Set the current context to that of the PCB struct + * at the system address passed. + */ +static int +set_context(addr) + CORE_ADDR addr; +{ + + if (kvread(addr, &cur_pcb)) + error("cannot read pcb at %#x", addr); + + /* Fetch all registers from core file */ + target_fetch_registers (-1); + + /* Now, set up the frame cache, and print the top of stack */ + flush_cached_frames(); + set_current_frame (create_new_frame (read_fp (), read_pc ())); + select_frame (get_current_frame (), 0); + return (0); +} + +/* Discard all vestiges of any previous core file and mark data and stack + spaces as empty. */ + +/* ARGSUSED */ +static void +kcore_close (quitting) + int quitting; +{ + + inferior_pid = 0; /* Avoid confusion from thread stuff */ + + if (core_kd) { + kvm_close(core_kd); + free(core_file); + core_file = NULL; + core_kd = NULL; + } +} + +/* This routine opens and sets up the core file bfd. */ + +static void +kcore_open (filename, from_tty) + char *filename; /* the core file */ + int from_tty; +{ + kvm_t *kd; + const char *p; + struct cleanup *old_chain; + char buf[256], *cp; + int ontop; + CORE_ADDR addr; + + target_preopen (from_tty); + + /* The exec file is required for symbols. */ + if (exec_bfd == NULL) + error("No kernel exec file specified"); + + if (core_kd) { + error ("No core file specified." + " (Use `detach' to stop debugging a core file.)"); + return; + } + + if (!filename) { + error ("No core file specified."); + return; + } + + filename = tilde_expand (filename); + if (filename[0] != '/') { + cp = concat (current_directory, "/", filename, NULL); + free (filename); + filename = cp; + } + + old_chain = make_cleanup (free, filename); + + kd = kvm_open (bfd_get_filename(exec_bfd), filename, NULL, + write_files ? O_RDWR: O_RDONLY, 0); + if (kd == NULL) { + perror_with_name (filename); + return; + } + + /* Looks semi-reasonable. Toss the old core file and work on the new. */ + + discard_cleanups (old_chain); /* Don't free filename any more */ + core_file = filename; + unpush_target (&kcore_ops); + ontop = !push_target (&kcore_ops); + + /* Note unpush_target (above) calls kcore_close. */ + core_kd = kd; + + /* print out the panic string if there is one */ + if (kvread(ksym_lookup("panicstr"), &addr) == 0 && + addr != 0 && + target_read_memory(addr, buf, sizeof(buf)) == 0) { + + for (cp = buf; cp < &buf[sizeof(buf)] && *cp; cp++) + if (!isascii(*cp) || (!isprint(*cp) && !isspace(*cp))) + *cp = '?'; + *cp = '\0'; + if (buf[0] != '\0') + printf_filtered("panic: %s\n", buf); + } + + if (!ontop) { + warning ( +"you won't be able to access this core file until you terminate\n\ +your %s; do ``info files''", target_longname); + return; + } + + /* Now, set up process context, and print the top of stack */ + (void)set_context(initial_pcb()); + print_stack_frame (selected_frame, selected_frame_level, 1); +} + +static void +kcore_detach (args, from_tty) + char *args; + int from_tty; +{ + if (args) + error ("Too many arguments"); + unpush_target (&kcore_ops); + reinit_frame_cache (); + if (from_tty) + printf_filtered ("No kernel core file now.\n"); +} + +/* Get the registers out of a core file. This is the machine- + independent part. Fetch_core_registers is the machine-dependent + part, typically implemented in the xm-file for each architecture. */ + +/* We just get all the registers, so we don't use regno. */ + +/* ARGSUSED */ +static void +get_kcore_registers (regno) + int regno; +{ + + /* + * XXX - Only read the pcb when set_context() is called. + * When looking at a live kernel this may be a problem, + * but the user can do another "proc" or "pcb" command to + * grab a new copy of the pcb... + */ + + /* + * Zero out register set then fill in the ones we know about. + */ + fetch_kcore_registers (&cur_pcb); +} + +static void +kcore_files_info (t) + struct target_ops *t; +{ + printf_filtered ("\t`%s'\n", core_file); +} + +/* If mourn is being called in all the right places, this could be say + `gdb internal error' (since generic_mourn calls breakpoint_init_inferior). */ + +static int +ignore (addr, contents) + CORE_ADDR addr; + char *contents; +{ + return 0; +} + +static int +xfer_kmem (memaddr, myaddr, len, write, target) + CORE_ADDR memaddr; + char *myaddr; + int len; + int write; + struct target_ops *target; +{ + int n; + +#if 0 /* XXX */ + if (it is a user address) + return xfer_umem(memaddr, myaddr, len, write); +#endif + + if (core_kd == NULL) + return 0; + + if (write) + n = kvm_write(core_kd, memaddr, myaddr, len); + else + n = kvm_read (core_kd, memaddr, myaddr, len) ; + if (n < 0) { + fprintf_unfiltered (gdb_stderr, "can not access 0x%x, %s\n", + memaddr, kvm_geterr(core_kd)); + n = 0; + } + + return n; +} + +#if 0 /* XXX */ +static int +xfer_umem (memaddr, myaddr, len, write) + CORE_ADDR memaddr; + char *myaddr; + int len; + int write; /* ignored */ +{ + int n; + struct proc proc; + + if (kvread(cur_proc, &proc)) + error("cannot read proc at %#x", cur_proc); + n = kvm_uread(core_kd, &proc, memaddr, myaddr, len) ; + + if (n < 0) + return 0; + return n; +} +#endif + +static void +set_proc_cmd(arg) + char *arg; +{ + CORE_ADDR addr; + void *val; + + if (!arg) + error_no_arg("proc address for the new context"); + + if (core_kd == NULL) + error("no kernel core file"); + + addr = (CORE_ADDR)parse_and_eval_address(arg); + + /* Read the PCB address in proc structure. */ + addr += (int) &((struct proc *)0)->p_addr; + if (kvread(addr, &val)) + error("cannot read u area ptr"); + + if (set_context((CORE_ADDR)val)) + error("invalid proc address"); +} + +static void +set_pcb_cmd(arg) + char *arg; +{ + CORE_ADDR addr; + void *val; + + if (!arg) + error_no_arg("pcb address for the new context"); + + if (core_kd == NULL) + error("no kernel core file"); + + addr = (CORE_ADDR)parse_and_eval_address(arg); + + if (set_context(addr)) + error("invalid pcb address"); +} + +struct target_ops kcore_ops = { + "kcore", /* to_shortname */ + "Kernel memory image", /* to_longname */ + "Use a kernel core dump file or live kernel as a target.\n\ +Specify the filename of the core file or /dev/mem for the live kernel.", + kcore_open, /* to_open */ + kcore_close, /* to_close */ + find_default_attach, /* to_attach */ + kcore_detach, /* to_detach */ + 0, /* to_resume */ + 0, /* to_wait */ + get_kcore_registers, /* to_fetch_registers */ + 0, /* to_store_registers */ + 0, /* to_prepare_to_store */ + xfer_kmem, /* to_xfer_memory */ + kcore_files_info, /* to_files_info */ + ignore, /* to_insert_breakpoint */ + ignore, /* to_remove_breakpoint */ + + 0, /* to_terminal_init */ + 0, /* to_terminal_inferior */ + 0, /* to_terminal_ours_for_output */ + 0, /* to_terminal_ours */ + 0, /* to_terminal_info */ + + 0, /* to_kill */ + 0, /* to_load */ + 0, /* to_lookup_symbol */ + + find_default_create_inferior, /* to_create_inferior */ + 0, /* to_mourn_inferior */ + 0, /* to_can_run */ + 0, /* to_notice_signals */ + 0, /* to_thread_alive */ + 0, /* to_stop */ + + /* + * Use the same "stratum" as remote.c uses, because + * find_core_target() should NOT find this target. + */ + process_stratum, /* to_stratum */ + 0, /* to_next */ + + 0, /* to_has_all_memory */ + 1, /* to_has_memory */ + 1, /* to_has_stack */ + 1, /* to_has_registers */ + 0, /* to_has_execution */ + + 0, /* to_sections */ + 0, /* to_sections_end */ + OPS_MAGIC, /* to_magic */ +}; + +void +_initialize_kcore_nbsd() +{ + + add_target (&kcore_ops); + + add_com ("proc", class_obscure, set_proc_cmd, + "Set current context from proc address"); + add_com ("pcb", class_obscure, set_pcb_cmd, + "Set current context from pcb address"); +} diff --git a/gnu/usr.bin/binutils/gdb/m68k-tdep.c b/gnu/usr.bin/binutils/gdb/m68k-tdep.c index d597efa0ec7..9da48b8eb63 100644 --- a/gnu/usr.bin/binutils/gdb/m68k-tdep.c +++ b/gnu/usr.bin/binutils/gdb/m68k-tdep.c @@ -20,9 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "defs.h" #include "frame.h" #include "symtab.h" -#include "gdbcore.h" -#include "value.h" -#include "gdb_string.h" /* Push an empty stack frame, to record the current PC, etc. */ @@ -64,6 +61,7 @@ m68k_pop_frame () register CORE_ADDR fp; register int regnum; struct frame_saved_regs fsr; + struct frame_info *fi; char raw_buffer[12]; fp = FRAME_FP (frame); @@ -509,6 +507,59 @@ m68k_saved_pc_after_call(frame) return read_memory_integer (read_register (SP_REGNUM), 4); } +/* This used to be needed by tm-sun3.h but is probably not + used by any targets anymore. Keep it for now anyway. + This works like blockframe.c:sigtramp_saved_pc() */ + +#ifdef SIG_PC_FP_OFFSET +CORE_ADDR +m68k_sigtramp_saved_pc (frame) + struct frame_info *frame; +{ + CORE_ADDR nextfp, pc; + + if (frame->signal_handler_caller == 0) + abort(); + + nextfp = (frame)->next ? + (frame)->next->frame : + read_register (SP_REGNUM) - 8; + nextfp += SIG_PC_FP_OFFSET; + + pc = read_memory_integer (nextfp, 4); + + return pc; +} +#endif /* SIG_PC_FP_OFFSET */ + +/* For Open- and NetBSD, sigtramp is 32 bytes before STACK_END_ADDR, + but we don't know where that is until run-time! */ + +#if defined(TM_NBSD_H) || defined(TM_OBSD_H) +int +nbsd_in_sigtramp (pc) + CORE_ADDR pc; +{ + static CORE_ADDR stack_end_addr; + struct minimal_symbol *msymbol; + CORE_ADDR pssaddr; + int rv; + + if (stack_end_addr == 0) { + msymbol = lookup_minimal_symbol("__ps_strings", NULL, NULL); + if (msymbol == NULL) + pssaddr = 0x40a0; /* XXX return 0? */ + else + pssaddr = SYMBOL_VALUE_ADDRESS(msymbol); + stack_end_addr = read_memory_integer (pssaddr, 4); + stack_end_addr = (stack_end_addr + 0xFF) & ~0xFF; + } + rv = ((pc >= (stack_end_addr - 32)) && + (pc < stack_end_addr)); + return rv; +} +#endif /* TM_NBSD_H || TM_OBSD_H */ + void _initialize_m68k_tdep () { diff --git a/gnu/usr.bin/binutils/gdb/m68knbsd-nat.c b/gnu/usr.bin/binutils/gdb/m68knbsd-nat.c index c2e71dfb570..c1a604f7045 100644 --- a/gnu/usr.bin/binutils/gdb/m68knbsd-nat.c +++ b/gnu/usr.bin/binutils/gdb/m68knbsd-nat.c @@ -1,5 +1,5 @@ -/* Native-dependent code for Motorola m68k's running NetBSD, for GDB. - Copyright 1988, 1989, 1991, 1992, 1994, 1996 Free Software Foundation, Inc. +/* Functions specific to running gdb native on an m68k running NetBSD + Copyright 1989, 1992, 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -19,34 +19,41 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <sys/types.h> #include <sys/ptrace.h> -#include <machine/reg.h> -#include <machine/frame.h> +#include <m68k/reg.h> +#include <m68k/frame.h> +#ifdef __OpenBSD__ +#include <machine/pcb.h> +#else +#include <m68k/pcb.h> +#endif #include "defs.h" #include "inferior.h" +#include "target.h" +#include "gdbcore.h" void -fetch_inferior_registers(regno) +fetch_inferior_registers (regno) int regno; { struct reg inferior_registers; struct fpreg inferior_fp_registers; - ptrace (PT_GETREGS, inferior_pid, + ptrace (PT_GETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0); - memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers, + memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers, sizeof(inferior_registers)); - ptrace (PT_GETFPREGS, inferior_pid, + ptrace (PT_GETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0); - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, + memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, sizeof(inferior_fp_registers)); registers_fetched (); } void -store_inferior_registers(regno) +store_inferior_registers (regno) int regno; { struct reg inferior_registers; @@ -54,33 +61,114 @@ store_inferior_registers(regno) memcpy (&inferior_registers, ®isters[REGISTER_BYTE (0)], sizeof(inferior_registers)); - ptrace (PT_SETREGS, inferior_pid, + ptrace (PT_SETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0); memcpy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], sizeof(inferior_fp_registers)); - ptrace (PT_SETFPREGS, inferior_pid, + ptrace (PT_SETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0); } + +/* XXX - Add this to machine/regs.h instead? */ struct md_core { - struct reg intreg; + struct reg intreg; struct fpreg freg; }; -void -fetch_core_registers (core_reg_sect, core_reg_size, which, ignore) +static void +fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) char *core_reg_sect; unsigned core_reg_size; int which; - CORE_ADDR ignore; + unsigned int reg_addr; /* Unused in this version */ { - struct md_core *core_reg = (struct md_core *)core_reg_sect; - + struct md_core *core_reg; + + core_reg = (struct md_core *)core_reg_sect; + + /* We get everything from the .reg section. */ + if (which != 0) + return; + + if (core_reg_size < sizeof(*core_reg)) { + fprintf_unfiltered (gdb_stderr, "Couldn't read regs from core file\n"); + return; + } + /* Integer registers */ memcpy(®isters[REGISTER_BYTE (0)], &core_reg->intreg, sizeof(struct reg)); /* Floating point registers */ memcpy(®isters[REGISTER_BYTE (FP0_REGNUM)], &core_reg->freg, sizeof(struct fpreg)); + + registers_fetched (); +} + +/* Register that we are able to handle m68knbsd core file formats. + FIXME: is this really bfd_target_unknown_flavour? */ + +static struct core_fns nat_core_fns = +{ + bfd_target_unknown_flavour, + fetch_core_registers, + NULL +}; + +void +_initialize_m68knbsd_nat () +{ + add_core_fns (&nat_core_fns); +} + + +/* + * kernel_u_size() is not helpful on NetBSD because + * the "u" struct is NOT in the core dump file. + */ + +#ifdef FETCH_KCORE_REGISTERS +/* + * Get registers from a kernel crash dump or live kernel. + * Called by kcore-nbsd.c:get_kcore_registers(). + */ +void +fetch_kcore_registers (pcb) + struct pcb *pcb; +{ + int i, *ip, tmp=0; + + /* D0,D1 */ + ip = &tmp; + supply_register(0, (char *)ip); + supply_register(1, (char *)ip); + /* D2-D7 */ + ip = &pcb->pcb_regs[0]; + for (i = 2; i < 8; i++, ip++) + supply_register(i, (char *)ip); + + /* A0,A1 */ + ip = &tmp; + supply_register(8, (char *)ip); + supply_register(9, (char *)ip); + /* A2-A7 */ + ip = &pcb->pcb_regs[6]; + for (i = 10; i < 16; i++, (char *)ip++) + supply_register(i, (char *)ip); + + /* PS (sr) */ + tmp = pcb->pcb_ps & 0xFFFF; + supply_register(PS_REGNUM, (char *)&tmp); + + /* PC (use return address) */ + tmp = pcb->pcb_regs[10] + 4; + if (target_read_memory(tmp, (char *)&tmp, sizeof(tmp))) + tmp = 0; + supply_register(PC_REGNUM, (char *)&tmp); + + /* The kernel does not use the FPU, so ignore it. */ + registers_fetched (); } +#endif /* FETCH_KCORE_REGISTERS */ diff --git a/gnu/usr.bin/binutils/gdb/vaxnbsd-nat.c b/gnu/usr.bin/binutils/gdb/vaxnbsd-nat.c new file mode 100644 index 00000000000..b5cac264929 --- /dev/null +++ b/gnu/usr.bin/binutils/gdb/vaxnbsd-nat.c @@ -0,0 +1,128 @@ +/* Functions specific to running gdb native on a VAX running NetBSD + Copyright 1989, 1992, 1993, 1994, 1996 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include <sys/types.h> +#include <sys/ptrace.h> +#include <machine/reg.h> +#include <machine/frame.h> +#include <machine/pcb.h> + +#include "defs.h" +#include "inferior.h" +#include "target.h" +#include "gdbcore.h" + +void +fetch_inferior_registers (regno) + int regno; +{ + struct reg inferior_registers; + + ptrace (PT_GETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers, 0); + memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers, + sizeof(inferior_registers)); + + registers_fetched (); +} + +void +store_inferior_registers (regno) + int regno; +{ + struct reg inferior_registers; + + memcpy (&inferior_registers, ®isters[REGISTER_BYTE (0)], + sizeof(inferior_registers)); + ptrace (PT_SETREGS, inferior_pid, + (PTRACE_ARG3_TYPE) &inferior_registers, 0); +} + + +/* XXX - Add this to machine/regs.h instead? */ +struct md_core { + struct reg intreg; + /* struct fpreg freg; XXX */ +}; + +static void +fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) + char *core_reg_sect; + unsigned core_reg_size; + int which; + unsigned int reg_addr; /* Unused in this version */ +{ + struct md_core *core_reg; + + core_reg = (struct md_core *)core_reg_sect; + + /* We get everything from the .reg section. */ + if (which != 0) + return; + + if (core_reg_size < sizeof(*core_reg)) { + fprintf_unfiltered (gdb_stderr, "Couldn't read regs from core file\n"); + return; + } + + /* Integer registers */ + memcpy(®isters[REGISTER_BYTE (0)], + &core_reg->intreg, sizeof(struct reg)); + + registers_fetched (); +} + +/* Register that we are able to handle vaxnbsd core file formats. + FIXME: is this really bfd_target_unknown_flavour? */ + +static struct core_fns nat_core_fns = +{ + bfd_target_unknown_flavour, + fetch_core_registers, + NULL +}; + +void +_initialize_vaxnbsd_nat () +{ + add_core_fns (&nat_core_fns); +} + + +/* + * kernel_u_size() is not helpful on NetBSD because + * the "u" struct is NOT in the core dump file. + */ + +#ifdef FETCH_KCORE_REGISTERS +/* + * Get registers from a kernel crash dump or live kernel. + * Called by kcore-nbsd.c:get_kcore_registers(). + */ +void +fetch_kcore_registers (pcb) + struct pcb *pcb; +{ + + printf("XXX: fetch_kcore_registers\n"); + + /* The kernel does not use the FPU, so ignore it. */ + registers_fetched (); +} +#endif /* FETCH_KCORE_REGISTERS */ |