* acconfig.h (HAVE_PT_GETXMMREGS): New.
* config.in: Regenerate. * configure.in: Update copyright years. Add test for PT_GETXMMREGS supplied by <sys/ptrace.h>. * configure: Regenerate. * i386bsd-nat.c: Update copyright years. (fill_gregset): Use regcache_collect. (fetch_inferior_registers): Only fetch integer registers if requested to do so. Add support for XMM registers using PT_GETXMMREGS. (store_inferior_registers): Only store integer registers if requested to do so. Add support for XMM registers using PT_SETXMMREGS. * i386nbsd-nat.c (fetch_inferior_registers): Remove. (store_inferior_registers): Remove. (fetch_core_registers): Use supply_gregset and i387_supply_fsave. (fetch_elfcore_registers): New function. (i386nbsd_elfcore_fns): New. (_initialize_i386nbsd_nat): Register i386nbsd_elfcore_fns. * config/i386/nbsd.mh (NATDEPFILES): Add i387-nat.o and i386bsd-nat.o. * config/i386/nbsdelf.mh (NATDEPFILES): Likewise. * config/i386/nbsd.mt (TDEPFILES): Add i386bsd-nat.o. * config/i386/nbsdelf.mt (TDEPFILES): Likewise. * config/i386/tm-nbsd.h: Update copyright years. (HAVE_SSE_REGS): Define. (IN_SIGTRAMP): Define as i386bsd_in_sigtramp. (SIGTRAMP_START): Redefine as i386bsd_sigtramp_start. (SIGTRAMP_END): Redefine as i386bsd_sigtramp_end. (SIGCONTEXT_PC_OFFSET): Remove. (FRAME_SAVED_PC): Define as i386bsd_frame_saved_pc.
This commit is contained in:
parent
3dfe7a8c3a
commit
7e89e3575d
@ -1,3 +1,37 @@
|
||||
2002-01-05 Jason Thorpe <thorpej@wasabisystems.com>
|
||||
|
||||
* acconfig.h (HAVE_PT_GETXMMREGS): New.
|
||||
* config.in: Regenerate.
|
||||
* configure.in: Update copyright years.
|
||||
Add test for PT_GETXMMREGS supplied by <sys/ptrace.h>.
|
||||
* configure: Regenerate.
|
||||
* i386bsd-nat.c: Update copyright years.
|
||||
(fill_gregset): Use regcache_collect.
|
||||
(fetch_inferior_registers): Only fetch integer registers
|
||||
if requested to do so. Add support for XMM registers
|
||||
using PT_GETXMMREGS.
|
||||
(store_inferior_registers): Only store integer registers
|
||||
if requested to do so. Add support for XMM registers
|
||||
using PT_SETXMMREGS.
|
||||
* i386nbsd-nat.c (fetch_inferior_registers): Remove.
|
||||
(store_inferior_registers): Remove.
|
||||
(fetch_core_registers): Use supply_gregset and i387_supply_fsave.
|
||||
(fetch_elfcore_registers): New function.
|
||||
(i386nbsd_elfcore_fns): New.
|
||||
(_initialize_i386nbsd_nat): Register i386nbsd_elfcore_fns.
|
||||
* config/i386/nbsd.mh (NATDEPFILES): Add i387-nat.o and
|
||||
i386bsd-nat.o.
|
||||
* config/i386/nbsdelf.mh (NATDEPFILES): Likewise.
|
||||
* config/i386/nbsd.mt (TDEPFILES): Add i386bsd-nat.o.
|
||||
* config/i386/nbsdelf.mt (TDEPFILES): Likewise.
|
||||
* config/i386/tm-nbsd.h: Update copyright years.
|
||||
(HAVE_SSE_REGS): Define.
|
||||
(IN_SIGTRAMP): Define as i386bsd_in_sigtramp.
|
||||
(SIGTRAMP_START): Redefine as i386bsd_sigtramp_start.
|
||||
(SIGTRAMP_END): Redefine as i386bsd_sigtramp_end.
|
||||
(SIGCONTEXT_PC_OFFSET): Remove.
|
||||
(FRAME_SAVED_PC): Define as i386bsd_frame_saved_pc.
|
||||
|
||||
2002-01-05 Andrew Cagney <ac131313@redhat.com>
|
||||
|
||||
* configure.tgt: Remove powerpc-*-macos* target.
|
||||
|
@ -150,6 +150,9 @@
|
||||
/* Define if <sys/ptrace.h> defines the PT_GETDBREGS request. */
|
||||
#undef HAVE_PT_GETDBREGS
|
||||
|
||||
/* Define if <sys/ptrace.h> defines the PT_GETXMMREGS request. */
|
||||
#undef HAVE_PT_GETXMMREGS
|
||||
|
||||
/* Define if gnu-regex.c included with GDB should be used. */
|
||||
#undef USE_INCLUDED_REGEX
|
||||
|
||||
|
@ -160,6 +160,9 @@
|
||||
/* Define if <sys/ptrace.h> defines the PT_GETDBREGS request. */
|
||||
#undef HAVE_PT_GETDBREGS
|
||||
|
||||
/* Define if <sys/ptrace.h> defines the PT_GETXMMREGS request. */
|
||||
#undef HAVE_PT_GETXMMREGS
|
||||
|
||||
/* Define if gnu-regex.c included with GDB should be used. */
|
||||
#undef USE_INCLUDED_REGEX
|
||||
|
||||
@ -343,12 +346,12 @@
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
/* Define if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define if you have the <sys/filio.h> header file. */
|
||||
#undef HAVE_SYS_FILIO_H
|
||||
|
||||
/* Define if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
|
@ -7,7 +7,7 @@ XDEPFILES=
|
||||
# continuation character (backslash) to extend a commented line. As a
|
||||
# consequence, BSD make considers subsequent tab-indented lines to be
|
||||
# "unassociated shell commands".
|
||||
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o solib.o solib-sunos.o
|
||||
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i387-nat.o i386bsd-nat.o i386nbsd-nat.o solib.o solib-sunos.o
|
||||
|
||||
XM_FILE= xm-nbsd.h
|
||||
NAT_FILE= nm-nbsd.h
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Target: Intel 386 running NetBSD
|
||||
TDEPFILES= i386-tdep.o i387-tdep.o i386nbsd-tdep.o
|
||||
TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o
|
||||
TM_FILE= tm-nbsd.h
|
||||
|
||||
GDBSERVER_DEPFILES= low-nbsd.o
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Host: Intel 386 running NetBSD
|
||||
XDEPFILES=
|
||||
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o solib.o solib-svr4.o solib-legacy.o
|
||||
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i387-nat.o i386bsd-nat.o i386nbsd-nat.o solib.o solib-svr4.o solib-legacy.o
|
||||
XM_FILE= xm-nbsd.h
|
||||
NAT_FILE= nm-nbsdelf.h
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Target: Intel 386 running NetBSD
|
||||
TDEPFILES= i386-tdep.o i387-tdep.o
|
||||
TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o
|
||||
TM_FILE= tm-nbsdelf.h
|
||||
|
||||
GDBSERVER_DEPFILES= low-nbsd.o
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Macro definitions for i386 running under NetBSD.
|
||||
Copyright 1994, 1996, 2000 Free Software Foundation, Inc.
|
||||
Copyright 1994, 1996, 2000, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#define TM_NBSD_H
|
||||
|
||||
#define HAVE_I387_REGS
|
||||
#define HAVE_SSE_REGS
|
||||
|
||||
#include "i386/tm-i386.h"
|
||||
#include "config/tm-nbsd.h"
|
||||
@ -46,13 +47,24 @@ extern int get_longjmp_target (CORE_ADDR *);
|
||||
|
||||
/* Support for signal handlers. */
|
||||
|
||||
/* The sigtramp is above the user stack and immediately below the
|
||||
user area. Using constants here allows for cross debugging. */
|
||||
#define IN_SIGTRAMP(pc, name) i386bsd_in_sigtramp (pc, name)
|
||||
extern int i386bsd_in_sigtramp (CORE_ADDR pc, char *name);
|
||||
|
||||
#define SIGTRAMP_START(pc) 0xbfbfdf20
|
||||
#define SIGTRAMP_END(pc) 0xbfbfdff0
|
||||
/* These defines allow the recognition of sigtramps as a function name
|
||||
<sigtramp>.
|
||||
|
||||
/* Offset to saved PC in sigcontext, from <sys/signal.h>. */
|
||||
#define SIGCONTEXT_PC_OFFSET 20
|
||||
FIXME: kettenis/2001-07-13: These should be added to the target
|
||||
vector and turned into functions when we go "multi-arch". */
|
||||
|
||||
#define SIGTRAMP_START(pc) i386bsd_sigtramp_start
|
||||
#define SIGTRAMP_END(pc) i386bsd_sigtramp_end
|
||||
extern CORE_ADDR i386bsd_sigtramp_start;
|
||||
extern CORE_ADDR i386bsd_sigtramp_end;
|
||||
|
||||
/* Override FRAME_SAVED_PC to enable the recognition of signal handlers. */
|
||||
|
||||
#undef FRAME_SAVED_PC
|
||||
#define FRAME_SAVED_PC(frame) i386bsd_frame_saved_pc (frame)
|
||||
extern CORE_ADDR i386bsd_frame_saved_pc (struct frame_info *frame);
|
||||
|
||||
#endif /* TM_NBSD_H */
|
||||
|
814
gdb/configure
vendored
814
gdb/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
dnl Autoconf configure script for GDB, the GNU debugger.
|
||||
dnl Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
dnl Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
dnl Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GDB.
|
||||
@ -217,6 +217,19 @@ if test $gdb_cv_have_pt_getdbregs = yes; then
|
||||
AC_DEFINE(HAVE_PT_GETDBREGS)
|
||||
fi
|
||||
|
||||
# See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
|
||||
AC_MSG_CHECKING(for PT_GETXMMREGS)
|
||||
AC_CACHE_VAL(gdb_cv_have_pt_getxmmregs,
|
||||
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/ptrace.h>],
|
||||
[PT_GETXMMREGS;],
|
||||
[gdb_cv_have_pt_getxmmregs=yes],
|
||||
[gdb_cv_have_pt_getxmmregs=no])])
|
||||
AC_MSG_RESULT($gdb_cv_have_pt_getxmmregs)
|
||||
if test $gdb_cv_have_pt_getxmmregs = yes; then
|
||||
AC_DEFINE(HAVE_PT_GETXMMREGS)
|
||||
fi
|
||||
|
||||
|
||||
AC_CHECK_LIB(socket, socketpair)
|
||||
AC_CHECK_FUNCS(socketpair)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Native-dependent code for modern i386 BSD's.
|
||||
Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
@ -96,6 +96,16 @@ static int reg_offset[] =
|
||||
|
||||
#define REG_ADDR(regset, regno) ((char *) (regset) + reg_offset[regno])
|
||||
|
||||
/* Macro to determine if a register is fetched with PT_GETREGS. */
|
||||
#define GETREGS_SUPPLIES(regno) \
|
||||
((0 <= (regno) && (regno) <= 15))
|
||||
|
||||
#ifdef HAVE_PT_GETXMMREGS
|
||||
/* Set to 1 if the kernel supports PT_GETXMMREGS. Initialized to -1
|
||||
so that we try PT_GETXMMREGS the first time around. */
|
||||
static int have_ptrace_xmmregs = -1;
|
||||
#endif
|
||||
|
||||
/* Return nonzero if we shouldn't try to fetch register REGNO. */
|
||||
|
||||
static int
|
||||
@ -135,8 +145,7 @@ fill_gregset (gregset_t *gregsetp, int regno)
|
||||
|
||||
for (i = 0; i < NUM_GREGS; i++)
|
||||
if ((regno == -1 || regno == i) && ! CANNOT_STORE_REGISTER (i))
|
||||
memcpy (REG_ADDR (gregsetp, i), ®isters[REGISTER_BYTE (i)],
|
||||
REGISTER_RAW_SIZE (i));
|
||||
regcache_collect (i, REG_ADDR (gregsetp, i));
|
||||
}
|
||||
|
||||
#include "i387-nat.h"
|
||||
@ -166,23 +175,48 @@ fill_fpregset (fpregset_t *fpregsetp, int regno)
|
||||
void
|
||||
fetch_inferior_registers (int regno)
|
||||
{
|
||||
gregset_t gregs;
|
||||
|
||||
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &gregs, 0) == -1)
|
||||
perror_with_name ("Couldn't get registers");
|
||||
if (regno == -1 || GETREGS_SUPPLIES (regno))
|
||||
{
|
||||
gregset_t gregs;
|
||||
|
||||
supply_gregset (&gregs);
|
||||
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &gregs, 0) == -1)
|
||||
perror_with_name ("Couldn't get registers");
|
||||
|
||||
supply_gregset (&gregs);
|
||||
if (regno != -1)
|
||||
return;
|
||||
}
|
||||
|
||||
if (regno == -1 || regno >= FP0_REGNUM)
|
||||
{
|
||||
fpregset_t fpregs;
|
||||
#ifdef HAVE_PT_GETXMMREGS
|
||||
char xmmregs[512];
|
||||
|
||||
if (have_ptrace_xmmregs != 0 &&
|
||||
ptrace(PT_GETXMMREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) xmmregs, 0) == 0)
|
||||
{
|
||||
have_ptrace_xmmregs = 1;
|
||||
i387_supply_fxsave (xmmregs);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
|
||||
perror_with_name ("Couldn't get floating point status");
|
||||
|
||||
supply_fpregset (&fpregs);
|
||||
}
|
||||
#else
|
||||
if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
|
||||
perror_with_name ("Couldn't get floating point status");
|
||||
|
||||
supply_fpregset (&fpregs);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -192,31 +226,59 @@ fetch_inferior_registers (int regno)
|
||||
void
|
||||
store_inferior_registers (int regno)
|
||||
{
|
||||
gregset_t gregs;
|
||||
|
||||
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &gregs, 0) == -1)
|
||||
perror_with_name ("Couldn't get registers");
|
||||
if (regno == -1 || GETREGS_SUPPLIES (regno))
|
||||
{
|
||||
gregset_t gregs;
|
||||
|
||||
fill_gregset (&gregs, regno);
|
||||
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &gregs, 0) == -1)
|
||||
perror_with_name ("Couldn't get registers");
|
||||
|
||||
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &gregs, 0) == -1)
|
||||
perror_with_name ("Couldn't write registers");
|
||||
fill_gregset (&gregs, regno);
|
||||
|
||||
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &gregs, 0) == -1)
|
||||
perror_with_name ("Couldn't write registers");
|
||||
|
||||
if (regno != -1)
|
||||
return;
|
||||
}
|
||||
|
||||
if (regno == -1 || regno >= FP0_REGNUM)
|
||||
{
|
||||
fpregset_t fpregs;
|
||||
#ifdef HAVE_PT_GETXMMREGS
|
||||
char xmmregs[512];
|
||||
|
||||
if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
|
||||
perror_with_name ("Couldn't get floating point status");
|
||||
if (have_ptrace_xmmregs != 0 &&
|
||||
ptrace(PT_GETXMMREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) xmmregs, 0) == 0)
|
||||
{
|
||||
have_ptrace_xmmregs = 1;
|
||||
|
||||
fill_fpregset (&fpregs, regno);
|
||||
i387_fill_fxsave (xmmregs, regno);
|
||||
|
||||
if (ptrace (PT_SETXMMREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) xmmregs, 0) == -1)
|
||||
perror_with_name ("Couldn't write XMM registers");
|
||||
}
|
||||
else
|
||||
{
|
||||
have_ptrace_xmmregs = 0;
|
||||
#endif
|
||||
if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
|
||||
perror_with_name ("Couldn't get floating point status");
|
||||
|
||||
fill_fpregset (&fpregs, regno);
|
||||
|
||||
if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
|
||||
perror_with_name ("Couldn't write floating point status");
|
||||
if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
|
||||
perror_with_name ("Couldn't write floating point status");
|
||||
#ifdef HAVE_PT_GETXMMREGS
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,136 +25,26 @@
|
||||
#include <machine/reg.h>
|
||||
#include <machine/frame.h>
|
||||
#include "inferior.h"
|
||||
#include "gdbcore.h" /* for registers_fetched() */
|
||||
#include "gdbcore.h"
|
||||
#include "regcache.h"
|
||||
|
||||
/* Defines for XMM0_REGNUM etc. */
|
||||
#include "i386-tdep.h"
|
||||
#ifndef HAVE_GREGSET_T
|
||||
typedef struct reg gregset_t;
|
||||
#endif
|
||||
|
||||
#define RF(dst, src) \
|
||||
memcpy(®isters[REGISTER_BYTE(dst)], &src, sizeof(src))
|
||||
#ifndef HAVE_FPREGSET_T
|
||||
typedef struct fpreg fpregset_t;
|
||||
#endif
|
||||
|
||||
#define RS(src, dst) \
|
||||
memcpy(&dst, ®isters[REGISTER_BYTE(src)], sizeof(dst))
|
||||
|
||||
struct env387
|
||||
{
|
||||
unsigned short control;
|
||||
unsigned short r0;
|
||||
unsigned short status;
|
||||
unsigned short r1;
|
||||
unsigned short tag;
|
||||
unsigned short r2;
|
||||
unsigned long eip;
|
||||
unsigned short code_seg;
|
||||
unsigned short opcode;
|
||||
unsigned long operand;
|
||||
unsigned short operand_seg;
|
||||
unsigned short r3;
|
||||
unsigned char regs[8][10];
|
||||
};
|
||||
#include "gregset.h"
|
||||
|
||||
void
|
||||
fetch_inferior_registers (int regno)
|
||||
{
|
||||
struct reg inferior_registers;
|
||||
struct env387 inferior_fpregisters;
|
||||
/* Prototypes for i387_supply_fsave etc. */
|
||||
#include "i387-nat.h"
|
||||
|
||||
ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
|
||||
ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_fpregisters, 0);
|
||||
|
||||
RF ( 0, inferior_registers.r_eax);
|
||||
RF ( 1, inferior_registers.r_ecx);
|
||||
RF ( 2, inferior_registers.r_edx);
|
||||
RF ( 3, inferior_registers.r_ebx);
|
||||
RF ( 4, inferior_registers.r_esp);
|
||||
RF ( 5, inferior_registers.r_ebp);
|
||||
RF ( 6, inferior_registers.r_esi);
|
||||
RF ( 7, inferior_registers.r_edi);
|
||||
RF ( 8, inferior_registers.r_eip);
|
||||
RF ( 9, inferior_registers.r_eflags);
|
||||
RF (10, inferior_registers.r_cs);
|
||||
RF (11, inferior_registers.r_ss);
|
||||
RF (12, inferior_registers.r_ds);
|
||||
RF (13, inferior_registers.r_es);
|
||||
RF (14, inferior_registers.r_fs);
|
||||
RF (15, inferior_registers.r_gs);
|
||||
|
||||
RF (FP0_REGNUM, inferior_fpregisters.regs[0]);
|
||||
RF (FP0_REGNUM + 1, inferior_fpregisters.regs[1]);
|
||||
RF (FP0_REGNUM + 2, inferior_fpregisters.regs[2]);
|
||||
RF (FP0_REGNUM + 3, inferior_fpregisters.regs[3]);
|
||||
RF (FP0_REGNUM + 4, inferior_fpregisters.regs[4]);
|
||||
RF (FP0_REGNUM + 5, inferior_fpregisters.regs[5]);
|
||||
RF (FP0_REGNUM + 6, inferior_fpregisters.regs[6]);
|
||||
RF (FP0_REGNUM + 7, inferior_fpregisters.regs[7]);
|
||||
|
||||
RF (FCTRL_REGNUM, inferior_fpregisters.control);
|
||||
RF (FSTAT_REGNUM, inferior_fpregisters.status);
|
||||
RF (FTAG_REGNUM, inferior_fpregisters.tag);
|
||||
RF (FCS_REGNUM, inferior_fpregisters.code_seg);
|
||||
RF (FCOFF_REGNUM, inferior_fpregisters.eip);
|
||||
RF (FDS_REGNUM, inferior_fpregisters.operand_seg);
|
||||
RF (FDOFF_REGNUM, inferior_fpregisters.operand);
|
||||
RF (FOP_REGNUM, inferior_fpregisters.opcode);
|
||||
|
||||
registers_fetched ();
|
||||
}
|
||||
|
||||
void
|
||||
store_inferior_registers (int regno)
|
||||
{
|
||||
struct reg inferior_registers;
|
||||
struct env387 inferior_fpregisters;
|
||||
|
||||
RS ( 0, inferior_registers.r_eax);
|
||||
RS ( 1, inferior_registers.r_ecx);
|
||||
RS ( 2, inferior_registers.r_edx);
|
||||
RS ( 3, inferior_registers.r_ebx);
|
||||
RS ( 4, inferior_registers.r_esp);
|
||||
RS ( 5, inferior_registers.r_ebp);
|
||||
RS ( 6, inferior_registers.r_esi);
|
||||
RS ( 7, inferior_registers.r_edi);
|
||||
RS ( 8, inferior_registers.r_eip);
|
||||
RS ( 9, inferior_registers.r_eflags);
|
||||
RS (10, inferior_registers.r_cs);
|
||||
RS (11, inferior_registers.r_ss);
|
||||
RS (12, inferior_registers.r_ds);
|
||||
RS (13, inferior_registers.r_es);
|
||||
RS (14, inferior_registers.r_fs);
|
||||
RS (15, inferior_registers.r_gs);
|
||||
|
||||
|
||||
RS (FP0_REGNUM, inferior_fpregisters.regs[0]);
|
||||
RS (FP0_REGNUM + 1, inferior_fpregisters.regs[1]);
|
||||
RS (FP0_REGNUM + 2, inferior_fpregisters.regs[2]);
|
||||
RS (FP0_REGNUM + 3, inferior_fpregisters.regs[3]);
|
||||
RS (FP0_REGNUM + 4, inferior_fpregisters.regs[4]);
|
||||
RS (FP0_REGNUM + 5, inferior_fpregisters.regs[5]);
|
||||
RS (FP0_REGNUM + 6, inferior_fpregisters.regs[6]);
|
||||
RS (FP0_REGNUM + 7, inferior_fpregisters.regs[7]);
|
||||
|
||||
RS (FCTRL_REGNUM, inferior_fpregisters.control);
|
||||
RS (FSTAT_REGNUM, inferior_fpregisters.status);
|
||||
RS (FTAG_REGNUM, inferior_fpregisters.tag);
|
||||
RS (FCS_REGNUM, inferior_fpregisters.code_seg);
|
||||
RS (FCOFF_REGNUM, inferior_fpregisters.eip);
|
||||
RS (FDS_REGNUM, inferior_fpregisters.operand_seg);
|
||||
RS (FDOFF_REGNUM, inferior_fpregisters.operand);
|
||||
RS (FOP_REGNUM, inferior_fpregisters.opcode);
|
||||
|
||||
ptrace (PT_SETREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
|
||||
ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
|
||||
(PTRACE_ARG3_TYPE) &inferior_fpregisters, 0);
|
||||
}
|
||||
|
||||
struct md_core
|
||||
{
|
||||
struct reg intreg;
|
||||
struct env387 freg;
|
||||
char freg[108];
|
||||
};
|
||||
|
||||
static void
|
||||
@ -163,30 +53,54 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
|
||||
{
|
||||
struct md_core *core_reg = (struct md_core *) core_reg_sect;
|
||||
|
||||
/* integer registers */
|
||||
memcpy (®isters[REGISTER_BYTE (0)], &core_reg->intreg,
|
||||
sizeof (struct reg));
|
||||
/* We get everything from one section. */
|
||||
if (which != 0)
|
||||
return;
|
||||
|
||||
/* floating point registers */
|
||||
RF (FP0_REGNUM, core_reg->freg.regs[0]);
|
||||
RF (FP0_REGNUM + 1, core_reg->freg.regs[1]);
|
||||
RF (FP0_REGNUM + 2, core_reg->freg.regs[2]);
|
||||
RF (FP0_REGNUM + 3, core_reg->freg.regs[3]);
|
||||
RF (FP0_REGNUM + 4, core_reg->freg.regs[4]);
|
||||
RF (FP0_REGNUM + 5, core_reg->freg.regs[5]);
|
||||
RF (FP0_REGNUM + 6, core_reg->freg.regs[6]);
|
||||
RF (FP0_REGNUM + 7, core_reg->freg.regs[7]);
|
||||
/* Integer registers. */
|
||||
supply_gregset (&core_reg->intreg);
|
||||
|
||||
RF (FCTRL_REGNUM, core_reg->freg.control);
|
||||
RF (FSTAT_REGNUM, core_reg->freg.status);
|
||||
RF (FTAG_REGNUM, core_reg->freg.tag);
|
||||
RF (FCS_REGNUM, core_reg->freg.code_seg);
|
||||
RF (FCOFF_REGNUM, core_reg->freg.eip);
|
||||
RF (FDS_REGNUM, core_reg->freg.operand_seg);
|
||||
RF (FDOFF_REGNUM, core_reg->freg.operand);
|
||||
RF (FOP_REGNUM, core_reg->freg.opcode);
|
||||
/* Floating point registers. */
|
||||
i387_supply_fsave (core_reg->freg);
|
||||
}
|
||||
|
||||
registers_fetched ();
|
||||
static void
|
||||
fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, int which,
|
||||
CORE_ADDR ignore)
|
||||
{
|
||||
gregset_t gregset;
|
||||
|
||||
switch (which)
|
||||
{
|
||||
case 0: /* Integer registers. */
|
||||
if (core_reg_size != sizeof (struct reg))
|
||||
warning ("Wrong size register set in core file.");
|
||||
else
|
||||
{
|
||||
memcpy (&gregset, core_reg_sect, sizeof (gregset));
|
||||
supply_gregset (&gregset);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: /* Floating point registers. */
|
||||
if (core_reg_size != 108)
|
||||
warning ("Wrong size FP register set in core file.");
|
||||
else
|
||||
i387_supply_fsave (core_reg_sect);
|
||||
break;
|
||||
|
||||
case 3: /* "Extended" floating point registers. This is gdb-speak
|
||||
for SSE/SSE2. */
|
||||
if (core_reg_size != 512)
|
||||
warning ("Wrong size XMM register set in core file.");
|
||||
else
|
||||
i387_supply_fxsave (core_reg_sect);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Don't know what kind of register request this is; just ignore it. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Register that we are able to handle i386nbsd core file formats.
|
||||
@ -201,8 +115,18 @@ static struct core_fns i386nbsd_core_fns =
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
static struct core_fns i386nbsd_elfcore_fns =
|
||||
{
|
||||
bfd_target_elf_flavour, /* core_flavour */
|
||||
default_check_format, /* check_format */
|
||||
default_core_sniffer, /* core_sniffer */
|
||||
fetch_elfcore_registers, /* core_read_registers */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
void
|
||||
_initialize_i386nbsd_nat (void)
|
||||
{
|
||||
add_core_fns (&i386nbsd_core_fns);
|
||||
add_core_fns (&i386nbsd_elfcore_fns);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user