Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/gnu/dist/toolchain/gdb More changes to get gdb to run on Net...
details: https://anonhg.NetBSD.org/src/rev/726b423375db
branches: trunk
changeset: 512727:726b423375db
user: matt <matt%NetBSD.org@localhost>
date: Sun Jul 15 07:43:12 2001 +0000
description:
More changes to get gdb to run on NetBSD/arm
diffstat:
gnu/dist/toolchain/gdb/arm-tdep.c | 27 ++++
gnu/dist/toolchain/gdb/armnbsd-nat.c | 179 ++++++++++++++++++++++++++++
gnu/dist/toolchain/gdb/config/arm/arm.mh | 6 -
gnu/dist/toolchain/gdb/config/arm/arm.mt | 7 -
gnu/dist/toolchain/gdb/config/arm/nbsd.mh | 2 +-
gnu/dist/toolchain/gdb/config/arm/tm-nbsd.h | 3 +
6 files changed, 210 insertions(+), 14 deletions(-)
diffs (261 lines):
diff -r 4699780c66f1 -r 726b423375db gnu/dist/toolchain/gdb/arm-tdep.c
--- a/gnu/dist/toolchain/gdb/arm-tdep.c Sun Jul 15 06:38:07 2001 +0000
+++ b/gnu/dist/toolchain/gdb/arm-tdep.c Sun Jul 15 07:43:12 2001 +0000
@@ -2113,3 +2113,30 @@
val == C_THUMBSTATFUNC ||
val == C_THUMBLABEL);
}
+
+#ifdef GET_LONGJMP_TARGET
+
+/* Figure out where the longjmp will land. Slurp the args out of the stack.
+ We expect the first arg to be a pointer to the jmp_buf structure from which
+ we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
+ This routine returns true on success. */
+
+int
+get_longjmp_target(pc)
+ CORE_ADDR *pc;
+{
+ CORE_ADDR jb_addr;
+ char raw_buffer[MAX_REGISTER_RAW_SIZE];
+
+ jb_addr = read_register(0);
+
+ if (target_read_memory(jb_addr + JB_PC * JB_ELEMENT_SIZE, raw_buffer,
+ sizeof(CORE_ADDR)))
+ return 0;
+
+ *pc = extract_address (raw_buffer, sizeof(CORE_ADDR));
+ return 1;
+
+}
+
+#endif /* GET_LONGJMP_TARGET */
diff -r 4699780c66f1 -r 726b423375db gnu/dist/toolchain/gdb/armnbsd-nat.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gnu/dist/toolchain/gdb/armnbsd-nat.c Sun Jul 15 07:43:12 2001 +0000
@@ -0,0 +1,179 @@
+/* Native-dependent code for BSD Unix running on i386's, for GDB.
+ Copyright 1988, 1989, 1991, 1992, 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 "defs.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/ptrace.h>
+#include <sys/user.h>
+#include <machine/reg.h>
+#include "inferior.h"
+#include "gdbcore.h"
+#include "target.h"
+
+void
+fetch_inferior_registers(regno)
+ int regno;
+{
+ struct reg inferior_registers;
+ struct fpreg fp_registers;
+ int loop;
+
+ /* integer registers */
+ ptrace(PT_GETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0);
+ memcpy(®isters[REGISTER_BYTE(0)], &inferior_registers, 4*16);
+ memcpy(®isters[REGISTER_BYTE(PS_REGNUM)], &inferior_registers.r_cpsr, 4);
+
+ /* floating point registers */
+ ptrace(PT_GETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &fp_registers, 0);
+ memcpy(®isters[REGISTER_BYTE(F0_REGNUM)], &fp_registers.fpr[0], 12*8);
+ memcpy(®isters[REGISTER_BYTE(FPS_REGNUM)], &fp_registers.fpr_fpsr, 4);
+
+ registers_fetched ();
+}
+
+void
+store_inferior_registers(regno)
+ int regno;
+{
+ struct reg inferior_registers;
+ struct fpreg fp_registers;
+
+ /* integer registers */
+ memcpy(&inferior_registers.r_cpsr, ®isters[REGISTER_BYTE(PS_REGNUM)], 4);
+ memcpy(&inferior_registers, ®isters[REGISTER_BYTE(0)], 4*16);
+ ptrace(PT_SETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0);
+
+ /* floating point registers */
+ memcpy(&fp_registers.fpr_fpsr, ®isters[REGISTER_BYTE(FPS_REGNUM)], 4);
+ memcpy(&fp_registers.fpr[0], ®isters[REGISTER_BYTE(F0_REGNUM)], 12*8);
+ ptrace(PT_SETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &fp_registers, 0);
+}
+
+struct md_core {
+ struct reg intreg;
+ struct fpreg freg;
+};
+
+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;
+{
+ struct md_core *core_reg = (struct md_core *)core_reg_sect;
+
+ /* integer registers */
+ memcpy(®isters[REGISTER_BYTE(0)], &core_reg->intreg, 4*16);
+ memcpy(®isters[REGISTER_BYTE(PS_REGNUM)], &core_reg->intreg.r_cpsr, 4);
+
+ /* floating point registers */
+ memcpy(®isters[REGISTER_BYTE(F0_REGNUM)], &core_reg->freg.fpr[0], 12*8);
+ memcpy(®isters[REGISTER_BYTE(FPS_REGNUM)], &core_reg->freg.fpr_fpsr, 4);
+}
+
+int
+kernel_u_size ()
+{
+ return (sizeof (struct user));
+}
+
+/*
+ * NetBSD core stuf should be in netbsd-core.c
+ */
+
+static struct core_fns netbsd_core_fns =
+{
+ bfd_target_unknown_flavour,
+ fetch_core_registers,
+ NULL
+};
+
+void
+_initialize_core_netbsd ()
+{
+ add_core_fns (&netbsd_core_fns);
+}
+
+/* Single stepping support */
+
+static char breakpoint_shadow[BREAKPOINT_MAX];
+static CORE_ADDR next_pc;
+
+/* Non-zero if we just simulated a single-step ptrace call. This is
+ * needed because we cannot remove the breakpoints in the inferior
+ * process until after the `wait' in `wait_for_inferior'.
+ */
+
+int one_stepped;
+
+/* single_step() is called just before we want to resume the inferior,
+ * if we want to single-step it but there is no hardware or kernel
+ * single-step support. We find all the possible targets of the
+ * coming instruction and breakpoint them.
+ *
+ * single_step is also called just after the inferior stops. If we had
+ * set up a simulated single-step, we undo our damage.
+ */
+
+void
+single_step (ignore)
+ enum target_signal ignore; /* signal, but we don't need it */
+{
+ CORE_ADDR arm_pc;
+
+ if (!one_stepped)
+ {
+ /*
+ * Ok arm_pc is the address of the instruction will will run
+ * when we resume.
+ * Analyse the instruction at this address to work out the
+ * address of the next instruction.
+ */
+
+ arm_pc = read_register(PC_REGNUM);
+ next_pc = arm_get_next_pc(arm_pc);
+
+ target_insert_breakpoint(next_pc, breakpoint_shadow);
+/* printf_unfiltered("pc=%x: set break at %x\n", arm_pc, next_pc);*/
+
+ /* We are ready to let it go */
+ one_stepped = 1;
+ return;
+ }
+ else
+ {
+ /* Remove breakpoints */
+ target_remove_breakpoint(next_pc, breakpoint_shadow);
+
+ one_stepped = 0;
+ }
+}
+
+/*
+ * Temporary routine to warn folks this code is still experimental
+ */
+
+extern char *target_name;
+void
+_initialize_armnbsd_nat ()
+{
+}
diff -r 4699780c66f1 -r 726b423375db gnu/dist/toolchain/gdb/config/arm/arm.mh
--- a/gnu/dist/toolchain/gdb/config/arm/arm.mh Sun Jul 15 06:38:07 2001 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-# OBSOLETE # Host: Acorn RISC machine running RISCiX (4.3bsd)
-# OBSOLETE XDEPFILES= infptrace.o inftarg.o fork-child.o arm-xdep.o arm-convert.o
-# OBSOLETE
-# OBSOLETE XM_FILE= xm-arm.h
-# OBSOLETE
-# OBSOLETE NAT_FILE= nm-arm.h
diff -r 4699780c66f1 -r 726b423375db gnu/dist/toolchain/gdb/config/arm/arm.mt
--- a/gnu/dist/toolchain/gdb/config/arm/arm.mt Sun Jul 15 06:38:07 2001 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-# OBSOLETE # Target: Acorn RISC machine (ARM) with simulator
-# OBSOLETE TDEPFILES= arm-tdep.o remote-rdp.o remote-rdi.oT
-# OBSOLETE DEPLIBS= rdi-share/libangsd.a
-# OBSOLETE TM_FILE= tm-arm.h
-# OBSOLETE
-# OBSOLETE SIM_OBS = remote-sim.o
-# OBSOLETE SIM = ../sim/arm/libsim.a
diff -r 4699780c66f1 -r 726b423375db gnu/dist/toolchain/gdb/config/arm/nbsd.mh
--- a/gnu/dist/toolchain/gdb/config/arm/nbsd.mh Sun Jul 15 06:38:07 2001 +0000
+++ b/gnu/dist/toolchain/gdb/config/arm/nbsd.mh Sun Jul 15 07:43:12 2001 +0000
@@ -1,5 +1,5 @@
# Host: ARM running NetBSD
XDEPFILES=
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o armb-nat.o arm-convert.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o armnbsd-nat.o arm-convert.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
diff -r 4699780c66f1 -r 726b423375db gnu/dist/toolchain/gdb/config/arm/tm-nbsd.h
--- a/gnu/dist/toolchain/gdb/config/arm/tm-nbsd.h Sun Jul 15 06:38:07 2001 +0000
+++ b/gnu/dist/toolchain/gdb/config/arm/tm-nbsd.h Sun Jul 15 07:43:12 2001 +0000
@@ -23,6 +23,9 @@
#include "arm/tm-arm.h"
#include "tm-nbsd.h"
#include <machine/setjmp.h> /* for JMPBUF_REG_R14 definition */
+#ifndef _JB_REG_R14
+#define _JB_REG_R14 24
+#endif
/* On NetBSD, sigtramp is above the user stack and immediately below
the user area. Using constants here allows for cross debugging. */
Home |
Main Index |
Thread Index |
Old Index