Tue Oct 31 10:42:42 1995 steve chamberlain <sac@slash.cygnus.com>
[deliverable/binutils-gdb.git] / gdb / core-svr4.c
CommitLineData
9583b295
SG
1/* Machine independent support for SVR4 core files for GDB.
2 Copyright 1993 Free Software Foundation, Inc.
3
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
6c9638b4 18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
9583b295
SG
19
20
21/* N O T E S
22
23This version of fetch_core_registers() is used by most systems that
24implement /proc. For these systems, the general registers are laid out
25the same way in both the core file and the gregset_p structure. The
26current exception to this is Irix-4.*, where the gregset_p structure is
27split up into two pieces in the core file.
28
29The general register and floating point register sets are manipulated by
30separate ioctl's. This file makes the assumption that if FP0_REGNUM is
31defined, then support for the floating point register set is desired,
32regardless of whether or not the actual target has floating point hardware.
33
34 */
35
36#include "defs.h"
37
38#include <time.h>
39#include <sys/procfs.h>
40#include <fcntl.h>
41#include <errno.h>
2b576293 42#include "gdb_string.h"
9583b295
SG
43
44#include "inferior.h"
45#include "target.h"
46#include "command.h"
47#include "gdbcore.h"
48
49/*
50
51GLOBAL FUNCTION
52
53 fetch_core_registers -- fetch current registers from core file data
54
55SYNOPSIS
56
57 void fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
58 int which, unsigned in reg_addr)
59
60DESCRIPTION
61
62 Read the values of either the general register set (WHICH equals 0)
63 or the floating point register set (WHICH equals 2) from the core
64 file data (pointed to by CORE_REG_SECT), and update gdb's idea of
65 their current values. The CORE_REG_SIZE parameter is ignored.
66
67NOTES
68
69 Use the indicated sizes to validate the gregset and fpregset
70 structures.
71*/
72
73void
74fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
75 char *core_reg_sect;
76 unsigned core_reg_size;
77 int which;
78 unsigned int reg_addr; /* Unused in this version */
79{
80 gregset_t gregset;
81 fpregset_t fpregset;
82
83 if (which == 0)
84 {
85 if (core_reg_size != sizeof (gregset))
86 {
87 warning ("wrong size gregset struct in core file");
88 }
89 else
90 {
91 memcpy ((char *) &gregset, core_reg_sect, sizeof (gregset));
92 supply_gregset (&gregset);
93 }
94 }
95 else if (which == 2)
96 {
97 if (core_reg_size != sizeof (fpregset))
98 {
99 warning ("wrong size fpregset struct in core file");
100 }
101 else
102 {
103 memcpy ((char *) &fpregset, core_reg_sect, sizeof (fpregset));
104#if defined (FP0_REGNUM)
105 supply_fpregset (&fpregset);
106#endif
107 }
108 }
109}
This page took 0.273035 seconds and 4 git commands to generate.