From 44ff4c96a41453391514afcd9bd306c68b3355fa Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Thu, 21 Nov 1991 03:59:14 +0000 Subject: [PATCH] Cashier --- gdb/ChangeLog | 2 ++ gdb/infptrace.c | 35 ++++++++++++++++++++++++++++++++--- gdb/tm-sun386.h | 3 ++- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6f5ee2e1ea1..c143a5ac50b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,7 @@ Wed Nov 20 18:35:56 1991 John Gilmore (gnu at cygnus.com) + * infptrace.c, tm-sun386.h: Cashier , remove refs. + * configure.in, xconfig, tconfig, Makefile.in, doc/gdbint.texinfo: Makefile fragments for various hosts and targets now come from gdb/config/mh-* and gdb/config/mt-*. This is for consistency with diff --git a/gdb/infptrace.c b/gdb/infptrace.c index 014576b05d6..9e9f508c15b 100644 --- a/gdb/infptrace.c +++ b/gdb/infptrace.c @@ -56,9 +56,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #endif #include "gdbcore.h" -#include /* After a.out.h */ #include #include + +#if !defined (FETCH_INFERIOR_REGISTERS) +#include /* Probably need to poke the user structure */ +#if defined (KERNEL_U_ADDR_BSD) +#include /* For struct nlist */ +#endif /* KERNEL_U_ADDR_BSD. */ +#endif /* !FETCH_INFERIOR_REGISTERS */ /* This function simply calls ptrace with the given arguments. It exists so that all calls to ptrace are isolated in this @@ -161,6 +167,7 @@ detach (signal) #if defined (KERNEL_U_ADDR_BSD) /* Get kernel_u_addr using BSD-style nlist(). */ CORE_ADDR kernel_u_addr; +#include /* For struct nlist */ void _initialize_kernel_u_addr () @@ -193,7 +200,6 @@ static struct hpnlist nl[] = {{ "_u", -1, }, { (char *) 0, }}; /* read the value of the u area from the hp-ux kernel */ void _initialize_kernel_u_addr () { - struct user u; nlist ("/hp-ux", &nl); kernel_u_addr = nl[0].n_value; } @@ -210,27 +216,50 @@ void _initialize_kernel_u_addr () (int *)(offsetof (struct user, u_ar0)), 0) - KERNEL_U_ADDR #endif +/* Registers we shouldn't try to fetch. */ +#if !defined (CANNOT_FETCH_REGISTER) +#define CANNOT_FETCH_REGISTER(regno) 0 +#endif + /* Fetch one register. */ + static void fetch_register (regno) int regno; { register unsigned int regaddr; char buf[MAX_REGISTER_RAW_SIZE]; + char mess[128]; /* For messages */ register int i; /* Offset of registers within the u area. */ - unsigned int offset = U_REGS_OFFSET; + unsigned int offset; + + if (CANNOT_FETCH_REGISTER (regno)) + { + bzero (buf, REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ + supply_register (regno, buf); + return; + } + + offset = U_REGS_OFFSET; regaddr = register_addr (regno, offset); for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) { + errno = 0; *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid, (int *)regaddr, 0); regaddr += sizeof (int); + if (errno != 0) + { + sprintf (mess, "reading register %s (#%d)", reg_names[regno], regno); + perror_with_name (mess); + } } supply_register (regno, buf); } + /* Fetch all registers, or just one, from the child process. */ void diff --git a/gdb/tm-sun386.h b/gdb/tm-sun386.h index 0af69c0b1a2..5b43f5c8502 100644 --- a/gdb/tm-sun386.h +++ b/gdb/tm-sun386.h @@ -31,7 +31,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef COFF_ENCAPSULATE #define NAMES_HAVE_UNDERSCORE -/* Avoid conflicts between "a.out.gnu.h" and */ +/* Avoid conflicts between our include files and + (maybe not needed anymore). */ #define _EXEC_ #endif -- 2.30.2