1 /* Machine independent GDB support for core files on systems using "regsets".
2 Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000
3 Free Software Foundation, 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. */
25 This file is used by most systems that implement /proc. For these systems,
26 the general registers are laid out the same way in both the core file and
27 the gregset_p structure. The current exception to this is Irix-4.*, where
28 the gregset_p structure is split up into two pieces in the core file.
30 The general register and floating point register sets are manipulated by
31 separate ioctl's. This file makes the assumption that if FP0_REGNUM is
32 defined, then support for the floating point register set is desired,
33 regardless of whether or not the actual target has floating point hardware.
40 #ifdef HAVE_SYS_PROCFS_H
41 #include <sys/procfs.h>
45 #include "gdb_string.h"
52 /* Prototypes for supply_gregset etc. */
55 static void fetch_core_registers (char *, unsigned, int, CORE_ADDR
);
57 void _initialize_core_regset (void);
63 fetch_core_registers -- fetch current registers from core file
67 void fetch_core_registers (char *core_reg_sect,
68 unsigned core_reg_size,
69 int which, CORE_ADDR reg_addr)
73 Read the values of either the general register set (WHICH equals 0)
74 or the floating point register set (WHICH equals 2) from the core
75 file data (pointed to by CORE_REG_SECT), and update gdb's idea of
76 their current values. The CORE_REG_SIZE parameter is compared to
77 the size of the gregset or fpgregset structures (as appropriate) to
78 validate the size of the structure from the core file. The
79 REG_ADDR parameter is ignored.
84 fetch_core_registers (char *core_reg_sect
, unsigned core_reg_size
, int which
,
87 gdb_gregset_t gregset
;
88 gdb_fpregset_t fpregset
;
92 if (core_reg_size
!= sizeof (gregset
))
94 warning ("wrong size gregset struct in core file");
98 memcpy ((char *) &gregset
, core_reg_sect
, sizeof (gregset
));
99 supply_gregset (&gregset
);
104 if (core_reg_size
!= sizeof (fpregset
))
106 warning ("wrong size fpregset struct in core file");
110 memcpy ((char *) &fpregset
, core_reg_sect
, sizeof (fpregset
));
112 supply_fpregset (&fpregset
);
118 /* Register that we are able to handle ELF file formats using standard
119 procfs "regset" structures. */
121 static struct core_fns regset_core_fns
=
123 bfd_target_elf_flavour
, /* core_flavour */
124 default_check_format
, /* check_format */
125 default_core_sniffer
, /* core_sniffer */
126 fetch_core_registers
, /* core_read_registers */
131 _initialize_core_regset (void)
133 add_core_fns (®set_core_fns
);
This page took 0.031298 seconds and 4 git commands to generate.