248f8026d992b5be9251a77479dfc38aa614f092
1 /* Machine independent GDB support for core files on systems using "regsets".
2 Copyright 1993-1998 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
24 This file is used by most systems that implement /proc. For these systems,
25 the general registers are laid out the same way in both the core file and
26 the gregset_p structure. The current exception to this is Irix-4.*, where
27 the gregset_p structure is split up into two pieces in the core file.
29 The general register and floating point register sets are manipulated by
30 separate ioctl's. This file makes the assumption that if FP0_REGNUM is
31 defined, then support for the floating point register set is desired,
32 regardless of whether or not the actual target has floating point hardware.
39 #ifdef HAVE_SYS_PROCFS_H
40 #include <sys/procfs.h>
44 #include "gdb_string.h"
51 /* Prototypes for supply_gregset etc. */
54 static void fetch_core_registers
PARAMS ((char *, unsigned, int, CORE_ADDR
));
56 void _initialize_core_regset
PARAMS ((void));
62 fetch_core_registers -- fetch current registers from core file
66 void fetch_core_registers (char *core_reg_sect,
67 unsigned core_reg_size,
68 int which, CORE_ADDR reg_addr)
72 Read the values of either the general register set (WHICH equals 0)
73 or the floating point register set (WHICH equals 2) from the core
74 file data (pointed to by CORE_REG_SECT), and update gdb's idea of
75 their current values. The CORE_REG_SIZE parameter is ignored.
79 Use the indicated sizes to validate the gregset and fpregset
84 fetch_core_registers (core_reg_sect
, core_reg_size
, which
, reg_addr
)
86 unsigned core_reg_size
;
88 CORE_ADDR reg_addr
; /* Unused in this version */
90 #if defined (HAVE_GREGSET_T) && defined (HAVE_FPREGSET_T)
96 if (core_reg_size
!= sizeof (gregset
))
98 warning ("wrong size gregset struct in core file");
102 memcpy ((char *) &gregset
, core_reg_sect
, sizeof (gregset
));
103 supply_gregset (&gregset
);
108 if (core_reg_size
!= sizeof (fpregset
))
110 warning ("wrong size fpregset struct in core file");
114 memcpy ((char *) &fpregset
, core_reg_sect
, sizeof (fpregset
));
116 supply_fpregset (&fpregset
);
119 #endif /* defined(HAVE_GREGSET_T) && defined (HAVE_FPREGSET_T) */
123 /* Register that we are able to handle ELF file formats using standard
124 procfs "regset" structures. */
126 static struct core_fns regset_core_fns
=
128 bfd_target_elf_flavour
, /* core_flavour */
129 default_check_format
, /* check_format */
130 default_core_sniffer
, /* core_sniffer */
131 fetch_core_registers
, /* core_read_registers */
136 _initialize_core_regset ()
138 add_core_fns (®set_core_fns
);