Rewrite FreeBSD/sparc64 native configuration.

* sparcbsd-nat.c, sparcbsd-nat.h: New files.
* sparc64fbsd-nat.c: New file.
* sparc64fbsd-tdep.c: New file.
* sparc64-tdep.c sparc64-tdep.h: New files.
* Makefile.in (sparcbsd-nat.o, sparc64fbsd-nat.o, sparc64-tdep.o,
sparc64fbsd-tdep.o): New dependencies.
(SFILES): Add sparcbsd-nat.c, sparc64fbsd-nat.c, sparc64-tdep.c
and sparc64fbsd-tdep.c.
(sparc64_tdep_h, sparcbsd_nat_h): New variables.
* config/sparc/fbsd.mh: Remove copyright notice.
(NATDEPFILES): Remove sparc-nat.o, add sparc64fbsd-nat.o and
sparcbsd-nat.o.
* config/sparc/fbsd.mt: Remove copyright notice.
(TDEPFILES): Remove sparc-tdep.o, solib.o solib-svr4.o,
solib-legacy.o.  Add sparc64-tdep.o and sparc64fbsd-tdep.o.
* config/sparc/nm-fbsd.h: Don't include "elf/common.h".
(SVR4_SHARED_LIBS, PTRACE_GETREGS, PTRACE_SETREGS,
PTRACE_GETFPREGS, PTRACE_SETFPREGS, GDB_GREGSET_T, GDB_FPREGSET_T,
regs, r_g1, r_ps, r_pc, r_npc, r_y, FPU_FSR_TYPE, fp_status, fpu,
fpu_regs, fp_fr, fpu_fsr, Fpu_fsr): Remove defines.
* config/sparc/tm-fbsd.h: Don't include "solib.h" and
"sparc/tm-sp64.h".
(SVR4_SHARED_LIBS, START_INFERIOR_TRAPS_EXPECTED): Remove defines.
(GDB_MULTI_ARCH): Define to GDB_MULTI_ARCH_TM.
This commit is contained in:
Mark Kettenis 2003-08-21 20:38:46 +00:00
parent a7f19c79e3
commit 8b39fe56a2
11 changed files with 2112 additions and 85 deletions

View File

@ -1,3 +1,31 @@
2003-08-21 Mark Kettenis <kettenis@gnu.org>
Rewrite FreeBSD/sparc64 native configuration.
* sparcbsd-nat.c, sparcbsd-nat.h: New files.
* sparc64fbsd-nat.c: New file.
* sparc64fbsd-tdep.c: New file.
* sparc64-tdep.c sparc64-tdep.h: New files.
* Makefile.in (sparcbsd-nat.o, sparc64fbsd-nat.o, sparc64-tdep.o,
sparc64fbsd-tdep.o): New dependencies.
(SFILES): Add sparcbsd-nat.c, sparc64fbsd-nat.c, sparc64-tdep.c
and sparc64fbsd-tdep.c.
(sparc64_tdep_h, sparcbsd_nat_h): New variables.
* config/sparc/fbsd.mh: Remove copyright notice.
(NATDEPFILES): Remove sparc-nat.o, add sparc64fbsd-nat.o and
sparcbsd-nat.o.
* config/sparc/fbsd.mt: Remove copyright notice.
(TDEPFILES): Remove sparc-tdep.o, solib.o solib-svr4.o,
solib-legacy.o. Add sparc64-tdep.o and sparc64fbsd-tdep.o.
* config/sparc/nm-fbsd.h: Don't include "elf/common.h".
(SVR4_SHARED_LIBS, PTRACE_GETREGS, PTRACE_SETREGS,
PTRACE_GETFPREGS, PTRACE_SETFPREGS, GDB_GREGSET_T, GDB_FPREGSET_T,
regs, r_g1, r_ps, r_pc, r_npc, r_y, FPU_FSR_TYPE, fp_status, fpu,
fpu_regs, fp_fr, fpu_fsr, Fpu_fsr): Remove defines.
* config/sparc/tm-fbsd.h: Don't include "solib.h" and
"sparc/tm-sp64.h".
(SVR4_SHARED_LIBS, START_INFERIOR_TRAPS_EXPECTED): Remove defines.
(GDB_MULTI_ARCH): Define to GDB_MULTI_ARCH_TM.
2003-08-21 Michael Chastain <mec@shout.net>
* symtab.h: Add doco on the space critical structures and

