Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC/RFA] fix calculation of sizeof_g_packet
@ 2003-06-03 21:48 Theodore A. Roth
  2003-06-03 22:22 ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Theodore A. Roth @ 2003-06-03 21:48 UTC (permalink / raw)
  To: gdb-patches

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

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?

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


[-- Attachment #2: Type: TEXT/PLAIN, Size: 1484 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 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;
 
   /* 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);
     }
 
   /* Default maximum number of characters in a packet body. Many

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-06-04  4:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-03 21:48 [RFC/RFA] fix calculation of sizeof_g_packet 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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox