aboutsummaryrefslogtreecommitdiff
path: root/gdb/armnbsd-nat.c
diff options
context:
space:
mode:
authorRichard Earnshaw <richard.earnshaw@arm.com>2002-02-21 11:15:41 +0000
committerRichard Earnshaw <richard.earnshaw@arm.com>2002-02-21 11:15:41 +0000
commit3e56fc4b479c7ec6ceae3ec904d0c833565abbd4 (patch)
tree975323a17604b7f156416a702c80c1e90120014e /gdb/armnbsd-nat.c
parent097f6b0bbaff5af8a376eba6a115819f885318ed (diff)
downloadgdb-3e56fc4b479c7ec6ceae3ec904d0c833565abbd4.zip
gdb-3e56fc4b479c7ec6ceae3ec904d0c833565abbd4.tar.gz
gdb-3e56fc4b479c7ec6ceae3ec904d0c833565abbd4.tar.bz2
* armnbsd-nat.c: Include gdbcore.h.
(FETCH_INFERIOR_REGISTERS): Just error if this isn't defined. (fetch_regs, fetch_fp_regs, store_regs, store_fp_regs): Add explicit 'void' to declaration, to shut up ARI. (fetch_core_registers): Make static. Rewrite using supply_register. (arm_netbsd_core_fns): New core-file type specification. (_initialize_arm_netbsd_nat): New function.
Diffstat (limited to 'gdb/armnbsd-nat.c')
-rw-r--r--gdb/armnbsd-nat.c61
1 files changed, 47 insertions, 14 deletions
diff --git a/gdb/armnbsd-nat.c b/gdb/armnbsd-nat.c
index 8a19167..0e0407c 100644
--- a/gdb/armnbsd-nat.c
+++ b/gdb/armnbsd-nat.c
@@ -21,15 +21,19 @@
#include "defs.h"
+#ifndef FETCH_INFERIOR_REGISTERS
+#error Not FETCH_INFERIOR_REGISTERS
+#endif /* !FETCH_INFERIOR_REGISTERS */
+
#include "arm-tdep.h"
-#ifdef FETCH_INFERIOR_REGISTERS
#include <sys/types.h>
#include <sys/ptrace.h>
#include <machine/reg.h>
#include <machine/frame.h>
#include "inferior.h"
#include "regcache.h"
+#include "gdbcore.h"
extern int arm_apcs_32;
@@ -78,7 +82,7 @@ fetch_register (int regno)
}
static void
-fetch_regs ()
+fetch_regs (void)
{
struct reg inferior_registers;
int ret;
@@ -138,7 +142,7 @@ fetch_fp_register (int regno)
}
static void
-fetch_fp_regs ()
+fetch_fp_regs (void)
{
struct fpreg inferior_fp_registers;
int ret;
@@ -247,7 +251,7 @@ store_register (int regno)
}
static void
-store_regs ()
+store_regs (void)
{
struct reg inferior_registers;
int ret;
@@ -322,7 +326,7 @@ store_fp_register (int regno)
}
static void
-store_fp_regs ()
+store_fp_regs (void)
{
struct fpreg inferior_fp_registers;
int ret;
@@ -365,19 +369,48 @@ struct md_core
struct fpreg freg;
};
-void
+static void
fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
int which, CORE_ADDR ignore)
{
struct md_core *core_reg = (struct md_core *) core_reg_sect;
+ int regno;
+ CORE_ADDR r_pc;
+
+ /* Integer registers. */
+ for (regno = ARM_A1_REGNUM; regno < ARM_SP_REGNUM; regno++)
+ supply_register (regno, (char *) &core_reg->intreg.r[regno]);
+
+ supply_register (ARM_SP_REGNUM, (char *) &core_reg->intreg.r_sp);
+ supply_register (ARM_LR_REGNUM, (char *) &core_reg->intreg.r_lr);
+ /* This is ok: we're running native... */
+ r_pc = ADDR_BITS_REMOVE (core_reg->intreg.r_pc);
+ supply_register (ARM_PC_REGNUM, (char *) &r_pc);
+
+ if (arm_apcs_32)
+ supply_register (ARM_PS_REGNUM, (char *) &core_reg->intreg.r_cpsr);
+ else
+ supply_register (ARM_PS_REGNUM, (char *) &core_reg->intreg.r_pc);
- /* integer registers */
- memcpy (&registers[REGISTER_BYTE (0)], &core_reg->intreg,
- sizeof (struct reg));
- /* floating point registers */
- /* XXX */
+ /* Floating-point registers. */
+ for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
+ supply_register
+ (regno, (char *) &core_reg->freg.fpr[regno - ARM_F0_REGNUM]);
+
+ supply_register (ARM_FPS_REGNUM, (char *) &core_reg->freg.fpr_fpsr);
}
-#else
-#error Not FETCH_INFERIOR_REGISTERS
-#endif /* !FETCH_INFERIOR_REGISTERS */
+static struct core_fns arm_netbsd_core_fns =
+{
+ bfd_target_unknown_flavour, /* core_flovour. */
+ default_check_format, /* check_format. */
+ default_core_sniffer, /* core_sniffer. */
+ fetch_core_registers, /* core_read_registers. */
+ NULL
+};
+
+void
+_initialize_arm_netbsd_nat (void)
+{
+ add_core_fns (&arm_netbsd_core_fns);
+}