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"
32 #ifndef HAVE_GREGSET_T
33 typedef struct reg gregset_t
;
36 #ifndef HAVE_FPREGSET_T
37 typedef struct fpreg fpregset_t
;
43 fetch_core_registers (char *core_reg_sect
, unsigned core_reg_size
, int which
,
46 struct md_coredump
*core_reg
;
50 /* Table to map a gdb register number to a trapframe register index. */
51 static const int regmap
[] =
53 FRAME_V0
, FRAME_T0
, FRAME_T1
, FRAME_T2
,
54 FRAME_T3
, FRAME_T4
, FRAME_T5
, FRAME_T6
,
55 FRAME_T7
, FRAME_S0
, FRAME_S1
, FRAME_S2
,
56 FRAME_S3
, FRAME_S4
, FRAME_S5
, FRAME_S6
,
57 FRAME_A0
, FRAME_A1
, FRAME_A2
, FRAME_A3
,
58 FRAME_A4
, FRAME_A5
, FRAME_T8
, FRAME_T9
,
59 FRAME_T10
, FRAME_T11
, FRAME_RA
, FRAME_T12
,
60 FRAME_AT
, FRAME_GP
, FRAME_SP
63 /* We get everything from one section. */
67 core_reg
= (struct md_coredump
*) core_reg_sect
;
68 regs
= (char *) &core_reg
->md_tf
;
70 if (core_reg_size
< sizeof (*core_reg
))
72 warning ("Wrong size register set in core file.");
76 /* Integer registers. */
77 for (regno
= 0; regno
< ALPHA_ZERO_REGNUM
; regno
++)
78 supply_register (regno
, regs
+ (regmap
[regno
] * 8));
79 supply_register (ALPHA_ZERO_REGNUM
, NULL
);
80 supply_register (FP_REGNUM
, NULL
);
81 supply_register (PC_REGNUM
, regs
+ (FRAME_PC
* 8));
83 /* Floating point registers. */
84 supply_fpregset (&core_reg
->md_fpstate
);
88 fetch_elfcore_registers (char *core_reg_sect
, unsigned core_reg_size
, int which
,
93 case 0: /* Integer registers. */
94 if (core_reg_size
!= sizeof (struct reg
))
95 warning ("Wrong size register set in core file.");
97 supply_gregset ((gregset_t
*) core_reg_sect
);
100 case 2: /* Floating point registers. */
101 if (core_reg_size
!= sizeof (struct fpreg
))
102 warning ("Wrong size FP register set in core file.");
104 supply_fpregset ((fpregset_t
*) core_reg_sect
);
108 /* Don't know what kind of register request this is; just ignore it. */
113 static struct core_fns alphanbsd_core_fns
=
115 bfd_target_unknown_flavour
, /* core_flavour */
116 default_check_format
, /* check_format */
117 default_core_sniffer
, /* core_sniffer */
118 fetch_core_registers
, /* core_read_registers */
122 static struct core_fns alphanbsd_elfcore_fns
=
124 bfd_target_elf_flavour
, /* core_flavour */
125 default_check_format
, /* check_format */
126 default_core_sniffer
, /* core_sniffer */
127 fetch_elfcore_registers
, /* core_read_registers */
132 _initialize_alphanbsd_nat (void)
134 add_core_fns (&alphanbsd_core_fns
);
135 add_core_fns (&alphanbsd_elfcore_fns
);