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

Message ID 1503828934-26404-2-git-send-email-simon.marchi@ericsson.com
State New, archived
Headers

Commit Message

Simon Marchi Aug. 27, 2017, 10:15 a.m. UTC
  ... 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(-)
  

Comments

Yao Qi Sept. 5, 2017, 9:49 a.m. UTC | #1
On 17-08-27 12:15:31, Simon Marchi wrote:
> ... 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.

Patch is good to me.
  

Patch

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