1 /* Native-dependent code for Alpha NetBSD.
2 Copyright 2002 Free Software Foundation, Inc.
3 Contributed by Wasabi Systems, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
23 #include <sys/types.h>
24 #include <machine/reg.h>
25 #include <machine/frame.h>
26 #include <machine/pcb.h>
30 #include "alpha-tdep.h"
31 #include "alphabsd-tdep.h"
34 fetch_core_registers (char *core_reg_sect
, unsigned core_reg_size
, int which
,
37 struct md_coredump
*core_reg
;
41 /* Table to map a gdb register number to a trapframe register index. */
42 static const int regmap
[] =
44 FRAME_V0
, FRAME_T0
, FRAME_T1
, FRAME_T2
,
45 FRAME_T3
, FRAME_T4
, FRAME_T5
, FRAME_T6
,
46 FRAME_T7
, FRAME_S0
, FRAME_S1
, FRAME_S2
,
47 FRAME_S3
, FRAME_S4
, FRAME_S5
, FRAME_S6
,
48 FRAME_A0
, FRAME_A1
, FRAME_A2
, FRAME_A3
,
49 FRAME_A4
, FRAME_A5
, FRAME_T8
, FRAME_T9
,
50 FRAME_T10
, FRAME_T11
, FRAME_RA
, FRAME_T12
,
51 FRAME_AT
, FRAME_GP
, FRAME_SP
54 /* We get everything from one section. */
58 core_reg
= (struct md_coredump
*) core_reg_sect
;
59 regs
= (char *) &core_reg
->md_tf
;
61 if (core_reg_size
< sizeof (*core_reg
))
63 warning ("Wrong size register set in core file.");
67 /* Integer registers. */
68 for (regno
= 0; regno
< ALPHA_ZERO_REGNUM
; regno
++)
69 supply_register (regno
, regs
+ (regmap
[regno
] * 8));
70 supply_register (ALPHA_ZERO_REGNUM
, NULL
);
71 supply_register (FP_REGNUM
, NULL
);
72 supply_register (PC_REGNUM
, regs
+ (FRAME_PC
* 8));
74 /* Floating point registers. */
75 alphabsd_supply_fpreg ((char *) &core_reg
->md_fpstate
, -1);
79 fetch_elfcore_registers (char *core_reg_sect
, unsigned core_reg_size
, int which
,
84 case 0: /* Integer registers. */
85 if (core_reg_size
!= SIZEOF_STRUCT_REG
)
86 warning ("Wrong size register set in core file.");
88 alphabsd_supply_reg (core_reg_sect
, -1);
91 case 2: /* Floating point registers. */
92 if (core_reg_size
!= SIZEOF_STRUCT_FPREG
)
93 warning ("Wrong size FP register set in core file.");
95 alphabsd_supply_fpreg (core_reg_sect
, -1);
99 /* Don't know what kind of register request this is; just ignore it. */
104 static struct core_fns alphanbsd_core_fns
=
106 bfd_target_unknown_flavour
, /* core_flavour */
107 default_check_format
, /* check_format */
108 default_core_sniffer
, /* core_sniffer */
109 fetch_core_registers
, /* core_read_registers */
113 static struct core_fns alphanbsd_elfcore_fns
=
115 bfd_target_elf_flavour
, /* core_flavour */
116 default_check_format
, /* check_format */
117 default_core_sniffer
, /* core_sniffer */
118 fetch_elfcore_registers
, /* core_read_registers */
123 _initialize_alphanbsd_nat (void)
125 add_core_fns (&alphanbsd_core_fns
);
126 add_core_fns (&alphanbsd_elfcore_fns
);