aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2018-03-08 19:00:03 -0500
committerSimon Marchi <simon.marchi@ericsson.com>2018-03-08 19:00:59 -0500
commit567a3e54d211ab8d09119f99fed10b57db895450 (patch)
tree9a177f1d52b3438fb99ab767c0cc3bd8eceb7880 /gdb/remote.c
parentf6d8ae8f07b63c711d4b62403e1766b5eea90103 (diff)
downloadgdb-567a3e54d211ab8d09119f99fed10b57db895450.zip
gdb-567a3e54d211ab8d09119f99fed10b57db895450.tar.gz
gdb-567a3e54d211ab8d09119f99fed10b57db895450.tar.bz2
Fix misreporting of omitted bytes for large remote packets
In remote.c, when the output of "set debug remote" is truncated, the number of characters reported is incorrect. What is reported is the number of characters added by the quoting, not the number of characters that were truncated. gdb/ChangeLog: * remote.c (putpkt_binary): Fix omitted bytes reporting. (getpkt_or_notif_sane_1): Likewise.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index 134a97e..7f409fd 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -8720,11 +8720,9 @@ putpkt_binary (const char *buf, int cnt)
fprintf_unfiltered (gdb_stdlog, "Sending packet: %s", str.c_str ());
- if (str.length () > REMOTE_DEBUG_MAX_CHAR)
- {
- fprintf_unfiltered (gdb_stdlog, "[%zu bytes omitted]",
- str.length () - REMOTE_DEBUG_MAX_CHAR);
- }
+ if (len > REMOTE_DEBUG_MAX_CHAR)
+ fprintf_unfiltered (gdb_stdlog, "[%d bytes omitted]",
+ len - REMOTE_DEBUG_MAX_CHAR);
fprintf_unfiltered (gdb_stdlog, "...");
@@ -9157,11 +9155,9 @@ getpkt_or_notif_sane_1 (char **buf, long *sizeof_buf, int forever,
fprintf_unfiltered (gdb_stdlog, "Packet received: %s",
str.c_str ());
- if (str.length () > REMOTE_DEBUG_MAX_CHAR)
- {
- fprintf_unfiltered (gdb_stdlog, "[%zu bytes omitted]",
- str.length () - REMOTE_DEBUG_MAX_CHAR);
- }
+ if (val > REMOTE_DEBUG_MAX_CHAR)
+ fprintf_unfiltered (gdb_stdlog, "[%d bytes omitted]",
+ val - REMOTE_DEBUG_MAX_CHAR);
fprintf_unfiltered (gdb_stdlog, "\n");
}