This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] small change for better error reporting in remote.c
Daniel Jacobowitz wrote:
On Fri, Jul 31, 2009 at 01:31:13PM -0700, Michael Snyder wrote:
You may not realize it, but you're asking for a much bigger change.
There is no struct packet_config for the 'G' packet. I'll have to
change set_registers_using_G from void to int, so that it can
return failure if the 'G' packet is unsupported.
But I'll begin working on it, unles I hear "never mind"
from you... ;-)
Bah... no, don't bother with that. What I actually wanted is
just packet_check_result. Is that easier? :-)
Yep, checked in as attached.
2009-07-29 Michael Snyder <msnyder@vmware.com>
* remote.c (store_register_using_P): Call putpkt and getpkt
directly instead of calling remote_send.
(store_register_using_G): Ditto.
(fetch_register_using_p): Ditto.
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.364
diff -u -p -r1.364 remote.c
--- remote.c 14 Jul 2009 21:40:30 -0000 1.364
+++ remote.c 31 Jul 2009 21:31:34 -0000
@@ -4873,7 +4873,8 @@ fetch_register_using_p (struct regcache
*p++ = 'p';
p += hexnumstr (p, reg->pnum);
*p++ = '\0';
- remote_send (&rs->buf, &rs->buf_size);
+ putpkt (rs->buf);
+ getpkt (&rs->buf, &rs->buf_size, 0);
buf = rs->buf;
@@ -5121,7 +5122,8 @@ remote_prepare_to_store (struct regcache
packet was not recognized. */
static int
-store_register_using_P (const struct regcache *regcache, struct packet_reg *reg)
+store_register_using_P (const struct regcache *regcache,
+ struct packet_reg *reg)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct remote_state *rs = get_remote_state ();
@@ -5141,7 +5143,8 @@ store_register_using_P (const struct reg
p = buf + strlen (buf);
regcache_raw_collect (regcache, reg->regnum, regp);
bin2hex (regp, p, register_size (gdbarch, reg->regnum));
- remote_send (&rs->buf, &rs->buf_size);
+ putpkt (rs->buf);
+ getpkt (&rs->buf, &rs->buf_size, 0);
switch (packet_ok (rs->buf, &remote_protocol_packets[PACKET_P]))
{
@@ -5189,7 +5192,10 @@ store_registers_using_G (const struct re
/* remote_prepare_to_store insures that rsa->sizeof_g_packet gets
updated. */
bin2hex (regs, p, rsa->sizeof_g_packet);
- remote_send (&rs->buf, &rs->buf_size);
+ putpkt (rs->buf);
+ getpkt (&rs->buf, &rs->buf_size, 0);
+ if (packet_check_result (rs->buf) == PACKET_ERROR)
+ error (_("Could not write registers"));
}
/* Store register REGNUM, or all registers if REGNUM == -1, from the contents