GNU Binutils with patches for OS216
Revision | 567a3e54d211ab8d09119f99fed10b57db895450 (tree) |
---|---|
Time | 2018-03-09 09:00:59 |
Author | Simon Marchi <simon.marchi@eric...> |
Commiter | Simon Marchi |
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.
@@ -1,3 +1,8 @@ | ||
1 | +2018-03-08 Simon Marchi <simon.marchi@ericsson.com> | |
2 | + | |
3 | + * remote.c (putpkt_binary): Fix omitted bytes reporting. | |
4 | + (getpkt_or_notif_sane_1): Likewise. | |
5 | + | |
1 | 6 | 2018-03-08 Simon Marchi <simon.marchi@polymtl.ca> |
2 | 7 | |
3 | 8 | * build-id.c (build_id_to_debug_bfd): Use std::string. |
@@ -8720,11 +8720,9 @@ putpkt_binary (const char *buf, int cnt) | ||
8720 | 8720 | |
8721 | 8721 | fprintf_unfiltered (gdb_stdlog, "Sending packet: %s", str.c_str ()); |
8722 | 8722 | |
8723 | - if (str.length () > REMOTE_DEBUG_MAX_CHAR) | |
8724 | - { | |
8725 | - fprintf_unfiltered (gdb_stdlog, "[%zu bytes omitted]", | |
8726 | - str.length () - REMOTE_DEBUG_MAX_CHAR); | |
8727 | - } | |
8723 | + if (len > REMOTE_DEBUG_MAX_CHAR) | |
8724 | + fprintf_unfiltered (gdb_stdlog, "[%d bytes omitted]", | |
8725 | + len - REMOTE_DEBUG_MAX_CHAR); | |
8728 | 8726 | |
8729 | 8727 | fprintf_unfiltered (gdb_stdlog, "..."); |
8730 | 8728 |
@@ -9157,11 +9155,9 @@ getpkt_or_notif_sane_1 (char **buf, long *sizeof_buf, int forever, | ||
9157 | 9155 | fprintf_unfiltered (gdb_stdlog, "Packet received: %s", |
9158 | 9156 | str.c_str ()); |
9159 | 9157 | |
9160 | - if (str.length () > REMOTE_DEBUG_MAX_CHAR) | |
9161 | - { | |
9162 | - fprintf_unfiltered (gdb_stdlog, "[%zu bytes omitted]", | |
9163 | - str.length () - REMOTE_DEBUG_MAX_CHAR); | |
9164 | - } | |
9158 | + if (val > REMOTE_DEBUG_MAX_CHAR) | |
9159 | + fprintf_unfiltered (gdb_stdlog, "[%d bytes omitted]", | |
9160 | + val - REMOTE_DEBUG_MAX_CHAR); | |
9165 | 9161 | |
9166 | 9162 | fprintf_unfiltered (gdb_stdlog, "\n"); |
9167 | 9163 | } |