View File

@ -1,25 +1,5 @@
# Host-dependent settings for FreeBSD/sparc64.
# Copyright 2002 Free Software Foundation, Inc.
# Contributed by David E. O'Brien <obrien@FreeBSD.org>.
#
# 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
# Host: FreeBSD/sparc64
NATDEPFILES= sparc-nat.o \
NATDEPFILES= sparc64fbsd-nat.o sparcbsd-nat.o \
corelow.o fork-child.o infptrace.o inftarg.o \
solib.o solib-svr4.o solib-legacy.o
NAT_FILE= nm-fbsd.h

View File

@ -1,23 +1,3 @@
# Target-dependent settings for FreeBSD/sparc64.
# Copyright 2002 Free Software Foundation, Inc.
# Contributed by David E. O'Brien <obrien@FreeBSD.org>.
#
# 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
# Target: FreeBSD/sparc64
TDEPFILES= sparc-tdep.o solib.o solib-svr4.o solib-legacy.o
TDEPFILES= sparc64-tdep.o sparc64fbsd-tdep.o
TM_FILE= tm-fbsd.h

View File

@ -1,6 +1,6 @@
/* Native-dependent definitions for FreeBSD/sparc64.
Copyright 2002
Free Software Foundation, Inc.
Copyright 2002, 2003 Free Software Foundation, Inc.
Contributed by David E. O'Brien <obrien@FreeBSD.org>.
This file is part of GDB.
@ -34,34 +34,6 @@
/* Shared library support. */
#define SVR4_SHARED_LIBS
#include "solib.h"
#include "solib.h" /* Support for shared libraries. */
#include "elf/common.h" /* Additional ELF shared library info. */
/* Make things match up with what is expected in sparc-nat.c. */
#define PTRACE_GETREGS PT_GETREGS
#define PTRACE_SETREGS PT_SETREGS
#define PTRACE_GETFPREGS PT_GETFPREGS
#define PTRACE_SETFPREGS PT_SETFPREGS
#define GDB_GREGSET_T struct reg
#define GDB_FPREGSET_T struct fpreg
#define regs trapframe
#define r_g1 tf_global[1]
#define r_ps tf_tstate
#define r_pc tf_tpc
#define r_npc tf_tnpc
#define r_y tf_y
#define FPU_FSR_TYPE unsigned long
#define fp_status fpreg /* our reg.h */
#define fpu fpreg /* our reg.h */
#define fpu_regs fr_regs /* one field of fpu_fr on Solaris */
#define fpu_fr fr_regs /* a union w/in struct fpu on Solaris */
#define fpu_fsr fr_fsr
#define Fpu_fsr fr_fsr
#endif /* NM_FBSD_H */
#endif /* nm-fbsd.h */

View File

@ -1,5 +1,6 @@
/* Target-dependent definitions for FreeBSD/sparc64.
Copyright 2002 Free Software Foundation, Inc.
Copyright 2002, 2003 Free Software Foundation, Inc.
Contributed by David E. O'Brien <obrien@FreeBSD.org>.
This file is part of GDB.
@ -21,14 +22,6 @@
#ifndef TM_FBSD_H
#define TM_FBSD_H
#define SVR4_SHARED_LIBS
#include "solib.h" /* Support for shared libraries. */
#include "sparc/tm-sp64.h"
#define GDB_MULTI_ARCH GDB_MULTI_ARCH_TM
/* Number of traps that happen between exec'ing the shell to run an
inferior, and when we finally get to the inferior code. The
default is right for FreeBSD. */
#undef START_INFERIOR_TRAPS_EXPECTED
#endif /* TM_FBSD_H */
#endif /* tm-fbsd.h */

1491
gdb/sparc64-tdep.c Normal file

File diff suppressed because it is too large Load Diff

103
gdb/sparc64-tdep.h Normal file
View File

