1 /* Native-dependent code for SuperH running NetBSD, for GDB.
3 Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
4 Contributed by Wasabi Systems, Inc.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 #include <sys/types.h>
24 #include <sys/ptrace.h>
25 #include <machine/reg.h>
31 #include "shnbsd-tdep.h"
33 /* Determine if PT_GETREGS fetches this register. */
34 #define GETREGS_SUPPLIES(regno) \
35 (((regno) >= R0_REGNUM && (regno) <= (R0_REGNUM + 15)) \
36 || (regno) == PC_REGNUM || (regno) == PR_REGNUM \
37 || (regno) == MACH_REGNUM || (regno) == MACL_REGNUM \
38 || (regno) == SR_REGNUM)
41 fetch_inferior_registers (int regno
)
43 if (regno
== -1 || GETREGS_SUPPLIES (regno
))
45 struct reg inferior_registers
;
47 if (ptrace (PT_GETREGS
, PIDGET (inferior_ptid
),
48 (PTRACE_TYPE_ARG3
) &inferior_registers
, 0) == -1)
49 perror_with_name (_("Couldn't get registers"));
51 shnbsd_supply_reg ((char *) &inferior_registers
, regno
);
59 store_inferior_registers (int regno
)
61 if (regno
== -1 || GETREGS_SUPPLIES (regno
))
63 struct reg inferior_registers
;
65 if (ptrace (PT_GETREGS
, PIDGET (inferior_ptid
),
66 (PTRACE_TYPE_ARG3
) &inferior_registers
, 0) == -1)
67 perror_with_name (_("Couldn't get registers"));
69 shnbsd_fill_reg ((char *) &inferior_registers
, regno
);
71 if (ptrace (PT_SETREGS
, PIDGET (inferior_ptid
),
72 (PTRACE_TYPE_ARG3
) &inferior_registers
, 0) == -1)
73 perror_with_name (_("Couldn't set registers"));
This page took 0.034396 seconds and 4 git commands to generate.