summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorgwr <gwr@NetBSD.org>1995-04-16 03:07:47 +0000
committergwr <gwr@NetBSD.org>1995-04-16 03:07:47 +0000
commit5acd5ef18f8a3bf235bbad20cd5c86d267326e2d (patch)
tree133d17562cc1c754282d59cd99d1c51f79e03f7f /gnu
parentef7ca50d54185a64b6ba86c03c97e367352be470 (diff)
Support new style core dumps (with .reg section)
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/gdb/bfd/arch/m68k/Makefile.inc11
-rw-r--r--gnu/usr.bin/gdb/gdb/arch/m68k/Makefile.inc4
-rw-r--r--gnu/usr.bin/gdb/gdb/arch/m68k/m68k-nat.c82
-rw-r--r--gnu/usr.bin/gdb/gdb/arch/m68k/nm.h53
4 files changed, 71 insertions, 79 deletions
diff --git a/gnu/usr.bin/gdb/bfd/arch/m68k/Makefile.inc b/gnu/usr.bin/gdb/bfd/arch/m68k/Makefile.inc
index 3b841a765b9..6f1c8f8c27d 100644
--- a/gnu/usr.bin/gdb/bfd/arch/m68k/Makefile.inc
+++ b/gnu/usr.bin/gdb/bfd/arch/m68k/Makefile.inc
@@ -1,11 +1,10 @@
-# $Id: Makefile.inc,v 1.3 1994/09/19 23:51:29 deraadt Exp $
+# $Id: Makefile.inc,v 1.4 1995/04/16 03:09:24 gwr Exp $
SRCS+= netbsdm68k.c netbsdm68k4k.c cpu-m68k.c trad-core.c
-CFLAGS+= -DTRAD_CORE
-
-VECTORS= -DDEFAULT_VECTOR=netbsd_m68k4k_vec \
+# Note: DEFAULT_VECTOR is actually ignored when SELECT_VECS is set.
+VECTORS= -DDEFAULT_VECTOR=netbsd_m68k_vec \
-DSELECT_ARCHITECTURES=bfd_m68k_arch \
- -DSELECT_VECS='&netbsd_m68k_vec, &netbsd_m68k4k_vec'
-
+ -DSELECT_VECS=' &netbsd_m68k_vec, &netbsd_m68k4k_vec, \
+ &netbsd_core_vec, &trad_core_vec '
diff --git a/gnu/usr.bin/gdb/gdb/arch/m68k/Makefile.inc b/gnu/usr.bin/gdb/gdb/arch/m68k/Makefile.inc
index cb25d9f0423..8526eb3b41d 100644
--- a/gnu/usr.bin/gdb/gdb/arch/m68k/Makefile.inc
+++ b/gnu/usr.bin/gdb/gdb/arch/m68k/Makefile.inc
@@ -1,4 +1,4 @@
-# $Id: Makefile.inc,v 1.2 1994/05/25 18:27:49 pk Exp $
+# $Id: Makefile.inc,v 1.3 1995/04/16 03:07:47 gwr Exp $
-SRCS+= coredep.c m68k-pinsn.c m68k-tdep.c m68k-dis.c m68881-ext.c m68k-nat.c
+SRCS+= m68k-pinsn.c m68k-tdep.c m68k-dis.c m68881-ext.c m68k-nat.c
diff --git a/gnu/usr.bin/gdb/gdb/arch/m68k/m68k-nat.c b/gnu/usr.bin/gdb/gdb/arch/m68k/m68k-nat.c
index a6c329a4217..f88ca788d71 100644
--- a/gnu/usr.bin/gdb/gdb/arch/m68k/m68k-nat.c
+++ b/gnu/usr.bin/gdb/gdb/arch/m68k/m68k-nat.c
@@ -17,7 +17,7 @@ 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.
- $Id: m68k-nat.c,v 1.6 1995/01/26 18:28:18 mycroft Exp $
+ $Id: m68k-nat.c,v 1.7 1995/04/16 03:07:49 gwr Exp $
*/
#include <sys/types.h>
@@ -68,33 +68,75 @@ store_inferior_registers (regno)
(PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
}
+/* XXX - Add this to machine/regs.h instead? */
+struct md_core {
+ struct reg intreg;
+ struct fpreg freg;
+};
+/* Get registers from a core file. */
+void
+fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
+ char *core_reg_sect;
+ unsigned core_reg_size;
+ int which;
+ unsigned int ignore; /* reg addr, unused in this version */
+{
+ struct md_core *core_reg;
+
+ core_reg = (struct md_core *)core_reg_sect;
+
+ if (which == 0) {
+ /* Integer registers */
+ memcpy(&registers[REGISTER_BYTE (0)],
+ &core_reg->intreg, sizeof(struct reg));
+ } else if (which == 2) {
+ /* Floating point registers */
+ memcpy(&registers[REGISTER_BYTE (FP0_REGNUM)],
+ &core_reg->freg, sizeof(struct fpreg));
+ }
+}
+
+/* Get registers from a kernel crash dump. */
void
fetch_kcore_registers(pcb)
struct pcb *pcb;
{
- int i;
-
- for (i = 2; i < 8; ++i)
- supply_register(i, &pcb->pcb_regs[i-2]);
- for (i = 10; i < 16; ++i)
- supply_register(i, &pcb->pcb_regs[i-4]);
-
- /* fake 'scratch' regs d0, d1, a0, a1 */
- i = 0;
- supply_register(0, &i); supply_register(1, &i);
- supply_register(8, &i); supply_register(9, &i);
-
- if (target_read_memory(pcb->pcb_regs[10] + 4, &i, sizeof i, 0))
- supply_register(PC_REGNUM, &i);
+ int i, *ip, tmp=0;
+
+ /* D0,D1 */
+ ip = &tmp;
+ supply_register(0, ip);
+ supply_register(1, ip);
+ /* D2-D7 */
+ ip = &pcb->pcb_regs[0];
+ for (i = 2; i < 8; i++, ip++)
+ supply_register(i, ip);
+
+ /* A0,A1 */
+ ip = &tmp;
+ supply_register(8, ip);
+ supply_register(9, ip);
+ /* A2-A7 */
+ ip = &pcb->pcb_regs[6];
+ for (i = 10; i < 16; i++, ip++)
+ supply_register(i, ip);
+
+ /* PC (use return address) */
+ tmp = pcb->pcb_regs[10] + 4;
+ if (target_read_memory(tmp, &tmp, sizeof(tmp), 0))
+ supply_register(PC_REGNUM, &tmp);
supply_register(PS_REGNUM, &pcb->pcb_ps);
- for (i = FP0_REGNUM; i < NUM_REGS; ++i) {
- int fpreg;
+ /* FP0-FP7 */
+ ip = &pcb->pcb_fpregs.fpf_regs[0];
+ for (i = 0; i < 8; ++i, ip+=3)
+ supply_register(FP0_REGNUM+i, ip);
- REGISTER_U_ADDR(fpreg, 0, i);
- supply_register(i, ((char *)pcb) + fpreg);
- }
+ /* FPCR, FPSR, FPIAR */
+ supply_register(FPC_REGNUM, ip++);
+ supply_register(FPS_REGNUM, ip++);
+ supply_register(FPI_REGNUM, ip++);
return;
}
diff --git a/gnu/usr.bin/gdb/gdb/arch/m68k/nm.h b/gnu/usr.bin/gdb/gdb/arch/m68k/nm.h
index 082d57e4d71..6650a5691f2 100644
--- a/gnu/usr.bin/gdb/gdb/arch/m68k/nm.h
+++ b/gnu/usr.bin/gdb/gdb/arch/m68k/nm.h
@@ -1,57 +1,8 @@
-/* Parameters for Hewlett-Packard 9000/300 native support under bsd.
- Copyright 1986, 1987, 1989, 1991, 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.
-
- $Id: nm.h,v 1.4 1994/03/09 16:15:55 pk Exp $
-*/
-#include <machine/vmparam.h>
+/* $NetBSD: nm.h,v 1.5 1995/04/16 03:07:50 gwr Exp $ */
#define PTRACE_ARG3_TYPE caddr_t
#define ATTACH_DETACH
-/* KUSER_AREA is the address the kernel uses for struct user */
-#if ! defined (KUSER_AREA)
-#define KUSER_AREA USRSTACK
-#endif
-
-#define KERNEL_U_ADDR KUSER_AREA
-
-/* This is a piece of magic that is given a register number REGNO
- and as BLOCKEND the address in the system of the end of the user structure
- and stores in ADDR the address in the kernel or core dump
- of that register. */
-
-#define REGISTER_U_ADDR(addr, blockend, regno) \
-{ \
- if (regno < PS_REGNUM) \
- addr = (int) &((struct frame *)(blockend))->f_regs[regno]; \
- else if (regno == PS_REGNUM) \
- addr = (int) &((struct frame *)(blockend))->f_stackadj; \
- else if (regno == PC_REGNUM) \
- addr = (int) &((struct frame *)(blockend))->f_pc; \
- else if (regno < FPC_REGNUM) \
- addr = (int) \
- &((struct user *)0)->u_pcb.pcb_fpregs.fpf_regs[((regno)-FP0_REGNUM)*3];\
- else if (regno == FPC_REGNUM) \
- addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpcr; \
- else if (regno == FPS_REGNUM) \
- addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpsr; \
- else \
- addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpiar; \
-}
+#define FETCH_INFERIOR_REGISTERS