@ -0,0 +1,103 @@
/* Target-dependent code for UltraSPARC.
Copyright 2003 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 SPARC64_TDEP_H
#define SPARC62_TDEP_H 1
/* Register numbers of various important registers. */
enum sparc_regnum
{
SPARC_G0_REGNUM, /* %g0 */
SPARC_G1_REGNUM,
SPARC_G2_REGNUM,
SPARC_G3_REGNUM,
SPARC_G4_REGNUM,
SPARC_G5_REGNUM,
SPARC_G6_REGNUM,
SPARC_G7_REGNUM, /* %g7 */
SPARC_O0_REGNUM, /* %o0 */
SPARC_O1_REGNUM,
SPARC_O2_REGNUM,
SPARC_O3_REGNUM,
SPARC_O4_REGNUM,
SPARC_O5_REGNUM,
SPARC_SP_REGNUM, /* %sp (%o6) */
SPARC_O7_REGNUM, /* %o7 */
SPARC_L0_REGNUM, /* %l0 */
SPARC_L1_REGNUM,
SPARC_L2_REGNUM,
SPARC_L3_REGNUM,
SPARC_L4_REGNUM,
SPARC_L5_REGNUM,
SPARC_L6_REGNUM,
SPARC_L7_REGNUM, /* %l7 */
SPARC_I0_REGNUM, /* %i0 */
SPARC_I1_REGNUM,
SPARC_I2_REGNUM,
SPARC_I3_REGNUM,
SPARC_I4_REGNUM,
SPARC_I5_REGNUM,
SPARC_FP_REGNUM, /* %fp (%i6) */
SPARC_I7_REGNUM, /* %i7 */
SPARC_F0_REGNUM, /* %f0 */
SPARC_F31_REGNUM = SPARC_F0_REGNUM + 31 /* %f31 */
};
enum sparc64_regnum
{
SPARC64_F32_REGNUM = SPARC_F0_REGNUM + 32, /* %f32 */
SPARC64_F62_REGNUM = SPARC64_F32_REGNUM + 15, /* %f62 */
SPARC64_PC_REGNUM, /* %pc */
SPARC64_NPC_REGNUM, /* %npc */
SPARC64_STATE_REGNUM,
SPARC64_FSR_REGNUM, /* %fsr */
SPARC64_FPRS_REGNUM, /* %fprs */
SPARC64_Y_REGNUM, /* %y */
/* Pseudo registers. */
SPARC64_CWP_REGNUM, /* %cwp */
SPARC64_PSTATE_REGNUM, /* %pstate */
SPARC64_ASI_REGNUM, /* %asi */
SPARC64_CCR_REGNUM, /* %ccr */
SPARC64_D0_REGNUM, /* %d0 */
SPARC64_D10_REGNUM = SPARC64_D0_REGNUM + 5, /* %d10 */
SPARC64_D30_REGNUM = SPARC64_D0_REGNUM + 15, /* %d30 */
SPARC64_D32_REGNUM = SPARC64_D0_REGNUM + 16, /* %d30 */
SPARC64_D62_REGNUM = SPARC64_D0_REGNUM + 31, /* %d62 */
SPARC64_Q0_REGNUM, /* %q0 */
SPARC64_Q8_REGNUM = SPARC64_Q0_REGNUM + 2, /* %q8 */
SPARC64_Q28_REGNUM = SPARC64_Q0_REGNUM + 7, /* %q28 */
SPARC64_Q32_REGNUM = SPARC64_Q0_REGNUM + 8, /* %q32 */
SPARC64_Q60_REGNUM = SPARC64_Q0_REGNUM + 15 /* %q60 */
};
extern void sparc64_supply_rwindow (CORE_ADDR sp, int regnum);
extern void sparc64_fill_rwindow (CORE_ADDR sp, int regnum);
/* Functions exported from sparc64fbsd-tdep.c. */
extern void sparc64fbsd_supply_reg (const char *regs, int regnum);
extern void sparc64fbsd_fill_reg (char *regs, int regnum);
extern void sparc64fbsd_supply_fpreg (const char *regs, int regnum);
extern void sparc64fbsd_fill_fpreg (char *regs, int regnum);
#endif /* sparc64-tdep.h */

80
gdb/sparc64fbsd-nat.c Normal file
View File

