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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [core-regset.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 104 markom
/* Machine independent GDB support for core files on systems using "regsets".
2
   Copyright 1993-1998 Free Software Foundation, Inc.
3
 
4
   This file is part of GDB.
5
 
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.
10
 
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.
15
 
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.  */
20
 
21
 
22
/*                      N  O  T  E  S
23
 
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.
28
 
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.
33
 
34
 */
35
 
36
#include "defs.h"
37
 
38
#include <time.h>
39
#ifdef HAVE_SYS_PROCFS_H
40
#include <sys/procfs.h>
41
#endif
42
#include <fcntl.h>
43
#include <errno.h>
44
#include "gdb_string.h"
45
 
46
#include "inferior.h"
47
#include "target.h"
48
#include "command.h"
49
#include "gdbcore.h"
50
 
51
static void fetch_core_registers PARAMS ((char *, unsigned, int, CORE_ADDR));
52
 
53
void _initialize_core_regset PARAMS ((void));
54
 
55
/*
56
 
57
   GLOBAL FUNCTION
58
 
59
   fetch_core_registers -- fetch current registers from core file
60
 
61
   SYNOPSIS
62
 
63
   void fetch_core_registers (char *core_reg_sect,
64
   unsigned core_reg_size,
65
   int which, CORE_ADDR reg_addr)
66
 
67
   DESCRIPTION
68
 
69
   Read the values of either the general register set (WHICH equals 0)
70
   or the floating point register set (WHICH equals 2) from the core
71
   file data (pointed to by CORE_REG_SECT), and update gdb's idea of
72
   their current values.  The CORE_REG_SIZE parameter is ignored.
73
 
74
   NOTES
75
 
76
   Use the indicated sizes to validate the gregset and fpregset
77
   structures.
78
 */
79
 
80
static void
81
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
82
     char *core_reg_sect;
83
     unsigned core_reg_size;
84
     int which;
85
     CORE_ADDR reg_addr;        /* Unused in this version */
86
{
87
#if defined (HAVE_GREGSET_T) && defined (HAVE_FPREGSET_T)
88
  gregset_t gregset;
89
  fpregset_t fpregset;
90
 
91
  if (which == 0)
92
    {
93
      if (core_reg_size != sizeof (gregset))
94
        {
95
          warning ("wrong size gregset struct in core file");
96
        }
97
      else
98
        {
99
          memcpy ((char *) &gregset, core_reg_sect, sizeof (gregset));
100
          supply_gregset (&gregset);
101
        }
102
    }
103
  else if (which == 2)
104
    {
105
      if (core_reg_size != sizeof (fpregset))
106
        {
107
          warning ("wrong size fpregset struct in core file");
108
        }
109
      else
110
        {
111
          memcpy ((char *) &fpregset, core_reg_sect, sizeof (fpregset));
112
#if defined (FP0_REGNUM)
113
          supply_fpregset (&fpregset);
114
#endif
115
        }
116
    }
117
#endif /* defined(HAVE_GREGSET_T) && defined (HAVE_FPREGSET_T) */
118
}
119
 
120
 
121
/* Register that we are able to handle ELF file formats using standard
122
   procfs "regset" structures.  */
123
 
124
static struct core_fns regset_core_fns =
125
{
126
  bfd_target_elf_flavour,               /* core_flavour */
127
  default_check_format,                 /* check_format */
128
  default_core_sniffer,                 /* core_sniffer */
129
  fetch_core_registers,                 /* core_read_registers */
130
  NULL                                  /* next */
131
};
132
 
133
void
134
_initialize_core_regset ()
135
{
136
  add_core_fns (&regset_core_fns);
137
}

powered by: WebSVN 2.1.0

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