2004-04-22 21:13:06 +00:00
|
|
|
|
/* Native-dependent code for OpenBSD/powerpc.
|
|
|
|
|
|
2006-05-15 21:53:20 +00:00
|
|
|
|
Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
|
2004-04-22 21:13:06 +00:00
|
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-12-17 22:34:03 +00:00
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
|
Boston, MA 02110-1301, USA. */
|
2004-04-22 21:13:06 +00:00
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
2005-06-24 21:11:39 +00:00
|
|
|
|
#include "gdbcore.h"
|
2004-04-22 21:13:06 +00:00
|
|
|
|
#include "inferior.h"
|
|
|
|
|
#include "regcache.h"
|
|
|
|
|
|
2006-05-15 21:53:20 +00:00
|
|
|
|
#include "gdb_assert.h"
|
2004-04-22 21:13:06 +00:00
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/ptrace.h>
|
2005-06-24 21:11:39 +00:00
|
|
|
|
#include <sys/signal.h>
|
|
|
|
|
#include <machine/frame.h>
|
|
|
|
|
#include <machine/pcb.h>
|
2004-04-22 21:13:06 +00:00
|
|
|
|
#include <machine/reg.h>
|
|
|
|
|
|
2004-04-25 14:36:15 +00:00
|
|
|
|
#include "ppc-tdep.h"
|
2004-04-22 21:13:06 +00:00
|
|
|
|
#include "ppcobsd-tdep.h"
|
2005-04-16 22:12:09 +00:00
|
|
|
|
#include "inf-ptrace.h"
|
2005-06-24 21:11:39 +00:00
|
|
|
|
#include "bsd-kvm.h"
|
2004-04-22 21:13:06 +00:00
|
|
|
|
|
2006-05-15 21:53:20 +00:00
|
|
|
|
/* OpenBSD/powerpc didn't have PT_GETFPREGS/PT_SETFPREGS until release
|
|
|
|
|
4.0. On older releases the floating-point registers are handled by
|
|
|
|
|
PT_GETREGS/PT_SETREGS, but fpscr wasn't available.. */
|
|
|
|
|
|
|
|
|
|
#ifdef PT_GETFPREGS
|
|
|
|
|
|
|
|
|
|
/* Returns true if PT_GETFPREGS fetches this register. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
getfpregs_supplies (int regnum)
|
|
|
|
|
{
|
|
|
|
|
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
|
|
|
|
|
|
|
|
|
|
/* FIXME: jimb/2004-05-05: Some PPC variants don't have floating
|
|
|
|
|
point registers. Traditionally, GDB's register set has still
|
|
|
|
|
listed the floating point registers for such machines, so this
|
|
|
|
|
code is harmless. However, the new E500 port actually omits the
|
|
|
|
|
floating point registers entirely from the register set --- they
|
|
|
|
|
don't even have register numbers assigned to them.
|
|
|
|
|
|
|
|
|
|
It's not clear to me how best to update this code, so this assert
|
|
|
|
|
will alert the first person to encounter the NetBSD/E500
|
|
|
|
|
combination to the problem. */
|
|
|
|
|
gdb_assert (ppc_floating_point_unit_p (current_gdbarch));
|
|
|
|
|
|
|
|
|
|
return ((regnum >= tdep->ppc_fp0_regnum
|
|
|
|
|
&& regnum < tdep->ppc_fp0_regnum + ppc_num_fprs)
|
|
|
|
|
|| regnum == tdep->ppc_fpscr_regnum);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* PT_GETFPREGS */
|
2004-04-22 21:13:06 +00:00
|
|
|
|
|
|
|
|
|
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
|
|
|
|
|
for all registers. */
|
|
|
|
|
|
2005-04-16 22:12:09 +00:00
|
|
|
|
static void
|
|
|
|
|
ppcobsd_fetch_registers (int regnum)
|
2004-04-22 21:13:06 +00:00
|
|
|
|
{
|
|
|
|
|
struct reg regs;
|
|
|
|
|
|
|
|
|
|
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
* alphabsd-nat.c (fetch_inferior_registers):
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* amd64bsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* armnbsd-nat.c: Update copyright year.
(fetch_register, fetch_regs, fetch_fp_register, fetch_fp_regs)
(store_register, store_regs, store_fp_register, store_fp_regs):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* hppabsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* i386bsd-nat.c (fetch_inferior_registers)
(store_inferior_registers, i386bsd_dr_set, i386bsd_dr_get_status):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* m68kbsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* m88kbsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* mipsnbsd-nat.c: Update copyright year.
(fetch_inferior_registers, store_inferior_registers):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* ns32knbsd-nat.c: Update copyright year.
(fetch_inferior_registers, store_inferior_registers):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* ppcnbsd-nat.c (fetch_inferior_registers):
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* ppcobsd-nat.c (fetch_inferior_registers):
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* shnbsd-nat.c: Update copyright year.
(fetch_inferior_registers, store_inferior_registers):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* vaxbsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
2004-08-14 23:37:04 +00:00
|
|
|
|
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 18:13:55 +00:00
|
|
|
|
perror_with_name (_("Couldn't get registers"));
|
2004-04-22 21:13:06 +00:00
|
|
|
|
|
2006-05-15 21:53:20 +00:00
|
|
|
|
ppc_supply_gregset (&ppcobsd_gregset, current_regcache, -1,
|
|
|
|
|
®s, sizeof regs);
|
|
|
|
|
#ifndef PT_GETFPREGS
|
|
|
|
|
ppc_supply_fpregset (&ppcobsd_gregset, current_regcache, -1,
|
|
|
|
|
®s, sizeof regs);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef PT_GETFPREGS
|
|
|
|
|
if (regnum == -1 || getfpregs_supplies (regnum))
|
|
|
|
|
{
|
|
|
|
|
struct fpreg fpregs;
|
|
|
|
|
|
|
|
|
|
if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
|
|
|
|
|
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
|
|
|
perror_with_name (_("Couldn't get floating point status"));
|
|
|
|
|
|
|
|
|
|
ppc_supply_fpregset (&ppcobsd_fpregset, current_regcache, -1,
|
|
|
|
|
&fpregs, sizeof fpregs);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2004-04-22 21:13:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
|
|
|
|
|
this for all registers. */
|
|
|
|
|
|
2005-04-16 22:12:09 +00:00
|
|
|
|
static void
|
|
|
|
|
ppcobsd_store_registers (int regnum)
|
2004-04-22 21:13:06 +00:00
|
|
|
|
{
|
|
|
|
|
struct reg regs;
|
|
|
|
|
|
|
|
|
|
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
* alphabsd-nat.c (fetch_inferior_registers):
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* amd64bsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* armnbsd-nat.c: Update copyright year.
(fetch_register, fetch_regs, fetch_fp_register, fetch_fp_regs)
(store_register, store_regs, store_fp_register, store_fp_regs):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* hppabsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* i386bsd-nat.c (fetch_inferior_registers)
(store_inferior_registers, i386bsd_dr_set, i386bsd_dr_get_status):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* m68kbsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* m88kbsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* mipsnbsd-nat.c: Update copyright year.
(fetch_inferior_registers, store_inferior_registers):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* ns32knbsd-nat.c: Update copyright year.
(fetch_inferior_registers, store_inferior_registers):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* ppcnbsd-nat.c (fetch_inferior_registers):
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* ppcobsd-nat.c (fetch_inferior_registers):
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* shnbsd-nat.c: Update copyright year.
(fetch_inferior_registers, store_inferior_registers):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* vaxbsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
2004-08-14 23:37:04 +00:00
|
|
|
|
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 18:13:55 +00:00
|
|
|
|
perror_with_name (_("Couldn't get registers"));
|
2004-04-22 21:13:06 +00:00
|
|
|
|
|
2006-05-15 21:53:20 +00:00
|
|
|
|
ppc_collect_gregset (&ppcobsd_gregset, current_regcache,
|
|
|
|
|
regnum, ®s, sizeof regs);
|
|
|
|
|
#ifndef PT_GETFPREGS
|
|
|
|
|
ppc_collect_fpregset (&ppcobsd_gregset, current_regcache,
|
|
|
|
|
regnum, ®s, sizeof regs);
|
|
|
|
|
#endif
|
2004-04-22 21:13:06 +00:00
|
|
|
|
|
|
|
|
|
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
|
* alphabsd-nat.c (fetch_inferior_registers):
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* amd64bsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* armnbsd-nat.c: Update copyright year.
(fetch_register, fetch_regs, fetch_fp_register, fetch_fp_regs)
(store_register, store_regs, store_fp_register, store_fp_regs):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* hppabsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* i386bsd-nat.c (fetch_inferior_registers)
(store_inferior_registers, i386bsd_dr_set, i386bsd_dr_get_status):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* m68kbsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* m88kbsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* mipsnbsd-nat.c: Update copyright year.
(fetch_inferior_registers, store_inferior_registers):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* ns32knbsd-nat.c: Update copyright year.
(fetch_inferior_registers, store_inferior_registers):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* ppcnbsd-nat.c (fetch_inferior_registers):
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* ppcobsd-nat.c (fetch_inferior_registers):
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
* shnbsd-nat.c: Update copyright year.
(fetch_inferior_registers, store_inferior_registers):
Replace PTRACE_ARG3_TYPE with PTRACE_TYPE_ARG3.
* vaxbsd-nat.c (fetch_inferior_registers)
(store_inferior_registers): Replace PTRACE_ARG3_TYPE with
PTRACE_TYPE_ARG3.
2004-08-14 23:37:04 +00:00
|
|
|
|
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 18:13:55 +00:00
|
|
|
|
perror_with_name (_("Couldn't write registers"));
|
2006-05-15 21:53:20 +00:00
|
|
|
|
|
|
|
|
|
#ifdef PT_GETFPREGS
|
|
|
|
|
if (regnum == -1 || getfpregs_supplies (regnum))
|
|
|
|
|
{
|
|
|
|
|
struct fpreg fpregs;
|
|
|
|
|
|
|
|
|
|
if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
|
|
|
|
|
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
|
|
|
perror_with_name (_("Couldn't get floating point status"));
|
|
|
|
|
|
|
|
|
|
ppc_collect_fpregset (&ppcobsd_fpregset, current_regcache,
|
|
|
|
|
regnum, &fpregs, sizeof fpregs);
|
|
|
|
|
|
|
|
|
|
if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
|
|
|
|
|
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
|
|
|
perror_with_name (_("Couldn't write floating point status"));
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2004-04-22 21:13:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-06-24 21:11:39 +00:00
|
|
|
|
static int
|
|
|
|
|
ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
|
|
|
|
|
{
|
|
|
|
|
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
|
|
|
|
|
struct switchframe sf;
|
|
|
|
|
struct callframe cf;
|
|
|
|
|
int i, regnum;
|
|
|
|
|
|
|
|
|
|
/* The following is true for OpenBSD 3.7:
|
|
|
|
|
|
|
|
|
|
The pcb contains %r1 (the stack pointer) at the point of the
|
|
|
|
|
context switch in cpu_switch(). At that point we have a stack
|
|
|
|
|
frame as described by `struct switchframe', and below that a call
|
|
|
|
|
frame as described by `struct callframe'. From this information
|
|
|
|
|
we reconstruct the register state as it would look when we are in
|
|
|
|
|
cpu_switch(). */
|
|
|
|
|
|
|
|
|
|
/* The stack pointer shouldn't be zero. */
|
|
|
|
|
if (pcb->pcb_sp == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
read_memory (pcb->pcb_sp, (gdb_byte *)&sf, sizeof sf);
|
|
|
|
|
regcache_raw_supply (regcache, SP_REGNUM, &sf.sp);
|
|
|
|
|
regcache_raw_supply (regcache, tdep->ppc_cr_regnum, &sf.cr);
|
|
|
|
|
regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 2, &sf.fixreg2);
|
|
|
|
|
for (i = 0, regnum = tdep->ppc_gp0_regnum + 13; i < 19; i++, regnum++)
|
|
|
|
|
regcache_raw_supply (regcache, regnum, &sf.fixreg[i]);
|
|
|
|
|
|
|
|
|
|
read_memory (sf.sp, (gdb_byte *)&cf, sizeof cf);
|
|
|
|
|
regcache_raw_supply (regcache, PC_REGNUM, &cf.lr);
|
|
|
|
|
regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 30, &cf.r30);
|
|
|
|
|
regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 31, &cf.r31);
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-04-22 21:13:06 +00:00
|
|
|
|
/* Provide a prototype to silence -Wmissing-prototypes. */
|
|
|
|
|
void _initialize_ppcobsd_nat (void);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_initialize_ppcobsd_nat (void)
|
|
|
|
|
{
|
2005-04-16 22:12:09 +00:00
|
|
|
|
struct target_ops *t;
|
|
|
|
|
|
|
|
|
|
/* Add in local overrides. */
|
|
|
|
|
t = inf_ptrace_target ();
|
|
|
|
|
t->to_fetch_registers = ppcobsd_fetch_registers;
|
|
|
|
|
t->to_store_registers = ppcobsd_store_registers;
|
|
|
|
|
add_target (t);
|
|
|
|
|
|
2004-04-22 21:13:06 +00:00
|
|
|
|
/* General-purpose registers. */
|
|
|
|
|
ppcobsd_reg_offsets.r0_offset = offsetof (struct reg, gpr);
|
|
|
|
|
ppcobsd_reg_offsets.pc_offset = offsetof (struct reg, pc);
|
|
|
|
|
ppcobsd_reg_offsets.ps_offset = offsetof (struct reg, ps);
|
|
|
|
|
ppcobsd_reg_offsets.cr_offset = offsetof (struct reg, cnd);
|
|
|
|
|
ppcobsd_reg_offsets.lr_offset = offsetof (struct reg, lr);
|
|
|
|
|
ppcobsd_reg_offsets.ctr_offset = offsetof (struct reg, cnt);
|
|
|
|
|
ppcobsd_reg_offsets.xer_offset = offsetof (struct reg, xer);
|
|
|
|
|
ppcobsd_reg_offsets.mq_offset = offsetof (struct reg, mq);
|
|
|
|
|
|
|
|
|
|
/* Floating-point registers. */
|
|
|
|
|
ppcobsd_reg_offsets.f0_offset = offsetof (struct reg, fpr);
|
|
|
|
|
ppcobsd_reg_offsets.fpscr_offset = -1;
|
2006-05-15 21:53:20 +00:00
|
|
|
|
#ifdef PT_GETFPREGS
|
|
|
|
|
ppcobsd_fpreg_offsets.f0_offset = offsetof (struct fpreg, fpr);
|
|
|
|
|
ppcobsd_fpreg_offsets.fpscr_offset = offsetof (struct fpreg, fpscr);
|
|
|
|
|
#endif
|
2004-04-22 21:13:06 +00:00
|
|
|
|
|
|
|
|
|
/* AltiVec registers. */
|
|
|
|
|
ppcobsd_reg_offsets.vr0_offset = offsetof (struct vreg, vreg);
|
|
|
|
|
ppcobsd_reg_offsets.vscr_offset = offsetof (struct vreg, vscr);
|
|
|
|
|
ppcobsd_reg_offsets.vrsave_offset = offsetof (struct vreg, vrsave);
|
2005-06-24 21:11:39 +00:00
|
|
|
|
|
|
|
|
|
/* Support debugging kernel virtual memory images. */
|
|
|
|
|
bsd_kvm_add_target (ppcobsd_supply_pcb);
|
2004-04-22 21:13:06 +00:00
|
|
|
|
}
|