@ -0,0 +1,80 @@
/* Native-dependent code for FreeBSD/sparc64.
Copyright 2003 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 "sparc64-tdep.h"
#include "sparcbsd-nat.h"
/* Determine whether `struct reg' contains register REGNUM. */
static int
sparc64fbsd_reg_supplies_p (int regnum)
{
/* Integer registers. */
if ((regnum >= SPARC_G0_REGNUM && regnum <= SPARC_G7_REGNUM)
|| (regnum >= SPARC_O0_REGNUM && regnum <= SPARC_O7_REGNUM)
|| (regnum >= SPARC_L0_REGNUM && regnum <= SPARC_L7_REGNUM)
|| (regnum >= SPARC_I0_REGNUM && regnum <= SPARC_I7_REGNUM))
return 1;
/* Control registers. */
if (regnum == SPARC64_PC_REGNUM
|| regnum == SPARC64_NPC_REGNUM
|| regnum == SPARC64_STATE_REGNUM
|| regnum == SPARC64_FPRS_REGNUM
|| regnum == SPARC64_Y_REGNUM)
return 1;
return 0;
}
/* Determine whether `struct fpreg' contains register REGNUM. */
static int
sparc64fbsd_fpreg_supplies_p (int regnum)
{
/* Floating-point registers. */
if ((regnum >= SPARC_F0_REGNUM && regnum <= SPARC_F31_REGNUM)
|| (regnum >= SPARC64_F32_REGNUM && regnum <= SPARC64_F62_REGNUM))
return 1;
/* Control registers. */
if (regnum == SPARC64_FSR_REGNUM)
return 1;
return 0;
}
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_sparc64fbsd_nat (void);
void
_initialize_sparc64fbsd_nat (void)
{
sparcbsd_supply_reg = sparc64fbsd_supply_reg;
sparcbsd_fill_reg = sparc64fbsd_fill_reg;
sparcbsd_supply_fpreg = sparc64fbsd_supply_fpreg;
sparcbsd_fill_fpreg = sparc64fbsd_fill_fpreg;
sparcbsd_reg_supplies_p = sparc64fbsd_reg_supplies_p;
sparcbsd_fpreg_supplies_p = sparc64fbsd_reg_supplies_p;
}

237
gdb/sparc64fbsd-tdep.c Normal file
View File

