* [patch] Overhaul i386nbsd-nat.c, add support for XMM + ELF core files
@ 2002-01-04 16:08 Jason R Thorpe
2002-01-04 16:41 ` Mark Kettenis
0 siblings, 1 reply; 8+ messages in thread
From: Jason R Thorpe @ 2002-01-04 16:08 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]
The following patch overhauls i386nbsd-nat.c, using new interfaces to
access the gdb regcache, and adds support for XMM registers and ELF
format NetBSD core files.
[ for gdb/ChangeLog ]
2002-01-04 Jason Thorpe <thorpej@wasabisystems.com>
* i386nbsd-nat.c (supply_regs): New function.
(fetch_inferior_registers): Use supply_regs to
provide integer registers. Use i387_supply_fsave
to supply FP registers. Add support for XMM
registers using PT_GETXMMREGS and i387_supply_fxsave.
(store_inferior_registers): Use regcache_collect
for integer registers. Use i387_fill_fsave for
FP registers. Add support for XMM registers
using i387_fill_fxsave and PT_SETXMMREGS.
(fetch_core_registers): Use supply_regs for
integer registers and i387_supply_fsave for
FP registers.
(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.
* config/i386/nbsdelf.mh (NATDEPFILES): Likewise.
* config/i386/tm-nbsd.h: Update copyright years.
(HAVE_SSE_REGS): Define.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
[-- Attachment #2: patch3 --]
[-- Type: text/plain, Size: 14238 bytes --]
Index: i386nbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386nbsd-nat.c,v
retrieving revision 1.9
diff -c -r1.9 i386nbsd-nat.c
*** i386nbsd-nat.c 2002/01/04 22:43:31 1.9
--- i386nbsd-nat.c 2002/01/04 23:54:54
***************
*** 25,160 ****
#include <machine/reg.h>
#include <machine/frame.h>
#include "inferior.h"
! #include "gdbcore.h" /* for registers_fetched() */
#include "regcache.h"
/* Defines for XMM0_REGNUM etc. */
#include "i386-tdep.h"
! #define RF(dst, src) \
! memcpy(®isters[REGISTER_BYTE(dst)], &src, sizeof(src))
! #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];
! };
void
fetch_inferior_registers (int regno)
{
struct reg inferior_registers;
! struct env387 inferior_fpregisters;
!
! 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);
}
\f
struct md_core
{
struct reg intreg;
! struct env387 freg;
};
static void
--- 25,175 ----
#include <machine/reg.h>
#include <machine/frame.h>
#include "inferior.h"
! #include "gdbcore.h"
#include "regcache.h"
+ /* Prototypes for i387_supply_fsave etc. */
+ #include "i387-nat.h"
+
/* Defines for XMM0_REGNUM etc. */
#include "i386-tdep.h"
+
+ #ifdef PT_GETXMMREGS
+ static int have_ptrace_xmmregs = -1;
+ #endif
+
+ /* Offsets of the registers in the "reg" structure, indexed by
+ GDB register array index. */
+ static int regmap[] =
+ {
+ 0x00 /* eax */,
+ 0x04 /* ecx */,
+ 0x08 /* edx */,
+ 0x0c /* ebx */,
+ 0x10 /* esp */,
+ 0x14 /* ebp */,
+ 0x18 /* esi */,
+ 0x1c /* edi */,
+ 0x20 /* eip */,
+ 0x24 /* eflags */,
+ 0x28 /* cs */,
+ 0x2c /* ss */,
+ 0x30 /* ds */,
+ 0x34 /* es */,
+ 0x38 /* fs */,
+ 0x3c /* gs */,
+ };
! /* Macro to determine if a register is fetched with PT_GETREGS. */
! #define GETREGS_SUPPLIES(regno) \
! ((0 <= (regno) && (regno) <= 15))
! static void
! supply_regs (char *regs)
! {
! int regno;
+ for (regno = 0; regno < 16; regno++)
+ supply_register (regno, regs + regmap[regno]);
+ }
+
void
fetch_inferior_registers (int regno)
{
struct reg inferior_registers;
! char inferior_fpregisters[108];
! #ifdef PT_GETXMMREGS
! char inferior_xmmregisters[512];
! #endif
!
! if (regno == -1 || GETREGS_SUPPLIES (regno))
! {
! ptrace (PT_GETREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) &inferior_registers, 0);
! supply_regs ((char *) &inferior_registers);
! if (regno != -1)
! return;
! }
!
! #ifdef PT_GETXMMREGS
! if (have_ptrace_xmmregs != 0 &&
! ptrace(PT_GETXMMREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) inferior_xmmregisters, 0) == 0)
! {
! have_ptrace_xmmregs = 1;
! i387_supply_fxsave (inferior_xmmregisters);
! }
! else
! {
! ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) inferior_fpregisters, 0);
! have_ptrace_xmmregs = 0;
! i387_supply_fsave ((char *) inferior_fpregisters);
! }
! #else
ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) inferior_fpregisters, 0);
! i387_supply_fsave ((char *) inferior_fpregisters);
! #endif
}
void
store_inferior_registers (int regno)
{
struct reg inferior_registers;
! char *regs = (char *) &inferior_registers;
! char inferior_fpregisters[108];
! #ifdef PT_GETXMMREGS
! char inferior_xmmregisters[512];
! #endif
! int i;
!
! if (regno == -1 || GETREGS_SUPPLIES (regno))
! {
! ptrace(PT_GETREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) &inferior_registers, 0);
!
! for (i = 0; i < 16; i++)
! {
! if (regno == -1 || regno == i)
! regcache_collect (i, regs + regmap[i]);
! }
!
! ptrace (PT_SETREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) &inferior_registers, 0);
!
! if (regno != -1)
! return;
! }
!
! #ifdef PT_GETXMMREGS
! if (have_ptrace_xmmregs != 0 &&
! ptrace(PT_GETXMMREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) inferior_xmmregisters, 0) == 0)
! {
! have_ptrace_xmmregs = 1;
! i387_fill_fxsave (inferior_xmmregisters, regno);
! ptrace (PT_SETXMMREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) inferior_xmmregisters, 0);
! }
! else
! {
! have_ptrace_xmmregs = 0;
! #endif
! ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) inferior_fpregisters, 0);
! i387_fill_fsave (inferior_fpregisters, regno);
! ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) inferior_fpregisters, 0);
! #ifdef PT_GETXMMREGS
! }
! #endif
}
\f
struct md_core
{
struct reg intreg;
! char freg[108];
};
static void
***************
*** 163,192 ****
{
struct md_core *core_reg = (struct md_core *) core_reg_sect;
! /* integer registers */
! memcpy (®isters[REGISTER_BYTE (0)], &core_reg->intreg,
! sizeof (struct reg));
!
! /* 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]);
!
! 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);
! registers_fetched ();
}
/* Register that we are able to handle i386nbsd core file formats.
--- 178,226 ----
{
struct md_core *core_reg = (struct md_core *) core_reg_sect;
! /* We get everything from one section. */
! if (which != 0)
! return;
! /* Integer registers. */
! supply_regs ((char *) &core_reg->intreg);
!
! /* Floating point registers. */
! i387_supply_fsave (core_reg->freg);
! }
!
! static void
! fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, int which,
! CORE_ADDR ignore)
! {
! switch (which)
! {
! case 0: /* Integer registers. */
! if (core_reg_size != sizeof (struct reg))
! warning ("Wrong size register set in core file.");
! else
! supply_regs (core_reg_sect);
! 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,208 ****
--- 235,252 ----
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);
}
Index: config/i386/nbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nbsd.mh,v
retrieving revision 1.10
diff -c -r1.10 nbsd.mh
*** nbsd.mh 2001/10/02 23:11:21 1.10
--- nbsd.mh 2002/01/04 23:54:55
***************
*** 7,13 ****
# 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
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
--- 7,13 ----
# 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 i387-nat.o i386nbsd-nat.o solib.o solib-sunos.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
Index: config/i386/nbsdelf.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nbsdelf.mh,v
retrieving revision 1.6
diff -c -r1.6 nbsdelf.mh
*** nbsdelf.mh 2001/03/10 06:17:21 1.6
--- nbsdelf.mh 2002/01/04 23:54:55
***************
*** 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
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsdelf.h
--- 1,5 ----
# Host: Intel 386 running NetBSD
XDEPFILES=
! NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i387-nat.o i386nbsd-nat.o solib.o solib-svr4.o solib-legacy.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsdelf.h
Index: config/i386/tm-nbsd.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-nbsd.h,v
retrieving revision 1.7
diff -c -r1.7 tm-nbsd.h
*** tm-nbsd.h 2001/03/06 08:21:29 1.7
--- tm-nbsd.h 2002/01/04 23:54:55
***************
*** 1,5 ****
/* Macro definitions for i386 running under NetBSD.
! Copyright 1994, 1996, 2000 Free Software Foundation, Inc.
This file is part of GDB.
--- 1,5 ----
/* Macro definitions for i386 running under NetBSD.
! Copyright 1994, 1996, 2000, 2002 Free Software Foundation, Inc.
This file is part of GDB.
***************
*** 22,27 ****
--- 22,28 ----
#define TM_NBSD_H
#define HAVE_I387_REGS
+ #define HAVE_SSE_REGS
#include "i386/tm-i386.h"
#include "config/tm-nbsd.h"
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch] Overhaul i386nbsd-nat.c, add support for XMM + ELF core files
2002-01-04 16:08 [patch] Overhaul i386nbsd-nat.c, add support for XMM + ELF core files Jason R Thorpe
@ 2002-01-04 16:41 ` Mark Kettenis
2002-01-04 17:05 ` Jason R Thorpe
2002-01-04 19:03 ` Jason R Thorpe
0 siblings, 2 replies; 8+ messages in thread
From: Mark Kettenis @ 2002-01-04 16:41 UTC (permalink / raw)
To: thorpej; +Cc: gdb-patches
Jason R Thorpe <thorpej@wasabisystems.com> writes:
> The following patch overhauls i386nbsd-nat.c, using new interfaces to
> access the gdb regcache, and adds support for XMM registers and ELF
> format NetBSD core files.
Is there any chance that I can convince you to make NetBSD use
i386bsd-nat.c instead of i386nbsd-nat.c? NetBSD is close enough to
FreeBSD and OpenBSD to be able to use the same basic functionality on
all of them.
Mark
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch] Overhaul i386nbsd-nat.c, add support for XMM + ELF core files
2002-01-04 16:41 ` Mark Kettenis
@ 2002-01-04 17:05 ` Jason R Thorpe
2002-01-04 19:03 ` Jason R Thorpe
1 sibling, 0 replies; 8+ messages in thread
From: Jason R Thorpe @ 2002-01-04 17:05 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
On Sat, Jan 05, 2002 at 01:39:52AM +0100, Mark Kettenis wrote:
> Is there any chance that I can convince you to make NetBSD use
> i386bsd-nat.c instead of i386nbsd-nat.c? NetBSD is close enough to
> FreeBSD and OpenBSD to be able to use the same basic functionality on
> all of them.
I'd really rather not (the other BSD's don't have the XMM functionality,
for example), but I'll take a look to see if it's really feasible.
Note, i386nbsd-nat.c is still going to be necessary, since NetBSD uses
different core files than the others.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch] Overhaul i386nbsd-nat.c, add support for XMM + ELF core files
2002-01-04 16:41 ` Mark Kettenis
2002-01-04 17:05 ` Jason R Thorpe
@ 2002-01-04 19:03 ` Jason R Thorpe
2002-01-04 19:28 ` Michael Snyder
2002-01-05 6:07 ` Mark Kettenis
1 sibling, 2 replies; 8+ messages in thread
From: Jason R Thorpe @ 2002-01-04 19:03 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 2122 bytes --]
On Sat, Jan 05, 2002 at 01:39:52AM +0100, Mark Kettenis wrote:
> Is there any chance that I can convince you to make NetBSD use
> i386bsd-nat.c instead of i386nbsd-nat.c? NetBSD is close enough to
> FreeBSD and OpenBSD to be able to use the same basic functionality on
> all of them.
Alright, I did this; it wasn't quite as nasty as I thought it'd be.
OK to commit?
[ for gdb/ChangeLog ]
2002-01-04 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.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
[-- Attachment #2: patch3 --]
[-- Type: text/plain, Size: 21627 bytes --]
Index: acconfig.h
===================================================================
RCS file: /cvs/src/src/gdb/acconfig.h,v
retrieving revision 1.16
diff -c -r1.16 acconfig.h
*** acconfig.h 2001/03/31 18:09:02 1.16
--- acconfig.h 2002/01/05 02:57:32
***************
*** 150,155 ****
--- 150,158 ----
/* 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
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.76
diff -c -r1.76 configure.in
*** configure.in 2001/12/21 22:32:37 1.76
--- configure.in 2002/01/05 02:57:40
***************
*** 1,5 ****
dnl Autoconf configure script for GDB, the GNU debugger.
! dnl Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
dnl Free Software Foundation, Inc.
dnl
dnl This file is part of GDB.
--- 1,5 ----
dnl Autoconf configure script for GDB, the GNU debugger.
! dnl Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
dnl Free Software Foundation, Inc.
dnl
dnl This file is part of GDB.
***************
*** 215,220 ****
--- 215,233 ----
AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
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
Index: i386bsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386bsd-nat.c,v
retrieving revision 1.10
diff -c -r1.10 i386bsd-nat.c
*** i386bsd-nat.c 2001/12/29 20:15:47 1.10
--- i386bsd-nat.c 2002/01/05 02:57:41
***************
*** 1,5 ****
/* Native-dependent code for modern i386 BSD's.
! Copyright 2000, 2001 Free Software Foundation, Inc.
This file is part of GDB.
--- 1,5 ----
/* Native-dependent code for modern i386 BSD's.
! Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
***************
*** 96,101 ****
--- 96,111 ----
#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,142 ****
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));
}
#include "i387-nat.h"
--- 145,151 ----
for (i = 0; i < NUM_GREGS; i++)
if ((regno == -1 || regno == i) && ! CANNOT_STORE_REGISTER (i))
! regcache_collect (i, REG_ADDR (gregsetp, i));
}
#include "i387-nat.h"
***************
*** 166,188 ****
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");
! supply_gregset (&gregs);
if (regno == -1 || regno >= FP0_REGNUM)
{
fpregset_t fpregs;
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);
}
}
--- 175,222 ----
void
fetch_inferior_registers (int regno)
{
! if (regno == -1 || GETREGS_SUPPLIES (regno))
! {
! gregset_t 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,222 ****
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");
! 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 || regno >= FP0_REGNUM)
{
fpregset_t fpregs;
! 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");
}
}
\f
--- 226,284 ----
void
store_inferior_registers (int regno)
{
!
! if (regno == -1 || GETREGS_SUPPLIES (regno))
! {
! gregset_t gregs;
! if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) &gregs, 0) == -1)
! perror_with_name ("Couldn't get 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 (have_ptrace_xmmregs != 0 &&
! ptrace(PT_GETXMMREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) xmmregs, 0) == 0)
! {
! have_ptrace_xmmregs = 1;
!
! 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");
! #ifdef HAVE_PT_GETXMMREGS
! }
! #endif
}
}
\f
Index: i386nbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386nbsd-nat.c,v
retrieving revision 1.9
diff -c -r1.9 i386nbsd-nat.c
*** i386nbsd-nat.c 2002/01/04 22:43:31 1.9
--- i386nbsd-nat.c 2002/01/05 02:57:41
***************
*** 25,160 ****
#include <machine/reg.h>
#include <machine/frame.h>
#include "inferior.h"
! #include "gdbcore.h" /* for registers_fetched() */
#include "regcache.h"
! /* Defines for XMM0_REGNUM etc. */
! #include "i386-tdep.h"
! #define RF(dst, src) \
! memcpy(®isters[REGISTER_BYTE(dst)], &src, sizeof(src))
! #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];
! };
- void
- fetch_inferior_registers (int regno)
- {
- struct reg inferior_registers;
- struct env387 inferior_fpregisters;
-
- 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);
- }
- \f
struct md_core
{
struct reg intreg;
! struct env387 freg;
};
static void
--- 25,50 ----
#include <machine/reg.h>
#include <machine/frame.h>
#include "inferior.h"
! #include "gdbcore.h"
#include "regcache.h"
! #ifndef HAVE_GREGSET_T
! typedef struct reg gregset_t;
! #endif
!
! #ifndef HAVE_FPREGSET_T
! typedef struct fpreg fpregset_t;
! #endif
! #include "gregset.h"
! /* Prototypes for i387_supply_fsave etc. */
! #include "i387-nat.h"
struct md_core
{
struct reg intreg;
! char freg[108];
};
static void
***************
*** 162,194 ****
CORE_ADDR ignore)
{
struct md_core *core_reg = (struct md_core *) core_reg_sect;
! /* integer registers */
! memcpy (®isters[REGISTER_BYTE (0)], &core_reg->intreg,
! sizeof (struct reg));
!
! /* 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]);
!
! 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);
! registers_fetched ();
}
/* Register that we are able to handle i386nbsd core file formats.
FIXME: is this really bfd_target_unknown_flavour? */
--- 52,108 ----
CORE_ADDR ignore)
{
struct md_core *core_reg = (struct md_core *) core_reg_sect;
+
+ /* We get everything from one section. */
+ if (which != 0)
+ return;
! /* Integer registers. */
! supply_gregset (&core_reg->intreg);
! /* Floating point registers. */
! i387_supply_fsave (core_reg->freg);
}
+ 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.
FIXME: is this really bfd_target_unknown_flavour? */
***************
*** 201,208 ****
--- 115,132 ----
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);
}
Index: config/i386/nbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nbsd.mh,v
retrieving revision 1.10
diff -c -r1.10 nbsd.mh
*** nbsd.mh 2001/10/02 23:11:21 1.10
--- nbsd.mh 2002/01/05 02:57:41
***************
*** 7,13 ****
# 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
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
--- 7,13 ----
# 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 i387-nat.o i386bsd-nat.o i386nbsd-nat.o solib.o solib-sunos.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
Index: config/i386/nbsd.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nbsd.mt,v
retrieving revision 1.6
diff -c -r1.6 nbsd.mt
*** nbsd.mt 2001/01/22 20:23:16 1.6
--- nbsd.mt 2002/01/05 02:57:42
***************
*** 1,5 ****
# Target: Intel 386 running NetBSD
! TDEPFILES= i386-tdep.o i387-tdep.o i386nbsd-tdep.o
TM_FILE= tm-nbsd.h
GDBSERVER_DEPFILES= low-nbsd.o
--- 1,5 ----
# Target: Intel 386 running NetBSD
! TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o
TM_FILE= tm-nbsd.h
GDBSERVER_DEPFILES= low-nbsd.o
Index: config/i386/nbsdelf.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nbsdelf.mh,v
retrieving revision 1.6
diff -c -r1.6 nbsdelf.mh
*** nbsdelf.mh 2001/03/10 06:17:21 1.6
--- nbsdelf.mh 2002/01/05 02:57:42
***************
*** 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
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsdelf.h
--- 1,5 ----
# Host: Intel 386 running NetBSD
XDEPFILES=
! 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
Index: config/i386/nbsdelf.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nbsdelf.mt,v
retrieving revision 1.3
diff -c -r1.3 nbsdelf.mt
*** nbsdelf.mt 2001/01/22 20:23:16 1.3
--- nbsdelf.mt 2002/01/05 02:57:42
***************
*** 1,5 ****
# Target: Intel 386 running NetBSD
! TDEPFILES= i386-tdep.o i387-tdep.o
TM_FILE= tm-nbsdelf.h
GDBSERVER_DEPFILES= low-nbsd.o
--- 1,5 ----
# Target: Intel 386 running NetBSD
! TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o
TM_FILE= tm-nbsdelf.h
GDBSERVER_DEPFILES= low-nbsd.o
Index: config/i386/tm-nbsd.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-nbsd.h,v
retrieving revision 1.7
diff -c -r1.7 tm-nbsd.h
*** tm-nbsd.h 2001/03/06 08:21:29 1.7
--- tm-nbsd.h 2002/01/05 02:57:42
***************
*** 1,5 ****
/* Macro definitions for i386 running under NetBSD.
! Copyright 1994, 1996, 2000 Free Software Foundation, Inc.
This file is part of GDB.
--- 1,5 ----
/* Macro definitions for i386 running under NetBSD.
! Copyright 1994, 1996, 2000, 2002 Free Software Foundation, Inc.
This file is part of GDB.
***************
*** 22,27 ****
--- 22,28 ----
#define TM_NBSD_H
#define HAVE_I387_REGS
+ #define HAVE_SSE_REGS
#include "i386/tm-i386.h"
#include "config/tm-nbsd.h"
***************
*** 46,58 ****
\f
/* 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 SIGTRAMP_START(pc) 0xbfbfdf20
! #define SIGTRAMP_END(pc) 0xbfbfdff0
! /* Offset to saved PC in sigcontext, from <sys/signal.h>. */
! #define SIGCONTEXT_PC_OFFSET 20
#endif /* TM_NBSD_H */
--- 47,70 ----
\f
/* Support for signal handlers. */
! #define IN_SIGTRAMP(pc, name) i386bsd_in_sigtramp (pc, name)
! extern int i386bsd_in_sigtramp (CORE_ADDR pc, char *name);
! /* These defines allow the recognition of sigtramps as a function name
! <sigtramp>.
! 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 */
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch] Overhaul i386nbsd-nat.c, add support for XMM + ELF core files
2002-01-04 19:03 ` Jason R Thorpe
@ 2002-01-04 19:28 ` Michael Snyder
2002-01-04 19:41 ` Andrew Cagney
2002-01-05 6:07 ` Mark Kettenis
1 sibling, 1 reply; 8+ messages in thread
From: Michael Snyder @ 2002-01-04 19:28 UTC (permalink / raw)
To: thorpej; +Cc: Mark Kettenis, gdb-patches
Jason R Thorpe wrote:
>
> On Sat, Jan 05, 2002 at 01:39:52AM +0100, Mark Kettenis wrote:
>
> > Is there any chance that I can convince you to make NetBSD use
> > i386bsd-nat.c instead of i386nbsd-nat.c? NetBSD is close enough to
> > FreeBSD and OpenBSD to be able to use the same basic functionality on
> > all of them.
>
> Alright, I did this; it wasn't quite as nasty as I thought it'd be.
>
> OK to commit?
>
> [ for gdb/ChangeLog ]
> 2002-01-04 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.
Are you concerned about threads? regcache_collect is not thread-aware.
> (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.
>
> --
> -- Jason R. Thorpe <thorpej@wasabisystems.com>
>
> ------------------------------------------------------------------------
> Name: JRT-patch3
> JRT-patch3 Type: Plain Text (text/plain)
> Description: patch3
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch] Overhaul i386nbsd-nat.c, add support for XMM + ELF core files
2002-01-04 19:28 ` Michael Snyder
@ 2002-01-04 19:41 ` Andrew Cagney
2002-01-05 12:59 ` Michael Snyder
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2002-01-04 19:41 UTC (permalink / raw)
To: Michael Snyder; +Cc: thorpej, Mark Kettenis, gdb-patches
> (fill_gregset): Use regcache_collect.
>
>
> Are you concerned about threads? regcache_collect is not thread-aware.
I don't think that is a problem here. The code it is replacing was
using registers[] directly. regcache_collect() is definitly less evil
than registers[] :-)
Oh, and released versioins of NetBSD don't have kernel level threads.
enjoy,
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch] Overhaul i386nbsd-nat.c, add support for XMM + ELF core files
2002-01-04 19:03 ` Jason R Thorpe
2002-01-04 19:28 ` Michael Snyder
@ 2002-01-05 6:07 ` Mark Kettenis
1 sibling, 0 replies; 8+ messages in thread
From: Mark Kettenis @ 2002-01-05 6:07 UTC (permalink / raw)
To: thorpej; +Cc: gdb-patches
Date: Fri, 4 Jan 2002 19:03:50 -0800
From: Jason R Thorpe <thorpej@wasabisystems.com>
On Sat, Jan 05, 2002 at 01:39:52AM +0100, Mark Kettenis wrote:
> Is there any chance that I can convince you to make NetBSD use
> i386bsd-nat.c instead of i386nbsd-nat.c? NetBSD is close enough to
> FreeBSD and OpenBSD to be able to use the same basic functionality on
> all of them.
[From your first message]
I'd really rather not (the other BSD's don't have the XMM functionality,
for example), but I'll take a look to see if it's really feasible.
My secret agenda of course is that when FreeBSD gets XMM
functionality, GDB will already have the support for it :-).
Likewise, when NetBSD implements support for the debug registers
(which FreeBSD already has), the support will already be there!
Note, i386nbsd-nat.c is still going to be necessary, since NetBSD uses
different core files than the others.
Sure!
[From your second message]
Alright, I did this; it wasn't quite as nasty as I thought it'd be.
Well, I tried hard to write i386bsd.c such that it could be used on
all BSD's :-).
OK to commit?
Yes please!
Thanks,
Mark
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch] Overhaul i386nbsd-nat.c, add support for XMM + ELF core files
2002-01-04 19:41 ` Andrew Cagney
@ 2002-01-05 12:59 ` Michael Snyder
0 siblings, 0 replies; 8+ messages in thread
From: Michael Snyder @ 2002-01-05 12:59 UTC (permalink / raw)
To: Andrew Cagney; +Cc: thorpej, Mark Kettenis, gdb-patches
Andrew Cagney wrote:
>
> > (fill_gregset): Use regcache_collect.
> >
> >
> > Are you concerned about threads? regcache_collect is not thread-aware.
>
> I don't think that is a problem here. The code it is replacing was
> using registers[] directly. regcache_collect() is definitly less evil
> than registers[] :-)
Definitely.
> Oh, and released versioins of NetBSD don't have kernel level threads.
OK, then it's not an issue.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-01-05 20:59 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-04 16:08 [patch] Overhaul i386nbsd-nat.c, add support for XMM + ELF core files Jason R Thorpe
2002-01-04 16:41 ` Mark Kettenis
2002-01-04 17:05 ` Jason R Thorpe
2002-01-04 19:03 ` Jason R Thorpe
2002-01-04 19:28 ` Michael Snyder
2002-01-04 19:41 ` Andrew Cagney
2002-01-05 12:59 ` Michael Snyder
2002-01-05 6:07 ` Mark Kettenis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox