summaryrefslogtreecommitdiff
path: root/gdb/alphanbsd-tdep.c
diff options
context:
space:
mode:
authorJason Thorpe <thorpej@netbsd.org>2002-05-11 16:56:16 +0000
committerJason Thorpe <thorpej@netbsd.org>2002-05-11 16:56:16 +0000
commit84f9c91532b7185ce3885ae46f082dedc23303b2 (patch)
treeb779aacb7de6f79aab7b6f5d9cb1d6f8c5d98a06 /gdb/alphanbsd-tdep.c
parent4dace1d04af5f8356edad4187ca0da620476a534 (diff)
downloadgdb-84f9c91532b7185ce3885ae46f082dedc23303b2.tar.gz
* Makefile.in (ALLDEPFILES): Remove alphanbsd-nat.c.
(alphanbsd-nat.o): Remove dependency list. (alphanbsd-tdep.o): Add $(regcache_h) to dependency list. * alphanbsd-nat.c: Delete. Contents moved to... * alphanbsd-tdep.c: ...here. (_initialize_alphanbsd_tdep): Register core functions. * config/alpha/nbsd.mh (NATDEPFILES): Remove alphanbsd-nat.o.
Diffstat (limited to 'gdb/alphanbsd-tdep.c')
-rw-r--r--gdb/alphanbsd-tdep.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c
index 33c3cd7f0a6..65641ec9759 100644
--- a/gdb/alphanbsd-tdep.c
+++ b/gdb/alphanbsd-tdep.c
@@ -21,10 +21,101 @@
#include "defs.h"
#include "gdbcore.h"
+#include "regcache.h"
#include "value.h"
#include "solib-svr4.h"
#include "alpha-tdep.h"
+#include "alphabsd-tdep.h"
+
+static void
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+ CORE_ADDR ignore)
+{
+ char *regs, *fpregs;
+ int regno;
+
+ /* Table to map a gdb register number to a trapframe register index. */
+ static const int regmap[] =
+ {
+ 0, 1, 2, 3,
+ 4, 5, 6, 7,
+ 8, 9, 10, 11,
+ 12, 13, 14, 15,
+ 30, 31, 32, 16,
+ 17, 18, 19, 20,
+ 21, 22, 23, 24,
+ 25, 29, 26
+ };
+#define SIZEOF_TRAPFRAME (33 * 8)
+
+ /* We get everything from one section. */
+ if (which != 0)
+ return;
+
+ regs = core_reg_sect;
+ fpregs = core_reg_sect + SIZEOF_TRAPFRAME;
+
+ if (core_reg_size < (SIZEOF_TRAPFRAME + SIZEOF_STRUCT_FPREG))
+ {
+ warning ("Wrong size register set in core file.");
+ return;
+ }
+
+ /* Integer registers. */
+ for (regno = 0; regno < ALPHA_ZERO_REGNUM; regno++)
+ supply_register (regno, regs + (regmap[regno] * 8));
+ supply_register (ALPHA_ZERO_REGNUM, NULL);
+ supply_register (FP_REGNUM, NULL);
+ supply_register (PC_REGNUM, regs + (28 * 8));
+
+ /* Floating point registers. */
+ alphabsd_supply_fpreg (fpregs, -1);
+}
+
+static void
+fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+ CORE_ADDR ignore)
+{
+ switch (which)
+ {
+ case 0: /* Integer registers. */
+ if (core_reg_size != SIZEOF_STRUCT_REG)
+ warning ("Wrong size register set in core file.");
+ else
+ alphabsd_supply_reg (core_reg_sect, -1);
+ break;
+
+ case 2: /* Floating point registers. */
+ if (core_reg_size != SIZEOF_STRUCT_FPREG)
+ warning ("Wrong size FP register set in core file.");
+ else
+ alphabsd_supply_fpreg (core_reg_sect, -1);
+ break;
+
+ default:
+ /* Don't know what kind of register request this is; just ignore it. */
+ break;
+ }
+}
+
+static struct core_fns alphanbsd_core_fns =
+{
+ bfd_target_unknown_flavour, /* core_flavour */
+ default_check_format, /* check_format */
+ default_core_sniffer, /* core_sniffer */
+ fetch_core_registers, /* core_read_registers */
+ NULL /* next */
+};
+
+static struct core_fns alphanbsd_elfcore_fns =
+{
+ bfd_target_elf_flavour, /* core_flavour */
+ default_check_format, /* check_format */
+ default_core_sniffer, /* core_sniffer */
+ fetch_elfcore_registers, /* core_read_registers */
+ NULL /* next */
+};
/* Fetch (and possibly build) an appropriate link_map_offsets
structure for NetBSD/alpha targets using the struct offsets
@@ -154,4 +245,7 @@ void
_initialize_alphanbsd_tdep (void)
{
alpha_gdbarch_register_os_abi (ALPHA_ABI_NETBSD, alphanbsd_init_abi);
+
+ add_core_fns (&alphanbsd_core_fns);
+ add_core_fns (&alphanbsd_elfcore_fns);
}