Mon Jan 23 06:17:59 2012 UTC ()
Provide {supply,fill}_{g,fp}regset


(skrll)
diff -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/i386nbsd-nat.c

cvs diff -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/Attic/i386nbsd-nat.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/Attic/i386nbsd-nat.c 2011/09/25 16:30:24 1.2
+++ src/external/gpl3/gdb/dist/gdb/Attic/i386nbsd-nat.c 2012/01/23 06:17:58 1.3
@@ -14,37 +14,49 @@ @@ -14,37 +14,49 @@
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 20
21#include "defs.h" 21#include "defs.h"
22#include "gdbcore.h" 22#include "gdbcore.h"
23#include "regcache.h" 23#include "regcache.h"
24#include "target.h" 24#include "target.h"
25 25
26#include "i386-tdep.h" 26#include "i386-tdep.h"
 27#include "i387-tdep.h"
27#include "i386bsd-nat.h" 28#include "i386bsd-nat.h"
28 29
29/* Support for debugging kernel virtual memory images. */ 30/* Support for debugging kernel virtual memory images. */
30 31
31#include <sys/types.h> 32#include <sys/types.h>
 33#include <machine/reg.h>
32#include <machine/frame.h> 34#include <machine/frame.h>
33#include <machine/pcb.h> 35#include <machine/pcb.h>
34 36
35#include "nbsd-nat.h" 37#include "nbsd-nat.h"
36#include "bsd-kvm.h" 38#include "bsd-kvm.h"
37 39
 40#ifndef HAVE_GREGSET_T
 41typedef struct reg gregset_t;
 42#endif
 43
 44#ifndef HAVE_FPREGSET_T
 45typedef struct fpreg fpregset_t;
 46#endif
 47
 48#include "gregset.h"
 49
38static int 50static int
39i386nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) 51i386nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
40{ 52{
41 struct switchframe sf; 53 struct switchframe sf;
42 54
43 /* The following is true for NetBSD 1.6.2 and after: 55 /* The following is true for NetBSD 1.6.2 and after:
44 56
45 The pcb contains %esp and %ebp at the point of the context switch 57 The pcb contains %esp and %ebp at the point of the context switch
46 in cpu_switch()/cpu_switchto(). At that point we have a stack frame as 58 in cpu_switch()/cpu_switchto(). At that point we have a stack frame as
47 described by `struct switchframe', which for NetBSD (2.0 and later) has 59 described by `struct switchframe', which for NetBSD (2.0 and later) has
48 the following layout: 60 the following layout:
49 61
50 %edi 62 %edi
@@ -87,26 +99,65 @@ i386nbsd_supply_pcb (struct regcache *re @@ -87,26 +99,65 @@ i386nbsd_supply_pcb (struct regcache *re
87 dumpsys(). Use the frame pointer to recover enough state. */ 99 dumpsys(). Use the frame pointer to recover enough state. */
88 100
89 read_memory (pcb->pcb_ebp, (gdb_byte *) &fp, sizeof(fp)); 101 read_memory (pcb->pcb_ebp, (gdb_byte *) &fp, sizeof(fp));
90 read_memory (pcb->pcb_ebp + 4, (gdb_byte *) &pc, sizeof(pc)); 102 read_memory (pcb->pcb_ebp + 4, (gdb_byte *) &pc, sizeof(pc));
91 103
92 regcache_raw_supply (regcache, I386_ESP_REGNUM, &pcb->pcb_ebp); 104 regcache_raw_supply (regcache, I386_ESP_REGNUM, &pcb->pcb_ebp);
93 regcache_raw_supply (regcache, I386_EBP_REGNUM, &fp); 105 regcache_raw_supply (regcache, I386_EBP_REGNUM, &fp);
94 regcache_raw_supply (regcache, I386_EIP_REGNUM, &pc); 106 regcache_raw_supply (regcache, I386_EIP_REGNUM, &pc);
95 } 107 }
96 108
97 return 1; 109 return 1;
98} 110}
99  111
 112void
 113supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
 114{
 115 i386bsd_supply_gregset (regcache, gregsetp);
 116}
 117
 118/* Fill register REGNUM (if it is a general-purpose register) in
 119 *GREGSETP with the value in GDB's register cache. If REGNUM is -1,
 120 do this for all registers. */
 121
 122void
 123fill_gregset (const struct regcache *regcache,
 124 gregset_t *gregsetp, int regnum)
 125{
 126 i386bsd_collect_gregset (regcache, gregsetp, regnum);
 127}
 128
 129/* Transfering floating-point registers between GDB, inferiors and cores. */
 130
 131/* Fill GDB's register cache with the floating-point and SSE register
 132 values in *FPREGSETP. */
 133
 134void
 135supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
 136{
 137 i387_supply_fsave (regcache, -1, fpregsetp);
 138}
 139
 140/* Fill register REGNUM (if it is a floating-point or SSE register) in
 141 *FPREGSETP with the value in GDB's register cache. If REGNUM is
 142 -1, do this for all registers. */
 143
 144void
 145fill_fpregset (const struct regcache *regcache,
 146 fpregset_t *fpregsetp, int regnum)
 147{
 148 i387_collect_fsave (regcache, regnum, fpregsetp);
 149}
 150
100 151
101/* Provide a prototype to silence -Wmissing-prototypes. */ 152/* Provide a prototype to silence -Wmissing-prototypes. */
102void _initialize_i386nbsd_nat (void); 153void _initialize_i386nbsd_nat (void);
103 154
104void 155void
105_initialize_i386nbsd_nat (void) 156_initialize_i386nbsd_nat (void)
106{ 157{
107 struct target_ops *t; 158 struct target_ops *t;
108 159
109 /* Add some extra features to the common *BSD/i386 target. */ 160 /* Add some extra features to the common *BSD/i386 target. */
110 t = i386bsd_target (); 161 t = i386bsd_target ();
111 t->to_pid_to_exec_file = nbsd_pid_to_exec_file; 162 t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
112 add_target (t); 163 add_target (t);