Subject: port-i386/1651: i386: gdb can read %fs, %gs now
To: None <gnats-bugs@gnats.netbsd.org>
From: John Kohl <jtk@kolvir.arlington.ma.us>
List: netbsd-bugs
Date: 10/18/1995 19:25:14
>Number: 1651
>Category: port-i386
>Synopsis: gdb can read %fs, %gs now
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: gnats-admin (GNATS administrator)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Oct 18 19:50:10 1995
>Last-Modified:
>Originator: John Kohl
>Organization:
NetBSD Kernel Hackers `R` Us
>Release: NetBSD-1.1_ALPHA (Oct 17 1995 )
>Environment:
System: NetBSD pattern 1.1_ALPHA NetBSD 1.1_ALPHA (PATTERN) #192: Tue Oct 17 23:54:10 EDT 1995 jtk@pattern:/u1/NetBSD-current/src/sys/arch/i386/compile/PATTERN i386
>Description:
The kernel now dumps core files with struct reg, so gdb doesn't need any
funny stuff anymore.
>How-To-Repeat:
Use gdb, notice you can't manipulate %fs, %gs
>Fix:
diff -c /usr/src/gnu/usr.bin/gdb/gdb/arch/i386/i386b-nat.c ./i386b-nat.c
*** /usr/src/gnu/usr.bin/gdb/gdb/arch/i386/i386b-nat.c Fri Oct 13 20:23:36 1995
--- ./i386b-nat.c Mon Aug 7 23:30:28 1995
***************
*** 31,39 ****
#include "defs.h"
#include "inferior.h"
- int tregmap[] = {tEAX, tECX, tEDX, tEBX, tESP, tEBP, tESI, tEDI,
- tEIP, tEFLAGS, tCS, tSS, tDS, tES};
-
void
fetch_inferior_registers (regno)
int regno;
--- 31,36 ----
***************
*** 43,49 ****
ptrace (PT_GETREGS, inferior_pid,
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
! memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers, 4*14);
registers_fetched ();
}
--- 40,46 ----
ptrace (PT_GETREGS, inferior_pid,
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
! memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers, 4*NUM_REGS);
registers_fetched ();
}
***************
*** 54,60 ****
{
struct reg inferior_registers;
! memcpy (&inferior_registers, ®isters[REGISTER_BYTE (0)], 4*14);
ptrace (PT_SETREGS, inferior_pid,
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
--- 51,57 ----
{
struct reg inferior_registers;
! memcpy (&inferior_registers, ®isters[REGISTER_BYTE (0)], 4*NUM_REGS);
ptrace (PT_SETREGS, inferior_pid,
(PTRACE_ARG3_TYPE) &inferior_registers, 0);
diff -c /usr/src/gnu/usr.bin/gdb/gdb/arch/i386/nm.h ./nm.h
*** /usr/src/gnu/usr.bin/gdb/gdb/arch/i386/nm.h Fri Oct 13 20:23:36 1995
--- ./nm.h Tue May 16 22:49:45 1995
***************
*** 39,46 ****
#define REGISTER_U_ADDR(addr, blockend, regno) \
{ \
! extern int tregmap[]; \
! addr = blockend + 4 * tregmap[regno]; \
}
#endif /* NM_I386BSD_H */
--- 39,46 ----
#define REGISTER_U_ADDR(addr, blockend, regno) \
{ \
! /* kernel now dumps core with struct reg */ \
! addr = blockend + 4 * regno; \
}
#endif /* NM_I386BSD_H */
Only in /usr/src/gnu/usr.bin/gdb/gdb/arch/i386: tm-i386v.h
diff -c /usr/src/gnu/usr.bin/gdb/gdb/arch/i386/tm.h ./tm.h
*** /usr/src/gnu/usr.bin/gdb/gdb/arch/i386/tm.h Fri Oct 13 20:23:37 1995
--- ./tm.h Tue May 16 22:49:45 1995
***************
*** 28,37 ****
/* Shared library code */
#include "solib.h"
-
- /* We can't yet read %fs and %gs. */
- #undef NUM_REGS
- #define NUM_REGS 14
/* We define our own fetch and store methods. */
#define FETCH_INFERIOR_REGISTERS
--- 28,33 ----
>Audit-Trail:
>Unformatted: