From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10323 invoked by alias); 24 Jan 2002 17:52:00 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 10249 invoked from network); 24 Jan 2002 17:51:58 -0000 Received: from unknown (HELO localhost.cygnus.com) (24.114.42.213) by sources.redhat.com with SMTP; 24 Jan 2002 17:51:58 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.cygnus.com (Postfix) with ESMTP id 31F123D8C; Thu, 24 Jan 2002 12:51:57 -0500 (EST) Message-ID: <3C5049BD.6070407@cygnus.com> Date: Thu, 24 Jan 2002 09:52:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:0.9.7) Gecko/20020103 X-Accept-Language: en-us MIME-Version: 1.0 To: Andreas Schwab Cc: gdb-patches@sources.redhat.com Subject: Re: Updates for m68k-linux target References: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-01/txt/msg00728.txt.bz2 > This patch updates the ptrace interface for the m68k-linux target. > > Ok to check in? Just a few tweeks, otherwize yes. > 2002-01-24 Andreas Schwab > > * config/m68k/tm-m68k.h (LAST_FPU_CTRL_REGNUM): Define. > * m68klinux-nat.c: Fix ptrace interface for fetching/storing > registers and add support for PTRACE_GETREGS. > > Index: src/gdb/config/m68k/tm-m68k.h > =================================================================== > RCS file: /cvs/src/src/gdb/config/m68k/tm-m68k.h,v > retrieving revision 1.8 > diff -u -a -u -r1.8 src/gdb/config/m68k/tm-m68k.h > --- src/gdb/config/m68k/tm-m68k.h 2002/01/05 04:30:34 1.8 > +++ src/gdb/config/m68k/tm-m68k.h 2002/01/19 22:29:37 > @@ -194,6 +194,7 @@ > #define FPC_REGNUM 26 /* 68881 control register */ > #define FPS_REGNUM 27 /* 68881 status register */ > #define FPI_REGNUM 28 /* 68881 iaddr register */ > +#define LAST_FPU_CTRL_REGNUM 28 > > /* Store the address of the place in which to copy the structure the > subroutine will return. This is called from call_function. */ > Index: src/gdb/m68klinux-nat.c > =================================================================== > RCS file: /cvs/src/src/gdb/m68klinux-nat.c,v > retrieving revision 1.6 > diff -u -a -u -r1.6 src/gdb/m68klinux-nat.c > --- src/gdb/m68klinux-nat.c 2001/07/11 18:39:11 1.6 > +++ src/gdb/m68klinux-nat.c 2002/01/19 22:27:53 > @@ -32,11 +32,16 @@ > #include > #include > #include > +#include > #include > #include > #include > #include > +#ifdef HAVE_SYS_REG_H > +#include > +#endif > + > #include > #include "gdb_stat.h" > > @@ -57,6 +62,26 @@ > 45, 46, 47 > }; > > +/* Which ptrace request retrieves which registers? > + These apply to the corresponding SET requests as well. */ > +#define NUM_GREGS (18) > +#define MAX_NUM_REGS (NUM_GREGS + 11) > +#define GETREGS_SUPPLIES(regno) \ > + (0 <= (regno) && (regno) < NUM_GREGS) Function. > +#define GETFPREGS_SUPPLIES(regno) \ > + (FP0_REGNUM <= (regno) && (regno) <= LAST_FPU_CTRL_REGNUM) Function. > +/* Does the current host support the GETREGS request? */ > +int have_ptrace_getregs = > +#ifdef HAVE_PTRACE_GETREGS > + 1 > +#else > + 0 > +#endif > +; Dig dig, ah, i386-linux-nat.c. > + for (regi = 0; regi < NUM_GREGS; regi++) > + if (! valid || valid[regi]) > + regp[regmap[regi]] = *(int *) ®isters[REGISTER_BYTE (regi)]; Use regcache_collect(). > +/* Convert the valid floating-point register values in GDB's register > + array to `struct user' format and store them in *FPREGSETP. The > + array VALID indicates which register values are valid. If VALID is > + NULL, all registers are assumed to be valid. */ Suggest changing ``Convert ...'' to ``Transfer ...'' or ``Copy ...''. Within GDB the words ``convert'' and ``floating-point'' combine to suggest the old REGISTER_CONVERTIBLE et.al. macros which really did convert floating-point values as they were being copied to/from core GDB. > +static void > +convert_to_fpregset (elf_fpregset_t *fpregsetp, char *valid) > +{ > + int reg; > + > + /* Fill in the floating-point registers. */ > + for (reg = 0; reg < 8; reg++) > + if (!valid || valid[FP0_REGNUM + reg]) > + memcpy (FPREG_ADDR (fpregsetp, reg), > + ®isters[REGISTER_BYTE (FP0_REGNUM + reg)], > + REGISTER_RAW_SIZE(FP0_REGNUM + reg)); regcache_collect (); > + /* Fill in the floating-point control registers. */ > + for (reg = 0; reg < 3; reg++) > + if (!valid || valid[FPC_REGNUM + reg]) > + fpregsetp->fpcntl[reg] > + = *(int *) ®isters[REGISTER_BYTE (FPC_REGNUM + reg)]; Ditto. enjoy, Andrew