Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Andreas Schwab <schwab@suse.de>
Cc: gdb-patches@sources.redhat.com
Subject: Re: Updates for m68k-linux target
Date: Thu, 24 Jan 2002 09:52:00 -0000	[thread overview]
Message-ID: <3C5049BD.6070407@cygnus.com> (raw)
In-Reply-To: <jer8ogvzle.fsf@sykes.suse.de>

> 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




  reply	other threads:[~2002-01-24 17:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-24  2:02 Andreas Schwab
2002-01-24  9:52 ` Andrew Cagney [this message]
2002-01-26 14:24   ` Andreas Schwab
2002-01-29 13:41     ` Andrew Cagney
2002-01-30  5:57       ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C5049BD.6070407@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox