* [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
* Re: [RFC/RFA] fix calculation of sizeof_g_packet
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
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2003-06-03 22:22 UTC (permalink / raw)
To: Theodore A. Roth; +Cc: gdb-patches
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC/RFA] fix calculation of sizeof_g_packet
2003-06-03 22:22 ` Andrew Cagney
@ 2003-06-03 23:13 ` Theodore A. Roth
2003-06-04 2:46 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Theodore A. Roth @ 2003-06-03 23:13 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1351 bytes --]
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.
Round two is attached.
Ok now?
Ted Roth
2003-06-03 Theodore A. Roth <troth@openavr.org>
* gdbarch.sh: Generate a predicate for DEPRECATED_REGISTER_BYTES.
* gdbarch.[ch]: Re-generate.
* 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: 6324 bytes --]
2003-06-03 Theodore A. Roth <troth@openavr.org>
* gdbarch.sh: Generate a predicate for DEPRECATED_REGISTER_BYTES.
* gdbarch.[ch]: Re-generate.
* 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: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.218
diff -u -p -r1.218 gdbarch.c
--- gdbarch.c 2 Jun 2003 02:54:33 -0000 1.218
+++ gdbarch.c 3 Jun 2003 22:58:56 -0000
@@ -644,6 +644,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */
/* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */
/* Skip verify of register_name, invalid_p == 0 */
+ /* Skip verify of deprecated_register_bytes, has predicate */
/* Skip verify of register_byte, has predicate */
/* Skip verify of register_raw_size, invalid_p == 0 */
/* Skip verify of deprecated_max_register_raw_size, has predicate */
@@ -1483,6 +1484,15 @@ gdbarch_dump (struct gdbarch *gdbarch, s
(long) current_gdbarch->deprecated_push_return_address
/*DEPRECATED_PUSH_RETURN_ADDRESS ()*/);
#endif
+#ifdef DEPRECATED_REGISTER_BYTES_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_REGISTER_BYTES_P()",
+ XSTRING (DEPRECATED_REGISTER_BYTES_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_REGISTER_BYTES_P() = %d\n",
+ DEPRECATED_REGISTER_BYTES_P ());
+#endif
#ifdef DEPRECATED_REGISTER_BYTES
fprintf_unfiltered (file,
"gdbarch_dump: DEPRECATED_REGISTER_BYTES # %s\n",
@@ -3322,6 +3332,13 @@ set_gdbarch_deprecated_register_size (st
int deprecated_register_size)
{
gdbarch->deprecated_register_size = deprecated_register_size;
+}
+
+int
+gdbarch_deprecated_register_bytes_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->deprecated_register_bytes != 0;
}
int
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.188
diff -u -p -r1.188 gdbarch.h
--- gdbarch.h 2 Jun 2003 02:54:33 -0000 1.188
+++ gdbarch.h 3 Jun 2003 22:58:57 -0000
@@ -662,6 +662,31 @@ extern void set_gdbarch_deprecated_regis
#define DEPRECATED_REGISTER_SIZE (gdbarch_deprecated_register_size (current_gdbarch))
#endif
+#if defined (DEPRECATED_REGISTER_BYTES)
+/* Legacy for systems yet to multi-arch DEPRECATED_REGISTER_BYTES */
+#if !defined (DEPRECATED_REGISTER_BYTES_P)
+#define DEPRECATED_REGISTER_BYTES_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_REGISTER_BYTES_P)
+#define DEPRECATED_REGISTER_BYTES_P() (0)
+#endif
+
+extern int gdbarch_deprecated_register_bytes_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_BYTES_P)
+#error "Non multi-arch definition of DEPRECATED_REGISTER_BYTES"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_REGISTER_BYTES_P)
+#define DEPRECATED_REGISTER_BYTES_P() (gdbarch_deprecated_register_bytes_p (current_gdbarch))
+#endif
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_REGISTER_BYTES)
+#define DEPRECATED_REGISTER_BYTES (0)
+#endif
+
extern int gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch);
extern void set_gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch, int deprecated_register_bytes);
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_BYTES)
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.240
diff -u -p -r1.240 gdbarch.sh
--- gdbarch.sh 2 Jun 2003 02:54:34 -0000 1.240
+++ gdbarch.sh 3 Jun 2003 22:58:58 -0000
@@ -473,7 +473,7 @@ f:2:SDB_REG_TO_REGNUM:int:sdb_reg_to_reg
f:2:DWARF2_REG_TO_REGNUM:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr:::no_op_reg_to_regnum::0
f:2:REGISTER_NAME:const char *:register_name:int regnr:regnr:::legacy_register_name::0
v::DEPRECATED_REGISTER_SIZE:int:deprecated_register_size
-v::DEPRECATED_REGISTER_BYTES:int:deprecated_register_bytes
+V::DEPRECATED_REGISTER_BYTES:int:deprecated_register_bytes
# NOTE: cagney/2002-05-02: This function with predicate has a valid
# (callable) initial value. As a consequence, even when the predicate
# is false, the corresponding function works. This simplifies the
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_P ())
+ 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_P ())
+ rs->sizeof_g_packet += register_size (current_gdbarch, regnum);
}
/* Default maximum number of characters in a packet body. Many
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC/RFA] fix calculation of sizeof_g_packet
2003-06-03 23:13 ` Theodore A. Roth
@ 2003-06-04 2:46 ` Andrew Cagney
2003-06-04 4:35 ` Theodore A. Roth
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2003-06-04 2:46 UTC (permalink / raw)
To: Theodore A. Roth; +Cc: gdb-patches
> 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
> Round two is attached.
>
> Ok now?
>
> Ted Roth
>
>
> 2003-06-03 Theodore A. Roth <troth@openavr.org>
>
> * gdbarch.sh: Generate a predicate for DEPRECATED_REGISTER_BYTES.
> * gdbarch.[ch]: Re-generate.
> * remote.c (init_remote_state): Compute sizeof_g_packet by
> accumulation of the size of all registers instead of blindly using
> DEPRECATED_REGISTER_BYTES.
>
>
>
> 2003-06-03 Theodore A. Roth <troth@openavr.org>
>
> * gdbarch.sh: Generate a predicate for DEPRECATED_REGISTER_BYTES.
> * gdbarch.[ch]: Re-generate.
> * 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: gdbarch.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.c,v
> retrieving revision 1.218
> diff -u -p -r1.218 gdbarch.c
> --- gdbarch.c 2 Jun 2003 02:54:33 -0000 1.218
> +++ gdbarch.c 3 Jun 2003 22:58:56 -0000
> @@ -644,6 +644,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
> /* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */
> /* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */
> /* Skip verify of register_name, invalid_p == 0 */
> + /* Skip verify of deprecated_register_bytes, has predicate */
> /* Skip verify of register_byte, has predicate */
> /* Skip verify of register_raw_size, invalid_p == 0 */
> /* Skip verify of deprecated_max_register_raw_size, has predicate */
> @@ -1483,6 +1484,15 @@ gdbarch_dump (struct gdbarch *gdbarch, s
> (long) current_gdbarch->deprecated_push_return_address
> /*DEPRECATED_PUSH_RETURN_ADDRESS ()*/);
> #endif
> +#ifdef DEPRECATED_REGISTER_BYTES_P
> + fprintf_unfiltered (file,
> + "gdbarch_dump: %s # %s\n",
> + "DEPRECATED_REGISTER_BYTES_P()",
> + XSTRING (DEPRECATED_REGISTER_BYTES_P ()));
> + fprintf_unfiltered (file,
> + "gdbarch_dump: DEPRECATED_REGISTER_BYTES_P() = %d\n",
> + DEPRECATED_REGISTER_BYTES_P ());
> +#endif
> #ifdef DEPRECATED_REGISTER_BYTES
> fprintf_unfiltered (file,
> "gdbarch_dump: DEPRECATED_REGISTER_BYTES # %s\n",
> @@ -3322,6 +3332,13 @@ set_gdbarch_deprecated_register_size (st
> int deprecated_register_size)
> {
> gdbarch->deprecated_register_size = deprecated_register_size;
> +}
> +
> +int
> +gdbarch_deprecated_register_bytes_p (struct gdbarch *gdbarch)
> +{
> + gdb_assert (gdbarch != NULL);
> + return gdbarch->deprecated_register_bytes != 0;
> }
>
> int
> Index: gdbarch.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.h,v
> retrieving revision 1.188
> diff -u -p -r1.188 gdbarch.h
> --- gdbarch.h 2 Jun 2003 02:54:33 -0000 1.188
> +++ gdbarch.h 3 Jun 2003 22:58:57 -0000
> @@ -662,6 +662,31 @@ extern void set_gdbarch_deprecated_regis
> #define DEPRECATED_REGISTER_SIZE (gdbarch_deprecated_register_size (current_gdbarch))
> #endif
>
> +#if defined (DEPRECATED_REGISTER_BYTES)
> +/* Legacy for systems yet to multi-arch DEPRECATED_REGISTER_BYTES */
> +#if !defined (DEPRECATED_REGISTER_BYTES_P)
> +#define DEPRECATED_REGISTER_BYTES_P() (1)
> +#endif
> +#endif
> +
> +/* Default predicate for non- multi-arch targets. */
> +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_REGISTER_BYTES_P)
> +#define DEPRECATED_REGISTER_BYTES_P() (0)
> +#endif
> +
> +extern int gdbarch_deprecated_register_bytes_p (struct gdbarch *gdbarch);
> +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_BYTES_P)
> +#error "Non multi-arch definition of DEPRECATED_REGISTER_BYTES"
> +#endif
> +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_REGISTER_BYTES_P)
> +#define DEPRECATED_REGISTER_BYTES_P() (gdbarch_deprecated_register_bytes_p (current_gdbarch))
> +#endif
> +
> +/* Default (value) for non- multi-arch platforms. */
> +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_REGISTER_BYTES)
> +#define DEPRECATED_REGISTER_BYTES (0)
> +#endif
> +
> extern int gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch);
> extern void set_gdbarch_deprecated_register_bytes (struct gdbarch *gdbarch, int deprecated_register_bytes);
> #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_BYTES)
> Index: gdbarch.sh
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.sh,v
> retrieving revision 1.240
> diff -u -p -r1.240 gdbarch.sh
> --- gdbarch.sh 2 Jun 2003 02:54:34 -0000 1.240
> +++ gdbarch.sh 3 Jun 2003 22:58:58 -0000
> @@ -473,7 +473,7 @@ f:2:SDB_REG_TO_REGNUM:int:sdb_reg_to_reg
> f:2:DWARF2_REG_TO_REGNUM:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr:::no_op_reg_to_regnum::0
> f:2:REGISTER_NAME:const char *:register_name:int regnr:regnr:::legacy_register_name::0
> v::DEPRECATED_REGISTER_SIZE:int:deprecated_register_size
> -v::DEPRECATED_REGISTER_BYTES:int:deprecated_register_bytes
> +V::DEPRECATED_REGISTER_BYTES:int:deprecated_register_bytes
> # NOTE: cagney/2002-05-02: This function with predicate has a valid
> # (callable) initial value. As a consequence, even when the predicate
> # is false, the corresponding function works. This simplifies the
> 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_P ())
> + 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_P ())
> + rs->sizeof_g_packet += register_size (current_gdbarch, regnum);
> }
>
> /* Default maximum number of characters in a packet body. Many
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC/RFA] fix calculation of sizeof_g_packet
2003-06-04 2:46 ` Andrew Cagney
@ 2003-06-04 4:35 ` Theodore A. Roth
0 siblings, 0 replies; 5+ messages in thread
From: Theodore A. Roth @ 2003-06-04 4:35 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
[-- 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
^ 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