@ -0,0 +1,237 @@
/* Target-dependent code for FreeBSD/sparc64.
Copyright 2003 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 "gdbcore.h"
#include "osabi.h"
#include "regcache.h"
#include "target.h"
#include "gdb_string.h"
#include "sparc64-tdep.h"
/* From <machine/reg.h>. */
/* Offset of registers in `struct reg'. */
int sparc64fbsd_r_global_offset = (0 * 8);
int sparc64fbsd_r_out_offset = (8 * 8);
int sparc64fbsd_r_fprs_offset = (16 * 8);
int sparc64fbsd_r_tnpc_offset = (24 * 8);
int sparc64fbsd_r_tpc_offset = (25 * 8);
int sparc64fbsd_r_tstate_offset = (26 * 8);
int sparc64fbsd_r_y_offset = (28 * 8);
/* Size of `struct reg' and `struct fpreg'. */
int sparc64fbsd_sizeof_struct_reg = 256;
int sparc64fbsd_sizeof_struct_fpreg = 272;
void
sparc64fbsd_supply_reg (const char *regs, int regnum)
{
char buf[8];
int i;
if (regnum == SPARC64_PC_REGNUM || regnum == -1)
supply_register (SPARC64_PC_REGNUM, regs + sparc64fbsd_r_tpc_offset);
if (regnum == SPARC64_NPC_REGNUM || regnum == -1)
supply_register (SPARC64_NPC_REGNUM, regs + sparc64fbsd_r_tnpc_offset);
if (regnum == SPARC64_STATE_REGNUM || regnum == -1)
supply_register (SPARC64_STATE_REGNUM, regs + sparc64fbsd_r_tstate_offset);
if (regnum == SPARC64_FPRS_REGNUM || regnum == -1)
supply_register (SPARC64_FPRS_REGNUM, regs + sparc64fbsd_r_fprs_offset);
if (regnum == SPARC64_Y_REGNUM || regnum == -1)
supply_register (SPARC64_Y_REGNUM, regs + sparc64fbsd_r_y_offset);
if ((regnum >= SPARC_G0_REGNUM && regnum <= SPARC_G7_REGNUM) || regnum == -1)
{
if (regnum == SPARC_G0_REGNUM || regnum == -1)
supply_register (SPARC_G0_REGNUM, NULL); /* %g0 is always zero. */
for (i = SPARC_G1_REGNUM; i <= SPARC_G7_REGNUM; i++)
{
if (regnum == i || regnum == -1)
supply_register (i, (regs + sparc64fbsd_r_global_offset
+ ((i - SPARC_G0_REGNUM) * 8)));
}
}
if ((regnum >= SPARC_O0_REGNUM && regnum <= SPARC_O7_REGNUM) || regnum == -1)
{
for (i = SPARC_O0_REGNUM; i <= SPARC_O7_REGNUM; i++)
{
if (regnum == i || regnum == -1)
supply_register (i, (regs + sparc64fbsd_r_out_offset
+ ((i - SPARC_O0_REGNUM) * 8)));
}
}
/* Inputs and Locals are stored onto the stack by by the kernel. */
if ((regnum >= SPARC_L0_REGNUM && regnum <= SPARC_I7_REGNUM) || regnum == -1)
{
ULONGEST sp;
regcache_cooked_read_unsigned (current_regcache, SPARC_SP_REGNUM, &sp);
sparc64_supply_rwindow (sp, regnum);
}
}
void
sparc64fbsd_fill_reg (char *regs, int regnum)
{
char buf[8];
int i;
if (regnum == SPARC64_PC_REGNUM || regnum == -1)
regcache_collect (SPARC64_PC_REGNUM, regs + sparc64fbsd_r_tpc_offset);
if (regnum == SPARC64_NPC_REGNUM || regnum == -1)
regcache_collect (SPARC64_NPC_REGNUM, regs + sparc64fbsd_r_tnpc_offset);
if (regnum == SPARC64_FPRS_REGNUM || regnum == -1)
regcache_collect (SPARC64_FPRS_REGNUM, regs + sparc64fbsd_r_fprs_offset);
if (regnum == SPARC64_Y_REGNUM || regnum == -1)
regcache_collect (SPARC64_Y_REGNUM, regs + sparc64fbsd_r_y_offset);
if ((regnum >= SPARC_G0_REGNUM && regnum <= SPARC_G7_REGNUM) || regnum == -1)
{
/* %g0 is always zero. */
for (i = SPARC_G1_REGNUM; i <= SPARC_G7_REGNUM; i++)
{
if (regnum == i || regnum == -1)
regcache_collect (i, (regs + sparc64fbsd_r_global_offset
+ ((i - SPARC_G0_REGNUM) * 8)));
}
}
if ((regnum >= SPARC_O0_REGNUM && regnum <= SPARC_O7_REGNUM) || regnum == -1)
{
for (i = SPARC_O0_REGNUM; i <= SPARC_O7_REGNUM; i++)
{
if (regnum == i || regnum == -1)
regcache_collect (i, (regs + sparc64fbsd_r_out_offset
+ ((i - SPARC_O0_REGNUM) * 8)));
}
}
/* Responsibility for the stack regs is pushed off onto the caller. */
}
void
sparc64fbsd_supply_fpreg (const char *fpregs, int regnum)
{
int i;
for (i = 0; i < 32; i++)
{
if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
supply_register (SPARC_F0_REGNUM + i, fpregs + (i * 4));
}
for (i = 0; i < 16; i++)
{
if (regnum == (SPARC64_F32_REGNUM + i) || regnum == -1)
supply_register (SPARC64_F32_REGNUM + i, fpregs + (32 * 4) + (i * 8));
}
if (regnum == SPARC64_FSR_REGNUM || regnum == -1)
supply_register (SPARC64_FSR_REGNUM, fpregs + (32 * 4) + (16 * 8));
}
void
sparc64fbsd_fill_fpreg (char *fpregs, int regnum)
{
int i;
for (i = 0; i < 32; i++)
{
if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
regcache_collect (SPARC_F0_REGNUM + i, fpregs + (i * 4));
}
for (i = 0; i < 16; i++)
{
if (regnum == (SPARC64_F32_REGNUM + i) || regnum == -1)
regcache_collect (SPARC64_F32_REGNUM + i, fpregs + (32 * 4) + (i * 8));
}
if (regnum == SPARC64_FSR_REGNUM || regnum == -1)
regcache_collect (SPARC64_FSR_REGNUM, fpregs + (32 * 4) + (16 * 8));
}
static void
fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
CORE_ADDR ignore)
{
switch (which)
{
case 0: /* Integer registers */
if (core_reg_size != sparc64fbsd_sizeof_struct_reg)
warning ("Wrong size register set in core file.");
else
sparc64fbsd_supply_reg (core_reg_sect, -1);
break;
case 2: /* Floating pointer registers */
if (core_reg_size != sparc64fbsd_sizeof_struct_fpreg)
warning ("Wrong size FP register set in core file.");
else
sparc64fbsd_supply_fpreg (core_reg_sect, -1);
break;
default:
/* Don't know what kind of register request this is; just ignore it. */
break;
}
}
static struct core_fns sparc64fbsd_core_fns =
{
bfd_target_elf_flavour, /* core_flavour */
default_check_format, /* check_format */
default_core_sniffer, /* core_sniffer */
fetch_core_registers, /* core_read_registers */
NULL
};
static void
sparc64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
/* Nothing yet. */
}
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_sparc64fbsd_tdep (void);
void
_initialize_sparc64fbsd_tdep (void)
{
gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
GDB_OSABI_FREEBSD_ELF, sparc64fbsd_init_abi);
add_core_fns (&sparc64fbsd_core_fns);
}

