mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 18:08:24 +08:00
Add OpenBSD/powerpc support.
* NEWS (New native configurations): Mention OpenBSD/powerpc. * ppc-tdep.h (struct ppc_reg_offsets): New structure. (ppc_supply_gregset, ppc_supply_fpregset, ppc_collect_gregset) (ppc_collect_fpregset): New prototypes. * ppcobsd-nat.c: New file. * ppcobsd-tdep.c: New file. * ppcobsd-tdep.h: New file. * rs6000-tdep.c: Include "regset.h". (ppc_supply_reg, ppc_collect_reg, ppc_supply_gregset) (ppc_supply_fpregset, ppc_collect_gregset, ppc_collect_fpregset): New functions. * Makefile.in (ALLDEPFILES): Add pccobsd-nat.c and ppcobsd-tdep.c. (ppcobsd-nat.o, ppcobsd-tdep.o): New dependencies. (rs6000-tdep.o): Update dependencies. * configure.host: Add powerpc-*-openbsd. * configure.tgt: Add powerpc-*-openbsd. * config/powerpc/obsd.mh: New file. * config/powerpc/nm-obsd.h: New file. * config/powerpc/obsd.mt: New file.
This commit is contained in:
@ -1,3 +1,26 @@
|
|||||||
|
2004-04-22 Mark Kettenis <kettenis@gnu.org>
|
||||||
|
|
||||||
|
Add OpenBSD/powerpc support.
|
||||||
|
* NEWS (New native configurations): Mention OpenBSD/powerpc.
|
||||||
|
* ppc-tdep.h (struct ppc_reg_offsets): New structure.
|
||||||
|
(ppc_supply_gregset, ppc_supply_fpregset, ppc_collect_gregset)
|
||||||
|
(ppc_collect_fpregset): New prototypes.
|
||||||
|
* ppcobsd-nat.c: New file.
|
||||||
|
* ppcobsd-tdep.c: New file.
|
||||||
|
* ppcobsd-tdep.h: New file.
|
||||||
|
* rs6000-tdep.c: Include "regset.h".
|
||||||
|
(ppc_supply_reg, ppc_collect_reg, ppc_supply_gregset)
|
||||||
|
(ppc_supply_fpregset, ppc_collect_gregset, ppc_collect_fpregset):
|
||||||
|
New functions.
|
||||||
|
* Makefile.in (ALLDEPFILES): Add pccobsd-nat.c and ppcobsd-tdep.c.
|
||||||
|
(ppcobsd-nat.o, ppcobsd-tdep.o): New dependencies.
|
||||||
|
(rs6000-tdep.o): Update dependencies.
|
||||||
|
* configure.host: Add powerpc-*-openbsd.
|
||||||
|
* configure.tgt: Add powerpc-*-openbsd.
|
||||||
|
* config/powerpc/obsd.mh: New file.
|
||||||
|
* config/powerpc/nm-obsd.h: New file.
|
||||||
|
* config/powerpc/obsd.mt: New file.
|
||||||
|
|
||||||
2004-04-22 Andrew Cagney <cagney@redhat.com>
|
2004-04-22 Andrew Cagney <cagney@redhat.com>
|
||||||
|
|
||||||
* frame.h (show_frame_info): Delete declaration.
|
* frame.h (show_frame_info): Delete declaration.
|
||||||
|
@ -1352,6 +1352,7 @@ ALLDEPFILES = \
|
|||||||
somread.c somsolib.c $(HPREAD_SOURCE) \
|
somread.c somsolib.c $(HPREAD_SOURCE) \
|
||||||
ppc-sysv-tdep.c ppc-linux-nat.c ppc-linux-tdep.c \
|
ppc-sysv-tdep.c ppc-linux-nat.c ppc-linux-tdep.c \
|
||||||
ppcnbsd-nat.c ppcnbsd-tdep.c \
|
ppcnbsd-nat.c ppcnbsd-tdep.c \
|
||||||
|
ppcobsd-nat.c ppcobsd-tdep.c \
|
||||||
procfs.c \
|
procfs.c \
|
||||||
remote-e7000.c \
|
remote-e7000.c \
|
||||||
remote-hms.c remote-m32r-sdi.c remote-mips.c \
|
remote-hms.c remote-m32r-sdi.c remote-mips.c \
|
||||||
@ -2157,6 +2158,11 @@ ppcnbsd-nat.o: ppcnbsd-nat.c $(defs_h) $(inferior_h) $(ppc_tdep_h) \
|
|||||||
ppcnbsd-tdep.o: ppcnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
|
ppcnbsd-tdep.o: ppcnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
|
||||||
$(target_h) $(breakpoint_h) $(value_h) $(osabi_h) $(ppc_tdep_h) \
|
$(target_h) $(breakpoint_h) $(value_h) $(osabi_h) $(ppc_tdep_h) \
|
||||||
$(ppcnbsd_tdep_h) $(nbsd_tdep_h) $(solib_svr4_h)
|
$(ppcnbsd_tdep_h) $(nbsd_tdep_h) $(solib_svr4_h)
|
||||||
|
ppcobsd-nat.o: ppcobsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
|
||||||
|
$(ppcobsd_tdep_h)
|
||||||
|
ppcobsd-tdep.o: ppcobsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \
|
||||||
|
$(regcache_h) $(regset_h) $(gdb_string_h) $(ppc_tdep_h) \
|
||||||
|
$(ppcobsd_tdep_h) $(solib_svr4_h)
|
||||||
ppc-sysv-tdep.o: ppc-sysv-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
|
ppc-sysv-tdep.o: ppc-sysv-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
|
||||||
$(regcache_h) $(value_h) $(gdb_string_h) $(gdb_assert_h) \
|
$(regcache_h) $(value_h) $(gdb_string_h) $(gdb_assert_h) \
|
||||||
$(ppc_tdep_h) $(target_h) $(objfiles_h)
|
$(ppc_tdep_h) $(target_h) $(objfiles_h)
|
||||||
@ -2254,11 +2260,11 @@ rs6000-nat.o: rs6000-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
|
|||||||
$(ppc_tdep_h) $(exec_h) $(gdb_stat_h)
|
$(ppc_tdep_h) $(exec_h) $(gdb_stat_h)
|
||||||
rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
|
rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
|
||||||
$(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) $(arch_utils_h) \
|
$(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) $(arch_utils_h) \
|
||||||
$(regcache_h) $(doublest_h) $(value_h) $(parser_defs_h) $(osabi_h) \
|
$(regcache_h) $(regset_g) $(doublest_h) $(value_h) $(parser_defs_h) \
|
||||||
$(libbfd_h) $(coff_internal_h) $(libcoff_h) $(coff_xcoff_h) \
|
$(osabi_h) $(libbfd_h) $(coff_internal_h) $(libcoff_h) \
|
||||||
$(libxcoff_h) $(elf_bfd_h) $(solib_svr4_h) $(ppc_tdep_h) \
|
$(coff_xcoff_h) $(libxcoff_h) $(elf_bfd_h) $(solib_svr4_h) \
|
||||||
$(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) $(frame_unwind_h) \
|
$(ppc_tdep_h) $(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) \
|
||||||
$(frame_base_h)
|
$(frame_unwind_h) $(frame_base_h)
|
||||||
s390-nat.o: s390-nat.c $(defs_h) $(tm_h) $(regcache_h) $(inferior_h) \
|
s390-nat.o: s390-nat.c $(defs_h) $(tm_h) $(regcache_h) $(inferior_h) \
|
||||||
$(s390_tdep_h)
|
$(s390_tdep_h)
|
||||||
s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
|
s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
|
||||||
|
1
gdb/NEWS
1
gdb/NEWS
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
* New native configurations
|
* New native configurations
|
||||||
|
|
||||||
|
OpenBSD/powerpc powerpc-*-openbsd*
|
||||||
NetBSD/vax vax-*-netbsd*
|
NetBSD/vax vax-*-netbsd*
|
||||||
OpenBSD/vax vax-*-openbsd*
|
OpenBSD/vax vax-*-openbsd*
|
||||||
|
|
||||||
|
28
gdb/config/powerpc/nm-obsd.h
Normal file
28
gdb/config/powerpc/nm-obsd.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/* Native-dependent definitions for OpenBSD/powerpc.
|
||||||
|
|
||||||
|
Copyright 2004 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
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
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef NM_OBSD_H
|
||||||
|
#define NM_OBSD_H
|
||||||
|
|
||||||
|
/* Get generic BSD native definitions. */
|
||||||
|
#include "config/nm-bsd.h"
|
||||||
|
|
||||||
|
#endif /* nm-obsd.h */
|
3
gdb/config/powerpc/obsd.mh
Normal file
3
gdb/config/powerpc/obsd.mh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Host: OpenBSD/powerpc
|
||||||
|
NATDEPFILES= ppcobsd-nat.o fork-child.o infptrace.o inftarg.o
|
||||||
|
NAT_FILE= nm-obsd.h
|
4
gdb/config/powerpc/obsd.mt
Normal file
4
gdb/config/powerpc/obsd.mt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Target: OpenBSD/powerpc
|
||||||
|
TDEPFILES= rs6000-tdep.o ppc-sysv-tdep.o ppcobsd-tdep.o \
|
||||||
|
corelow.o solib.o solib-svr4.o
|
||||||
|
TM_FILE= tm-nbsd.h
|
@ -98,6 +98,7 @@ powerpc-*-aix4.3.[0-1]*) gdb_host=aix ;;
|
|||||||
powerpc-*-aix*) gdb_host=aix432 ;;
|
powerpc-*-aix*) gdb_host=aix432 ;;
|
||||||
powerpc-*-linux*) gdb_host=linux ;;
|
powerpc-*-linux*) gdb_host=linux ;;
|
||||||
powerpc-*-netbsd*) gdb_host=nbsd ;;
|
powerpc-*-netbsd*) gdb_host=nbsd ;;
|
||||||
|
powerpc-*-openbsd*) gdb_host=obsd ;;
|
||||||
|
|
||||||
powerpc64-*-linux*) gdb_host=ppc64-linux ;;
|
powerpc64-*-linux*) gdb_host=ppc64-linux ;;
|
||||||
|
|
||||||
|
@ -134,6 +134,7 @@ mn10300-*-*) gdb_target=mn10300 ;;
|
|||||||
ns32k-*-netbsd*) gdb_target=nbsdaout ;;
|
ns32k-*-netbsd*) gdb_target=nbsdaout ;;
|
||||||
|
|
||||||
powerpc-*-netbsd*) gdb_target=nbsd ;;
|
powerpc-*-netbsd*) gdb_target=nbsd ;;
|
||||||
|
powerpc-*-openbsd*) gdb_target=obsd ;;
|
||||||
powerpc-*-aix*) gdb_target=aix ;;
|
powerpc-*-aix*) gdb_target=aix ;;
|
||||||
powerpc-*-linux*) gdb_target=linux
|
powerpc-*-linux*) gdb_target=linux
|
||||||
build_gdbserver=yes
|
build_gdbserver=yes
|
||||||
|
@ -74,11 +74,68 @@ enum return_value_convention ppc64_sysv_abi_return_value (struct gdbarch *gdbarc
|
|||||||
/* From rs6000-tdep.c... */
|
/* From rs6000-tdep.c... */
|
||||||
int altivec_register_p (int regno);
|
int altivec_register_p (int regno);
|
||||||
|
|
||||||
|
|
||||||
/* Return non-zero when the architecture has an FPU (or at least when
|
/* Return non-zero when the architecture has an FPU (or at least when
|
||||||
the ABI is using the FPU). */
|
the ABI is using the FPU). */
|
||||||
int ppc_floating_point_unit_p (struct gdbarch *gdbarch);
|
int ppc_floating_point_unit_p (struct gdbarch *gdbarch);
|
||||||
|
|
||||||
|
/* Register set description. */
|
||||||
|
|
||||||
|
struct ppc_reg_offsets
|
||||||
|
{
|
||||||
|
/* General-purpose registers. */
|
||||||
|
int r0_offset;
|
||||||
|
int pc_offset;
|
||||||
|
int ps_offset;
|
||||||
|
int cr_offset;
|
||||||
|
int lr_offset;
|
||||||
|
int ctr_offset;
|
||||||
|
int xer_offset;
|
||||||
|
int mq_offset;
|
||||||
|
|
||||||
|
/* Floating-point registers. */
|
||||||
|
int f0_offset;
|
||||||
|
int fpscr_offset;
|
||||||
|
|
||||||
|
/* AltiVec registers. */
|
||||||
|
int vr0_offset;
|
||||||
|
int vscr_offset;
|
||||||
|
int vrsave_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Supply register REGNUM in the general-purpose register set REGSET
|
||||||
|
from the buffer specified by GREGS and LEN to register cache
|
||||||
|
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
|
||||||
|
|
||||||
|
extern void ppc_supply_gregset (const struct regset *regset,
|
||||||
|
struct regcache *regcache,
|
||||||
|
int regnum, const void *gregs, size_t len);
|
||||||
|
|
||||||
|
/* Supply register REGNUM in the floating-point register set REGSET
|
||||||
|
from the buffer specified by FPREGS and LEN to register cache
|
||||||
|
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
|
||||||
|
|
||||||
|
extern void ppc_supply_fpregset (const struct regset *regset,
|
||||||
|
struct regcache *regcache,
|
||||||
|
int regnum, const void *fpregs, size_t len);
|
||||||
|
|
||||||
|
/* Collect register REGNUM in the general-purpose register set
|
||||||
|
REGSET. from register cache REGCACHE into the buffer specified by
|
||||||
|
GREGS and LEN. If REGNUM is -1, do this for all registers in
|
||||||
|
REGSET. */
|
||||||
|
|
||||||
|
extern void ppc_collect_gregset (const struct regset *regset,
|
||||||
|
const struct regcache *regcache,
|
||||||
|
int regnum, void *gregs, size_t len);
|
||||||
|
|
||||||
|
/* Collect register REGNUM in the floating-point register set
|
||||||
|
REGSET. from register cache REGCACHE into the buffer specified by
|
||||||
|
FPREGS and LEN. If REGNUM is -1, do this for all registers in
|
||||||
|
REGSET. */
|
||||||
|
|
||||||
|
extern void ppc_collect_fpregset (const struct regset *regset,
|
||||||
|
const struct regcache *regcache,
|
||||||
|
int regnum, void *fpregs, size_t len);
|
||||||
|
|
||||||
/* Private data that this module attaches to struct gdbarch. */
|
/* Private data that this module attaches to struct gdbarch. */
|
||||||
|
|
||||||
struct gdbarch_tdep
|
struct gdbarch_tdep
|
||||||
|
97
gdb/ppcobsd-nat.c
Normal file
97
gdb/ppcobsd-nat.c
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
/* Native-dependent code for OpenBSD/powerpc.
|
||||||
|
|
||||||
|
Copyright 2004 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
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
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include "defs.h"
|
||||||
|
#include "inferior.h"
|
||||||
|
#include "regcache.h"
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/ptrace.h>
|
||||||
|
#include <machine/reg.h>
|
||||||
|
|
||||||
|
#include "ppcobsd-tdep.h"
|
||||||
|
|
||||||
|
/* OpenBSD/powerpc doesn't have PT_GETFPREGS/PT_SETFPREGS like
|
||||||
|
NetBSD/powerpc and FreeBSD/powerpc. */
|
||||||
|
|
||||||
|
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
|
||||||
|
for all registers. */
|
||||||
|
|
||||||
|
void
|
||||||
|
fetch_inferior_registers (int regnum)
|
||||||
|
{
|
||||||
|
struct reg regs;
|
||||||
|
|
||||||
|
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
||||||
|
(PTRACE_ARG3_TYPE) ®s, 0) == -1)
|
||||||
|
perror_with_name ("Couldn't get registers");
|
||||||
|
|
||||||
|
ppcobsd_supply_gregset (&ppcobsd_gregset, current_regcache, -1,
|
||||||
|
®s, sizeof regs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
|
||||||
|
this for all registers. */
|
||||||
|
|
||||||
|
void
|
||||||
|
store_inferior_registers (int regnum)
|
||||||
|
{
|
||||||
|
struct reg regs;
|
||||||
|
|
||||||
|
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
||||||
|
(PTRACE_ARG3_TYPE) ®s, 0) == -1)
|
||||||
|
perror_with_name ("Couldn't get registers");
|
||||||
|
|
||||||
|
ppcobsd_collect_gregset (&ppcobsd_gregset, current_regcache,
|
||||||
|
regnum, ®s, sizeof regs);
|
||||||
|
|
||||||
|
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
|
||||||
|
(PTRACE_ARG3_TYPE) ®s, 0) == -1)
|
||||||
|
perror_with_name ("Couldn't write registers");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Provide a prototype to silence -Wmissing-prototypes. */
|
||||||
|
void _initialize_ppcobsd_nat (void);
|
||||||
|
|
||||||
|
void
|
||||||
|
_initialize_ppcobsd_nat (void)
|
||||||
|
{
|
||||||
|
/* 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;
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
}
|
153
gdb/ppcobsd-tdep.c
Normal file
153
gdb/ppcobsd-tdep.c
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
/* Target-dependent code for OpenBSD/powerpc.
|
||||||
|
|
||||||
|
Copyright 2004 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
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
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include "defs.h"
|
||||||
|
#include "arch-utils.h"
|
||||||
|
#include "osabi.h"
|
||||||
|
#include "regcache.h"
|
||||||
|
#include "regset.h"
|
||||||
|
|
||||||
|
#include "gdb_string.h"
|
||||||
|
|
||||||
|
#include "ppc-tdep.h"
|
||||||
|
#include "ppcobsd-tdep.h"
|
||||||
|
#include "solib-svr4.h"
|
||||||
|
|
||||||
|
/* Register offsets from <machine/reg.h>. */
|
||||||
|
struct ppc_reg_offsets ppcobsd_reg_offsets;
|
||||||
|
|
||||||
|
|
||||||
|
/* Core file support. */
|
||||||
|
|
||||||
|
/* Supply register REGNUM in the general-purpose register set REGSET
|
||||||
|
from the buffer specified by GREGS and LEN to register cache
|
||||||
|
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
|
||||||
|
|
||||||
|
void
|
||||||
|
ppcobsd_supply_gregset (const struct regset *regset,
|
||||||
|
struct regcache *regcache, int regnum,
|
||||||
|
const void *gregs, size_t len)
|
||||||
|
{
|
||||||
|
ppc_supply_gregset (regset, regcache, regnum, gregs, len);
|
||||||
|
ppc_supply_fpregset (regset, regcache, regnum, gregs, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Collect register REGNUM in the general-purpose register set
|
||||||
|
REGSET. from register cache REGCACHE into the buffer specified by
|
||||||
|
GREGS and LEN. If REGNUM is -1, do this for all registers in
|
||||||
|
REGSET. */
|
||||||
|
|
||||||
|
void
|
||||||
|
ppcobsd_collect_gregset (const struct regset *regset,
|
||||||
|
const struct regcache *regcache, int regnum,
|
||||||
|
void *gregs, size_t len)
|
||||||
|
{
|
||||||
|
ppc_collect_gregset (regset, regcache, regnum, gregs, len);
|
||||||
|
ppc_collect_fpregset (regset, regcache, regnum, gregs, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* OpenBS/powerpc register set. */
|
||||||
|
|
||||||
|
struct regset ppcobsd_gregset =
|
||||||
|
{
|
||||||
|
&ppcobsd_reg_offsets,
|
||||||
|
ppcobsd_supply_gregset
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Return the appropriate register set for the core section identified
|
||||||
|
by SECT_NAME and SECT_SIZE. */
|
||||||
|
|
||||||
|
static const struct regset *
|
||||||
|
ppcobsd_regset_from_core_section (struct gdbarch *gdbarch,
|
||||||
|
const char *sect_name, size_t sect_size)
|
||||||
|
{
|
||||||
|
if (strcmp (sect_name, ".reg") == 0 && sect_size >= 412)
|
||||||
|
return &ppcobsd_gregset;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
ppcobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||||
|
{
|
||||||
|
/* OpenBSD uses SVR4-style shared libraries. */
|
||||||
|
set_gdbarch_in_solib_call_trampoline
|
||||||
|
(gdbarch, generic_in_solib_call_trampoline);
|
||||||
|
set_solib_svr4_fetch_link_map_offsets
|
||||||
|
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||||
|
|
||||||
|
set_gdbarch_regset_from_core_section
|
||||||
|
(gdbarch, ppcobsd_regset_from_core_section);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* OpenBSD uses uses the traditional NetBSD core file format, even for
|
||||||
|
ports that use ELF. */
|
||||||
|
#define GDB_OSABI_NETBSD_CORE GDB_OSABI_OPENBSD_ELF
|
||||||
|
|
||||||
|
static enum gdb_osabi
|
||||||
|
ppcobsd_core_osabi_sniffer (bfd *abfd)
|
||||||
|
{
|
||||||
|
if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
|
||||||
|
return GDB_OSABI_NETBSD_CORE;
|
||||||
|
|
||||||
|
return GDB_OSABI_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Provide a prototype to silence -Wmissing-prototypes. */
|
||||||
|
void _initialize_ppcobsd_tdep (void);
|
||||||
|
|
||||||
|
void
|
||||||
|
_initialize_ppcobsd_tdep (void)
|
||||||
|
{
|
||||||
|
/* BFD doesn't set a flavour for NetBSD style a.out core files. */
|
||||||
|
gdbarch_register_osabi_sniffer (bfd_arch_powerpc, bfd_target_unknown_flavour,
|
||||||
|
ppcobsd_core_osabi_sniffer);
|
||||||
|
|
||||||
|
gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_OPENBSD_ELF,
|
||||||
|
ppcobsd_init_abi);
|
||||||
|
|
||||||
|
/* Avoid initializing the register offsets again if they were
|
||||||
|
already initailized by ppcobsd-nat.c. */
|
||||||
|
if (ppcobsd_reg_offsets.pc_offset == 0)
|
||||||
|
{
|
||||||
|
/* General-purpose registers. */
|
||||||
|
ppcobsd_reg_offsets.r0_offset = 0;
|
||||||
|
ppcobsd_reg_offsets.pc_offset = 384;
|
||||||
|
ppcobsd_reg_offsets.ps_offset = 388;
|
||||||
|
ppcobsd_reg_offsets.cr_offset = 392;
|
||||||
|
ppcobsd_reg_offsets.lr_offset = 396;
|
||||||
|
ppcobsd_reg_offsets.ctr_offset = 400;
|
||||||
|
ppcobsd_reg_offsets.xer_offset = 404;
|
||||||
|
ppcobsd_reg_offsets.mq_offset = 408;
|
||||||
|
|
||||||
|
/* Floating-point registers. */
|
||||||
|
ppcobsd_reg_offsets.f0_offset = 128;
|
||||||
|
ppcobsd_reg_offsets.fpscr_offset = -1;
|
||||||
|
|
||||||
|
/* AltiVec registers. */
|
||||||
|
ppcobsd_reg_offsets.vr0_offset = 0;
|
||||||
|
ppcobsd_reg_offsets.vscr_offset = 512;
|
||||||
|
ppcobsd_reg_offsets.vrsave_offset = 520;
|
||||||
|
}
|
||||||
|
}
|
54
gdb/ppcobsd-tdep.h
Normal file
54
gdb/ppcobsd-tdep.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/* Target-dependent code for OpenBSD/powerpc.
|
||||||
|
|
||||||
|
Copyright 2004 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
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
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef PPCOBSD_TDEP_H
|
||||||
|
#define PPCOBSD_TDEP_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
struct regset;
|
||||||
|
struct regcache;
|
||||||
|
|
||||||
|
/* Register offsets for OpenBSD/powerpc. */
|
||||||
|
extern struct ppc_reg_offsets ppcobsd_reg_offsets;
|
||||||
|
|
||||||
|
/* Register sets for OpenBSD/powerpc. */
|
||||||
|
extern struct regset ppcobsd_gregset;
|
||||||
|
|
||||||
|
|
||||||
|
/* Supply register REGNUM in the general-purpose register set REGSET
|
||||||
|
from the buffer specified by GREGS and LEN to register cache
|
||||||
|
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
|
||||||
|
|
||||||
|
extern void ppcobsd_supply_gregset (const struct regset *regset,
|
||||||
|
struct regcache *regcache, int regnum,
|
||||||
|
const void *gregs, size_t len);
|
||||||
|
|
||||||
|
/* Collect register REGNUM in the general-purpose register set
|
||||||
|
REGSET. from register cache REGCACHE into the buffer specified by
|
||||||
|
GREGS and LEN. If REGNUM is -1, do this for all registers in
|
||||||
|
REGSET. */
|
||||||
|
|
||||||
|
extern void ppcobsd_collect_gregset (const struct regset *regset,
|
||||||
|
const struct regcache *regcache,
|
||||||
|
int regnum, void *gregs, size_t len);
|
||||||
|
|
||||||
|
#endif /* ppcobsd-tdep.h */
|
@ -31,6 +31,7 @@
|
|||||||
#include "objfiles.h"
|
#include "objfiles.h"
|
||||||
#include "arch-utils.h"
|
#include "arch-utils.h"
|
||||||
#include "regcache.h"
|
#include "regcache.h"
|
||||||
|
#include "regset.h"
|
||||||
#include "doublest.h"
|
#include "doublest.h"
|
||||||
#include "value.h"
|
#include "value.h"
|
||||||
#include "parser-defs.h"
|
#include "parser-defs.h"
|
||||||
@ -150,6 +151,166 @@ ppc_floating_point_unit_p (struct gdbarch *gdbarch)
|
|||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Register set support functions. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
ppc_supply_reg (struct regcache *regcache, int regnum,
|
||||||
|
const char *regs, size_t offset)
|
||||||
|
{
|
||||||
|
if (regnum != -1 && offset != -1)
|
||||||
|
regcache_raw_supply (regcache, regnum, regs + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ppc_collect_reg (const struct regcache *regcache, int regnum,
|
||||||
|
char *regs, size_t offset)
|
||||||
|
{
|
||||||
|
if (regnum != -1 && offset != -1)
|
||||||
|
regcache_raw_collect (regcache, regnum, regs + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Supply register REGNUM in the general-purpose register set REGSET
|
||||||
|
from the buffer specified by GREGS and LEN to register cache
|
||||||
|
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
|
||||||
|
|
||||||
|
void
|
||||||
|
ppc_supply_gregset (const struct regset *regset, struct regcache *regcache,
|
||||||
|
int regnum, const void *gregs, size_t len)
|
||||||
|
{
|
||||||
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||||
|
const struct ppc_reg_offsets *offsets = regset->descr;
|
||||||
|
size_t offset;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0, offset = offsets->r0_offset; i < 32; i++, offset += 4)
|
||||||
|
{
|
||||||
|
if (regnum == -1 || regnum == i)
|
||||||
|
ppc_supply_reg (regcache, i, gregs, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regnum == -1 || regnum == PC_REGNUM)
|
||||||
|
ppc_supply_reg (regcache, PC_REGNUM, gregs, offsets->pc_offset);
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_ps_regnum)
|
||||||
|
ppc_supply_reg (regcache, tdep->ppc_ps_regnum,
|
||||||
|
gregs, offsets->ps_offset);
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_cr_regnum)
|
||||||
|
ppc_supply_reg (regcache, tdep->ppc_cr_regnum,
|
||||||
|
gregs, offsets->cr_offset);
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_lr_regnum)
|
||||||
|
ppc_supply_reg (regcache, tdep->ppc_lr_regnum,
|
||||||
|
gregs, offsets->lr_offset);
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_ctr_regnum)
|
||||||
|
ppc_supply_reg (regcache, tdep->ppc_ctr_regnum,
|
||||||
|
gregs, offsets->ctr_offset);
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_xer_regnum)
|
||||||
|
ppc_supply_reg (regcache, tdep->ppc_xer_regnum,
|
||||||
|
gregs, offsets->cr_offset);
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_mq_regnum)
|
||||||
|
ppc_supply_reg (regcache, tdep->ppc_mq_regnum, gregs, offsets->mq_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Supply register REGNUM in the floating-point register set REGSET
|
||||||
|
from the buffer specified by FPREGS and LEN to register cache
|
||||||
|
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
|
||||||
|
|
||||||
|
void
|
||||||
|
ppc_supply_fpregset (const struct regset *regset, struct regcache *regcache,
|
||||||
|
int regnum, const void *fpregs, size_t len)
|
||||||
|
{
|
||||||
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||||
|
const struct ppc_reg_offsets *offsets = regset->descr;
|
||||||
|
size_t offset;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
offset = offsets->f0_offset;
|
||||||
|
for (i = FP0_REGNUM; i < FP0_REGNUM + 32; i++, offset += 4)
|
||||||
|
{
|
||||||
|
if (regnum == -1 || regnum == i)
|
||||||
|
ppc_supply_reg (regcache, i, fpregs, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_fpscr_regnum)
|
||||||
|
ppc_supply_reg (regcache, tdep->ppc_fpscr_regnum,
|
||||||
|
fpregs, offsets->fpscr_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Collect register REGNUM in the general-purpose register set
|
||||||
|
REGSET. from register cache REGCACHE into the buffer specified by
|
||||||
|
GREGS and LEN. If REGNUM is -1, do this for all registers in
|
||||||
|
REGSET. */
|
||||||
|
|
||||||
|
void
|
||||||
|
ppc_collect_gregset (const struct regset *regset,
|
||||||
|
const struct regcache *regcache,
|
||||||
|
int regnum, void *gregs, size_t len)
|
||||||
|
{
|
||||||
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||||
|
const struct ppc_reg_offsets *offsets = regset->descr;
|
||||||
|
size_t offset;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
offset = offsets->r0_offset;
|
||||||
|
for (i = 0; i <= 32; i++, offset += 4)
|
||||||
|
{
|
||||||
|
if (regnum == -1 || regnum == i)
|
||||||
|
ppc_collect_reg (regcache, regnum, gregs, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regnum == -1 || regnum == PC_REGNUM)
|
||||||
|
ppc_collect_reg (regcache, PC_REGNUM, gregs, offsets->pc_offset);
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_ps_regnum)
|
||||||
|
ppc_collect_reg (regcache, tdep->ppc_ps_regnum,
|
||||||
|
gregs, offsets->ps_offset);
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_cr_regnum)
|
||||||
|
ppc_collect_reg (regcache, tdep->ppc_cr_regnum,
|
||||||
|
gregs, offsets->cr_offset);
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_lr_regnum)
|
||||||
|
ppc_collect_reg (regcache, tdep->ppc_lr_regnum,
|
||||||
|
gregs, offsets->lr_offset);
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_ctr_regnum)
|
||||||
|
ppc_collect_reg (regcache, tdep->ppc_ctr_regnum,
|
||||||
|
gregs, offsets->ctr_offset);
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_xer_regnum)
|
||||||
|
ppc_collect_reg (regcache, tdep->ppc_xer_regnum,
|
||||||
|
gregs, offsets->xer_offset);
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_mq_regnum)
|
||||||
|
ppc_collect_reg (regcache, tdep->ppc_mq_regnum,
|
||||||
|
gregs, offsets->mq_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Collect register REGNUM in the floating-point register set
|
||||||
|
REGSET. from register cache REGCACHE into the buffer specified by
|
||||||
|
FPREGS and LEN. If REGNUM is -1, do this for all registers in
|
||||||
|
REGSET. */
|
||||||
|
|
||||||
|
void
|
||||||
|
ppc_collect_fpregset (const struct regset *regset,
|
||||||
|
const struct regcache *regcache,
|
||||||
|
int regnum, void *fpregs, size_t len)
|
||||||
|
{
|
||||||
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||||
|
const struct ppc_reg_offsets *offsets = regset->descr;
|
||||||
|
size_t offset;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
offset = offsets->f0_offset;
|
||||||
|
for (i = FP0_REGNUM; i <= FP0_REGNUM + 32; i++, offset += 4)
|
||||||
|
{
|
||||||
|
if (regnum == -1 || regnum == i)
|
||||||
|
ppc_collect_reg (regcache, regnum, fpregs, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regnum == -1 || regnum == tdep->ppc_fpscr_regnum)
|
||||||
|
ppc_collect_reg (regcache, tdep->ppc_fpscr_regnum,
|
||||||
|
fpregs, offsets->fpscr_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Read a LEN-byte address from debugged memory address MEMADDR. */
|
/* Read a LEN-byte address from debugged memory address MEMADDR. */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user