Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: "Theodore A. Roth" <troth@openavr.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC/RFA] fix calculation of sizeof_g_packet
Date: Tue, 03 Jun 2003 22:22:00 -0000	[thread overview]
Message-ID: <3EDD1FA3.9020306@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.53.0306031443400.17269@knuth.amplepower.com>

> The attached patch changes init_remote_state() so that sizeof_g_packet
> computed using REGISTER_RAW_SIZE() instead of blindly set to
> DEPRECATED_REGISTER_BYTES.
> 
> I'm assuming two things which I'm not sure are true:
> 
> 1) REGISTER_RAW_SIZE() is usable for all targets now
> 
> 2) REGISTER_RAW_SIZE() is valid when passed pseudo register.
> 
> Ok to commit?

Just a few tweaks.

> 2003-06-03  Theodore A. Roth  <troth@openavr.org>
> 
> 	* remote.c (init_remote_state): Compute sizeof_g_packet by 
> 	accumulation of the size of all registers instead of using
> 	DEPRECATED_REGISTER_BYTES.
> 
> Index: remote.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/remote.c,v
> retrieving revision 1.100
> diff -u -p -r1.100 remote.c
> --- remote.c	17 May 2003 05:59:58 -0000	1.100
> +++ remote.c	3 Jun 2003 21:36:30 -0000
> @@ -261,9 +261,7 @@ init_remote_state (struct gdbarch *gdbar
>    int regnum;
>    struct remote_state *rs = xmalloc (sizeof (struct remote_state));
>  
> -  /* Start out by having the remote protocol mimic the existing
> -     behavour - just copy in the description of the register cache.  */
> -  rs->sizeof_g_packet = DEPRECATED_REGISTER_BYTES; /* OK */
> +  rs->sizeof_g_packet = 0;

For the moment it is safer to do:

	if (DEPRECATED_REGISTER_BYTES_P ())
	  rs-> ... = ...;
	else
	  rs-> ... = 0;

>    /* Assume a 1:1 regnum<->pnum table.  */
>    rs->regs = xcalloc (NUM_REGS + NUM_PSEUDO_REGS, sizeof (struct packet_reg));
> @@ -274,8 +272,10 @@ init_remote_state (struct gdbarch *gdbar
>        r->regnum = regnum;
>        r->offset = REGISTER_BYTE (regnum);
>        r->in_g_packet = (regnum < NUM_REGS);
> -      /* ...size = REGISTER_RAW_SIZE (regnum); */
>        /* ...name = REGISTER_NAME (regnum); */
> +
> +      /* Compute packet size by accumulating the size of all registers. */
> +      rs->sizeof_g_packet += REGISTER_RAW_SIZE (regnum);

And here:

	if (!DEPRECATED_REGISTER_BYTES_P ())
	  rs-> ... += register_size (current_gdbarch);

register_size is better.

>      }
>  
>    /* Default maximum number of characters in a packet body. Many

The problem is that for some targets, the register sizes don't add up to 
REGISTER_BYTES.

otherwize ok,
Andrew




  reply	other threads:[~2003-06-03 22:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-03 21:48 Theodore A. Roth
2003-06-03 22:22 ` Andrew Cagney [this message]
2003-06-03 23:13   ` Theodore A. Roth
2003-06-04  2:46     ` Andrew Cagney
2003-06-04  4:35       ` Theodore A. Roth

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=3EDD1FA3.9020306@redhat.com \
    --to=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=troth@openavr.org \
    /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