126
gdb/sparcbsd-nat.c Normal file
View File

@ -0,0 +1,126 @@
/* Native-dependent code for SPARC BSD's.
Copyright 2002, 2003 Free Software Foundation, Inc.
Based on code contributed by Wasabi Systems, 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"
/* FIXME: Should be changed to sparc-tdep.h when the old code is gone. */
#include "sparc64-tdep.h"
#include "sparcbsd-nat.h"
#include <sys/types.h>
#include <sys/ptrace.h>
#include <machine/reg.h>
/* Functions translating between `struct reg' and `struct fpreg' and
GDB's register cache. */
void (*sparcbsd_supply_reg)(const char *, int);
void (*sparcbsd_fill_reg)(char *, int);
void (*sparcbsd_supply_fpreg)(const char *, int);
void (*sparcbsd_fill_fpreg)(char *, int);
/* Functions indication whether `struct reg' or `struct fpreg' provides
a certain register. */
int (*sparcbsd_reg_supplies_p)(int);
int (*sparcbsd_fpreg_supplies_p)(int);
void
fetch_inferior_registers (int regnum)
{
if (regnum == -1 || sparcbsd_reg_supplies_p (regnum))
{
struct reg regs;
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) &regs, 0) == -1)
perror_with_name ("Couldn't get registers");
sparcbsd_supply_reg ((char *) &regs, regnum);
if (regnum != -1)
return;
}
if (regnum == -1 || sparcbsd_fpreg_supplies_p (regnum))
{
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
perror_with_name ("Couldn't get floating-point registers");
sparcbsd_supply_fpreg ((char *) &fpregs, regnum);
if (regnum != -1)
return;
}
}
void
store_inferior_registers (int regnum)
{
if (regnum == -1 || sparcbsd_reg_supplies_p (regnum))
{
struct reg regs;
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) &regs, 0) == -1)
perror_with_name ("Couldn't get registers");
sparcbsd_fill_reg ((char *) &regs, regnum);
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) &regs, 0) == -1)
perror_with_name ("Couldn't write registers");
/* Deal with the stack regs. */
if (regnum == -1 || regnum == SPARC_SP_REGNUM
|| (regnum >= SPARC_L0_REGNUM && regnum <= SPARC_I7_REGNUM))
{
ULONGEST sp;
regcache_cooked_read_unsigned (current_regcache,
SPARC_SP_REGNUM, &sp);
sparc_fill_rwindow (sp, regnum);
}
if (regnum != -1)
return;
}
if (regnum == -1 || sparcbsd_fpreg_supplies_p (regnum))
{
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
perror_with_name ("Couldn't get floating-point registers");
sparcbsd_fill_fpreg ((char *) &fpregs, regnum);
if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
perror_with_name ("Couldn't write floating-point registers");
if (regnum != -1)
return;
}
}

37
gdb/sparcbsd-nat.h Normal file
View File

@ -0,0 +1,37 @@
/* Native-dependent code for SPARC BSD's.
Copyright 2003 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 SPARCBSD_NAT_H
#define SPARCBSD_NAT_H
/* Functions translating between `struct reg' and `struct fpreg' and
GDB's register cache. */
extern void (*sparcbsd_supply_reg)(const char *, int);
extern void (*sparcbsd_fill_reg)(char *, int);
extern void (*sparcbsd_supply_fpreg)(const char *, int);
extern void (*sparcbsd_fill_fpreg)(char *, int);
/* Functions indication whether `struct reg' or `struct fpreg' provides
a certain register. */
extern int (*sparcbsd_reg_supplies_p)(int);
extern int (*sparcbsd_fpreg_supplies_p)(int);
#endif /* sparcbsd-nat.h */