From 3e56fc4b479c7ec6ceae3ec904d0c833565abbd4 Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Thu, 21 Feb 2002 11:15:41 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 10 ++++++++ gdb/armnbsd-nat.c | 61 ++++++++++++++++++++++++++++++++++++----------- 2 files changed, 57 insertions(+), 14 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 551ccbdfd4f..673aaf9293c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2002-02-21 Richard Earnshaw + + * 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. + 2002-02-21 Christopher Faylor * win32-nat.c (register_loaded_dll): Correctly check for invalid handle diff --git a/gdb/armnbsd-nat.c b/gdb/armnbsd-nat.c index 8a191673c1b..0e0407ce1f4 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 #include #include #include #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 (®isters[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); +} -- 2.30.2