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
Pedro Alves wrote:
On Friday 31 July 2009 21:31:13, Michael Snyder wrote:
drow@false.org wrote:
On Wed, Jul 29, 2009 at 04:59:36PM -0700, Michael Snyder wrote:
@@ -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 (rs->buf[0] == 'E')
+ error (_("Could not write registers"));
Can you still include the remote error string in this message?
Otherwise, this loses the "feature" of being able to send
more verbose error down the pipe.
Darn, crossed messages.
How's this, Pedro?
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.365
diff -u -p -r1.365 remote.c
--- remote.c 31 Jul 2009 21:33:39 -0000 1.365
+++ remote.c 31 Jul 2009 21:41:36 -0000
@@ -4885,8 +4885,10 @@ fetch_register_using_p (struct regcache
case PACKET_UNKNOWN:
return 0;
case PACKET_ERROR:
- error (_("Could not fetch register \"%s\""),
- gdbarch_register_name (get_regcache_arch (regcache), reg->regnum));
+ error (_("Could not fetch register \"%s\"; remote failure reply '%s'"),
+ gdbarch_register_name (get_regcache_arch (regcache),
+ reg->regnum),
+ buf);
}
/* If this register is unfetchable, tell the regcache. */
@@ -5151,8 +5153,8 @@ store_register_using_P (const struct reg
case PACKET_OK:
return 1;
case PACKET_ERROR:
- error (_("Could not write register \"%s\""),
- gdbarch_register_name (gdbarch, reg->regnum));
+ error (_("Could not write register \"%s\"; remote failure reply '%s'"),
+ gdbarch_register_name (gdbarch, reg->regnum), rs->buf);
case PACKET_UNKNOWN:
return 0;
default:
@@ -5195,7 +5197,8 @@ store_registers_using_G (const struct re
putpkt (rs->buf);
getpkt (&rs->buf, &rs->buf_size, 0);
if (packet_check_result (rs->buf) == PACKET_ERROR)
- error (_("Could not write registers"));
+ error (_("Could not write registers; remote failure reply '%s'"),
+ rs->buf);
}
/* Store register REGNUM, or all registers if REGNUM == -1, from the contents