From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: "drow@false.org" <drow@false.org>
Subject: [RFC] small change for better error reporting in remote.c
Date: Thu, 30 Jul 2009 00:41:00 -0000 [thread overview]
Message-ID: <4A70E268.6010401@vmware.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 703 bytes --]
AFAICT, this has been mildly broken forever.
If you look at store_register_using_P and fetch_register_using_p,
they both call remote_send, followed by packet_ok, and then send
error if PACKET_ERROR.
Unfortunately the PACKET_ERROR path is dead code, because remote_send
already bails with a much more general (ie. less useful) error msg
if we get back an Exx reply.
Most of us will have never seen this happen, because how can a
remote target fail to write a register?
But it can happen when the target is a replay recording as with
Virtutech and VMware targets.
This change is to give a more helpful error message, eg.
'Could not write register "eip"', as opposed to
'Remote failure reply: E00'.
[-- Attachment #2: errmsg.txt --]
[-- Type: text/plain, Size: 1969 bytes --]
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 29 Jul 2009 23:52:27 -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 (rs->buf[0] == 'E')
+ error (_("Could not write registers"));
}
/* Store register REGNUM, or all registers if REGNUM == -1, from the contents
next reply other threads:[~2009-07-30 0:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-30 0:41 Michael Snyder [this message]
2009-07-31 9:00 ` drow
2009-07-31 21:00 ` Michael Snyder
2009-07-31 21:43 ` Daniel Jacobowitz
2009-07-31 22:13 ` Michael Snyder
2009-07-31 22:09 ` Pedro Alves
2009-07-31 22:15 ` Michael Snyder
2009-07-31 22:49 ` Pedro Alves
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=4A70E268.6010401@vmware.com \
--to=msnyder@vmware.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
/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