Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Theodore A. Roth" <troth@openavr.org>
To: Andrew Cagney <ac131313@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC/RFA] fix calculation of sizeof_g_packet
Date: Wed, 04 Jun 2003 04:35:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.44.0306032130480.16658-200000@bozoland.mynet> (raw)
In-Reply-To: <3EDD5D13.3060902@redhat.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1639 bytes --]

On Tue, 3 Jun 2003, Andrew Cagney wrote:

:)> On Tue, 3 Jun 2003, Andrew Cagney wrote:
:)> 
:)> :) > 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.
:)> 
:)> 
:)> :) > -  /* 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;
:)> 
:)> Well, DEPRECATED_REGISTER_BYTES_P() doesn't seem to exist.
:)> So there should need to be a change in gdbarch.sh I assume.
:)
:)Doh, sorry.  Easier to just test for a non-zero value:
:)
:)	if (DEPRECATED_REGISTER_BYTES == 0)
:)
:)With that yes, definitly approved.
:)
:)Andrew

Ok. 

I've committed the attached.

Ted Roth

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 blindly using
        DEPRECATED_REGISTER_BYTES.

[-- Attachment #2: Type: TEXT/PLAIN, Size: 1659 bytes --]

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 blindly 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 22:59:00 -0000
@@ -261,9 +261,10 @@ 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 */
+  if (DEPRECATED_REGISTER_BYTES != 0)
+    rs->sizeof_g_packet = DEPRECATED_REGISTER_BYTES;
+  else
+    rs->sizeof_g_packet = 0;
 
   /* Assume a 1:1 regnum<->pnum table.  */
   rs->regs = xcalloc (NUM_REGS + NUM_PSEUDO_REGS, sizeof (struct packet_reg));
@@ -274,8 +275,11 @@ 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. */
+      if (!DEPRECATED_REGISTER_BYTES == 0)
+        rs->sizeof_g_packet += register_size (current_gdbarch, regnum);
     }
 
   /* Default maximum number of characters in a packet body. Many

      reply	other threads:[~2003-06-04  4:35 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
2003-06-03 23:13   ` Theodore A. Roth
2003-06-04  2:46     ` Andrew Cagney
2003-06-04  4:35       ` Theodore A. Roth [this message]

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=Pine.LNX.4.44.0306032130480.16658-200000@bozoland.mynet \
    --to=troth@openavr.org \
    --cc=ac131313@redhat.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