OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [core-regset.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
/* 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.
4
 
5
   This file is part of GDB.
6
 
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.
11
 
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.
16
 
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.  */
21
 
22
 
23
/*                      N  O  T  E  S
24
 
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.
29
 
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.
34
 
35
 */
36
 
37
#include "defs.h"
38
 
39
#include <time.h>
40
#ifdef HAVE_SYS_PROCFS_H
41
#include <sys/procfs.h>
42
#endif
43
#include <fcntl.h>
44
#include <errno.h>
45
#include "gdb_string.h"
46
 
47
#include "inferior.h"
48
#include "target.h"
49
#include "command.h"
50
#include "gdbcore.h"
51
 
52
/* Prototypes for supply_gregset etc. */
53
#include "gregset.h"
54
 
55
static void fetch_core_registers (char *, unsigned, int, CORE_ADDR);
56
 
57
void _initialize_core_regset (void);
58
 
59
/*
60
 
61
   GLOBAL FUNCTION
62
 
63
   fetch_core_registers -- fetch current registers from core file
64
 
65
   SYNOPSIS
66
 
67
   void fetch_core_registers (char *core_reg_sect,
68
   unsigned core_reg_size,
69
   int which, CORE_ADDR reg_addr)
70
 
71
   DESCRIPTION
72
 
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.
80
 
81
 */
82
 
83
static void
84
fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
85
                      CORE_ADDR reg_addr)
86
{
87
  gdb_gregset_t gregset;
88
  gdb_fpregset_t fpregset;
89
 
90
  if (which == 0)
91
    {
92
      if (core_reg_size != sizeof (gregset))
93
        {
94
          warning ("wrong size gregset struct in core file");
95
        }
96
      else
97
        {
98
          memcpy ((char *) &gregset, core_reg_sect, sizeof (gregset));
99
          supply_gregset (&gregset);
100
        }
101
    }
102
  else if (which == 2)
103
    {
104
      if (core_reg_size != sizeof (fpregset))
105
        {
106
          warning ("wrong size fpregset struct in core file");
107
        }
108
      else
109
        {
110
          memcpy ((char *) &fpregset, core_reg_sect, sizeof (fpregset));
111
          if (FP0_REGNUM >= 0)
112
            supply_fpregset (&fpregset);
113
        }
114
    }
115
}
116
 
117
 
118
/* Register that we are able to handle ELF file formats using standard
119
   procfs "regset" structures.  */
120
 
121
static struct core_fns regset_core_fns =
122
{
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 */
127
  NULL                                  /* next */
128
};
129
 
130
void
131
_initialize_core_regset (void)
132
{
133
  add_core_fns (&regset_core_fns);
134
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.