PATCH for minor buglet in remote.c misreporting REMOTE_DEBUG_MAX_CHAR messages

alarson
2018-03-02T17:14:53Z

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. I'm not up to speed on the GDB patch process , but
here are the necessary changes if someone is willing to be a proxy:

--- gdb/remote.c 2017-09-07 08:28:11.000000000 -0600
+++ ../../gdb-8.0.1/gdb/remote.c 2018-03-02 11:07:33.465414200
-0600
@@ -8768,10 +8768,10 @@

fprintf_unfiltered (gdb_stdlog, "Sending packet: %s", str.c_str
());

- if (str.length () > REMOTE_DEBUG_MAX_CHAR)
+ if (len > REMOTE_DEBUG_MAX_CHAR)
{
fprintf_unfiltered (gdb_stdlog, "[%zu bytes omitted]",
- str.length () - REMOTE_DEBUG_MAX_CHAR);
+ len - REMOTE_DEBUG_MAX_CHAR);
}

fprintf_unfiltered (gdb_stdlog, "...");
@@ -9210,10 +9210,10 @@
fprintf_unfiltered (gdb_stdlog, "Packet received: %s",
str.c_str ());

- if (str.length () > REMOTE_DEBUG_MAX_CHAR)
+ if (val > REMOTE_DEBUG_MAX_CHAR)
{
fprintf_unfiltered (gdb_stdlog, "[%zu bytes omitted]",
- str.length () -
REMOTE_DEBUG_MAX_CHAR);
+ val - REMOTE_DEBUG_MAX_CHAR);
}

fprintf_unfiltered (gdb_stdlog, "\n");