* armnbsd-nat.c (fetch_inferior_registers): Change inferior_pid ->
[external/binutils.git] / gdb / armnbsd-nat.c
1 /* Native-dependent code for BSD Unix running on ARM's, for GDB.
2    Copyright 1988, 1989, 1991, 1992, 1994, 1996, 1999 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 #include "defs.h"
22
23 #ifdef FETCH_INFERIOR_REGISTERS
24 #include <sys/types.h>
25 #include <sys/ptrace.h>
26 #include <machine/reg.h>
27 #include <machine/frame.h>
28 #include "inferior.h"
29
30 void
31 fetch_inferior_registers (regno)
32      int regno;
33 {
34   struct reg inferior_registers;
35   struct fpreg inferior_fpregisters;
36
37   ptrace (PT_GETREGS, PIDGET (inferior_ptid),
38           (PTRACE_ARG3_TYPE) &inferior_registers, 0);
39   memcpy (&registers[REGISTER_BYTE (0)], &inferior_registers,
40           16 * sizeof (unsigned int));
41   memcpy (&registers[REGISTER_BYTE (PS_REGNUM)], &inferior_registers.r_cpsr,
42           sizeof (unsigned int));
43   ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
44           (PTRACE_ARG3_TYPE) &inferior_fpregisters, 0);
45   memcpy (&registers[REGISTER_BYTE (F0_REGNUM)], &inferior_fpregisters.fpr[0],
46           8 * sizeof (fp_reg_t));
47   memcpy (&registers[REGISTER_BYTE (FPS_REGNUM)],
48           &inferior_fpregisters.fpr_fpsr, sizeof (unsigned int));
49   registers_fetched ();
50 }
51
52 void
53 store_inferior_registers (regno)
54      int regno;
55 {
56   struct reg inferior_registers;
57
58   memcpy (&inferior_registers, &registers[REGISTER_BYTE (0)],
59           16 * sizeof (unsigned int));
60   memcpy (&inferior_registers.r_cpsr, &registers[REGISTER_BYTE (PS_REGNUM)],
61           sizeof (unsigned int));
62   ptrace (PT_SETREGS, PIDGET (inferior_ptid),
63           (PTRACE_ARG3_TYPE) &inferior_registers, 0);
64
65   /* XXX Set FP regs. */
66 }
67
68 struct md_core
69 {
70   struct reg intreg;
71   struct fpreg freg;
72 };
73
74 void
75 fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
76      char *core_reg_sect;
77      unsigned core_reg_size;
78      int which;
79      CORE_ADDR ignore;
80 {
81   struct md_core *core_reg = (struct md_core *) core_reg_sect;
82
83   /* integer registers */
84   memcpy (&registers[REGISTER_BYTE (0)], &core_reg->intreg,
85           sizeof (struct reg));
86   /* floating point registers */
87   /* XXX */
88 }
89
90 #else
91 #error Not FETCH_INFERIOR_REGISTERS 
92 #endif /* !FETCH_INFERIOR_REGISTERS */
93
94 int 
95 get_longjmp_target (CORE_ADDR *addr)
96 {
97   return 0;
98 }