Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: Joel Brobecker <brobecker@gnat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA/RFC/IRIX] Remove some deprecated_registers from irix5-nat.c
Date: Sat, 13 Nov 2004 23:06:00 -0000	[thread overview]
Message-ID: <419692EA.8000701@gnu.org> (raw)
In-Reply-To: <20041113224227.GK935@gnat.com>

Joel Brobecker wrote:
> Hello,
> 
> Here is a patch that removes most of the uses of deprecated_registers
> in irix5-nat.c. I am not too familiar with the regcache yet, I hope
> I got it right. There was also a small issue with type size, where
> I introduced a temporary (regval) to make sure that the buffer given
> to regcache_raw_read_signed would always be large enough. Not sure
> whether it was the best way to do it (this shows my lack of C knowledge).

You should consider a patch fixing fallout from the deletion of 
deprecated_registers as "obvious".

> 2004-11-13  Joel Brobecker  <brobecker@gnat.com>
> 
>         * irix5-nat.c (fill_gregset): Replace use of deprecated_registers
>         with equivalent code.
>         (fill_fpregset): Likewise.
> 
> Tested on mips-irix. There is an occasional screwup during the execution
> of gdb.threads/killed.exp that causes the testsuite to abort before the
> end:
> 
>         ERROR: (DejaGnu) proc "(gdb) {$}" does not exist.
>         The error code is NONE
>         The info on the error is:
>         close: invalid spawn id (8)
>             while executing
>         "close -i 8"
>             invoked from within
>         "catch "close -i $spawn_id""
> 
> Given that the testsuite takes a fair bit of time to run on our
> IRIX machine, and given that it can happen several times in a row
> before I get a clean run, I am reluctant to retry.
> 
> So it's a bit more difficult to compare the two testsuite results.
> But I verified that we didn't have any change in all the testsuite
> up until this point.
> 
> OK to apply?
> 
> The last couple of uses of deprecated_registers will be removed shortly.
> I decided to handle them separately because they are used when loading
> the registers from a core file. I wanted to evaluate the attached change
> first.

And set your baseline at "does it build" (as with deprecated_registers 
deleted, it doesn't build yet alone run).

(thanks for fixing this)
Andrew

> Thanks,
> 
> 
> ------------------------------------------------------------------------
> 
> Index: irix5-nat.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/irix5-nat.c,v
> retrieving revision 1.35
> diff -u -p -r1.35 irix5-nat.c
> --- irix5-nat.c	30 Oct 2004 22:36:34 -0000	1.35
> +++ irix5-nat.c	13 Nov 2004 22:33:07 -0000
> @@ -83,6 +83,7 @@ fill_gregset (gregset_t *gregsetp, int r
>  {
>    int regi;
>    greg_t *regp = &(*gregsetp)[0];
> +  LONGEST regval;
>  
>    /* Under Irix6, if GDB is built with N32 ABI and is debugging an O32
>       executable, we have to sign extend the registers to 64 bits before
> @@ -90,30 +91,39 @@ fill_gregset (gregset_t *gregsetp, int r
>  
>    for (regi = 0; regi <= CTX_RA; regi++)
>      if ((regno == -1) || (regno == regi))
> -      *(regp + regi) =
> -	extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)],
> -				register_size (current_gdbarch, regi));
> +      {
> +        regcache_raw_read_signed (current_regcache, regi, &regval);
> +        *(regp + regi) = regval;
> +      }
>  
>    if ((regno == -1) || (regno == PC_REGNUM))
> -    *(regp + CTX_EPC) =
> -      extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->pc)],
> -			      register_size (current_gdbarch, mips_regnum (current_gdbarch)->pc));
> +    {
> +      regcache_raw_read_signed
> +        (current_regcache, mips_regnum (current_gdbarch)->pc, &regval);
> +      *(regp + CTX_EPC) = regval;
> +    }
>  
>    if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->cause))
> -    *(regp + CTX_CAUSE) =
> -      extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->cause)],
> -			      register_size (current_gdbarch, mips_regnum (current_gdbarch)->cause));
> +    {
> +      regcache_raw_read_signed
> +        (current_regcache, mips_regnum (current_gdbarch)->cause, &regval);
> +      *(regp + CTX_CAUSE) = regval;
> +    }
>  
>    if ((regno == -1)
>        || (regno == mips_regnum (current_gdbarch)->hi))
> -    *(regp + CTX_MDHI) =
> -      extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->hi)],
> -			      register_size (current_gdbarch, mips_regnum (current_gdbarch)->hi));
> +    {
> +      regcache_raw_read_signed
> +        (current_regcache, mips_regnum (current_gdbarch)->hi, &regval);
> +      *(regp + CTX_MDHI) = regval;
> +    }
>  
>    if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->lo))
> -    *(regp + CTX_MDLO) =
> -      extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->lo)],
> -			      register_size (current_gdbarch, mips_regnum (current_gdbarch)->lo));
> +    {
> +      regcache_raw_read_signed
> +        (current_regcache, mips_regnum (current_gdbarch)->lo, &regval);
> +      *(regp + CTX_MDLO) = regval;
> +    }
>  }
>  
>  /*
> @@ -158,15 +168,16 @@ fill_fpregset (fpregset_t *fpregsetp, in
>      {
>        if ((regno == -1) || (regno == regi))
>  	{
> -	  from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)];
>  	  to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]);
> -	  memcpy (to, from, register_size (current_gdbarch, regi));
> +          regcache_raw_read (current_regcache, regi, to);
>  	}
>      }
>  
>    if ((regno == -1)
>        || (regno == mips_regnum (current_gdbarch)->fp_control_status))
> -    fpregsetp->fp_csr = *(unsigned *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (mips_regnum (current_gdbarch)->fp_control_status)];
> +    regcache_raw_read (current_regcache,
> +                       mips_regnum (current_gdbarch)->fp_control_status, 
> +                       &fpregsetp->fp_csr);
>  }
>  
>  


  reply	other threads:[~2004-11-13 23:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-13 22:42 Joel Brobecker
2004-11-13 23:06 ` Andrew Cagney [this message]
2004-11-14  1:24   ` Joel Brobecker

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=419692EA.8000701@gnu.org \
    --to=cagney@gnu.org \
    --cc=brobecker@gnat.com \
    --cc=gdb-patches@sources.redhat.com \
    /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