[PATCH 1/4] Improve "'g' reply is is to long" error message

Simon Marchi
2017-08-27T10:16:32Z

... by adding the expected size, and the received size. I found this
useful when debugging gdbarch/remote issues, since it gives a hint of
what gdb expects and what the remote sent.

gdb/ChangeLog:

* remote.c (process_g_packet): Update error message.
---
gdb/remote.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index 2249533..ea8474d 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -7581,7 +7581,8 @@ process_g_packet (struct regcache *regcache)

/* Further sanity checks, with knowledge of the architecture. */
if (buf_len > 2 * rsa->sizeof_g_packet)
- error (_("Remote 'g' packet reply is too long: %s"), rs->buf);
+ error (_("Remote 'g' packet reply is too long (expected %ld bytes, got %d "
+ "bytes): %s"), rsa->sizeof_g_packet, buf_len / 2, rs->buf);

/* Save the size of the packet sent to us by the target. It is used
as a heuristic when determining the max size of packets that the
--
2.7.4