powerpc remote target registers

Andrew Cagney cagney@gnu.org
Thu Dec 4 15:11:00 GMT 2003


> Andrew Cagney wrote:
> 
> But then the registers aren't marked as cached at all, so they're now requested from the target each time you do "info all-registers", even though they come up with 0s. Should I pretend the registers not supplied by the target were 0, or should I mark them as unavailable (i.e. the same as what having an "x" does) so at least it's consistent?
> 
> 
> Ah, they should be supplied but with a value of zero.  The protocol (for  historic reasons) specifies that a short G packet should have the missing entries treated as zero (like you intended).
> 
> Good, in which case the attached patch (against 6.0) should do it. Mostly indent changes, boringly enough.
> 
> 
> 2003-12-04  Jonathan Larmour  <jifl@eCosCentric.com>
> 
>     * remote.c (remote_fetch_registers): If target doesn't supply
>     registers, set them to zero.
> 
> Thanks,

Try the attached, its basicly the same but with a few not very obvious 
tweaks: supply_register is actually deprecated (but you couldn't tell 
:-); ->offset is really only valid when ->in_g_packet; avoids an 
assuption about the total size of the buffer and the behavior of get packet.

I think I got the logic right.

Andrew

(PS: paperwork sent)

> --- remote.c.old	2003-12-02 03:05:46.000000000 +0000
> +++ remote.c	2003-12-04 07:19:38.000000000 +0000
> @@ -3498,19 +3498,31 @@ remote_fetch_registers (int regnum)
>  	warning ("Remote reply is too short: %s", buf);
>      }
>  
>   supply_them:
>    {
> -    int i;
> +    int i, end_targ_regs=0;
>      for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
>        {
>  	struct packet_reg *r = &rs->regs[i];
> +
> +	if (buf[r->offset * 2] == 0)
> +	  end_targ_regs = 1;  /* end of registers supplied by target */
>  	if (r->in_g_packet)
>  	  {
> -	    supply_register (r->regnum, regs + r->offset);
> -	    if (buf[r->offset * 2] == 'x')
> -	      set_register_cached (i, -1);
> +	    if (end_targ_regs)
> +	      {
> +		/* If the target hasn't sent enough registers, set
> +		   the remainder to 0. */
> +		supply_register (r->regnum, 0);
> +	      }
> +	    else
> +	      {
> +		supply_register (r->regnum, regs + r->offset);
> +		if (buf[r->offset * 2] == 'x')
> +		  set_register_cached (i, -1);
> +	      }
>  	  }
>        }
>    }
>  }
>  


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20031204/933bf36a/attachment.ksh>


More information about the Gdb-patches mailing list