This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Updates for m68k-linux target


> 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  <schwab@suse.de>
> 
> * 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 <sys/param.h>
> #include <sys/dir.h>
> #include <signal.h>
> +#include <sys/ptrace.h>
> #include <sys/user.h>
> #include <sys/ioctl.h>
> #include <fcntl.h>
> #include <sys/procfs.h>
> +#ifdef HAVE_SYS_REG_H
> +#include <sys/reg.h>
> +#endif
> +
>  #include <sys/file.h>
> #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 *) &registers[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),
> +	      &registers[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 *) &registers[REGISTER_BYTE (FPC_REGNUM + reg)];


Ditto.


enjoy,

Andrew




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]