+2017-01-13 Yao Qi <yao.qi@linaro.org>
+
+ * remote.c (REMOTE_DEBUG_MAX_CHAR): New macro.
+ (putpkt_binary): Print only REMOTE_DEBUG_MAX_CHAR chars in debug
+ output.
+ (getpkt_or_notif_sane_1): Likewise.
+
2017-01-13 Yao Qi <yao.qi@linaro.org>
* Makefile.in (checker-headers): Use CXX and CXX_DIALET instead
#define MAXTHREADLISTRESULTS 32
+/* The max number of chars in debug output. The rest of chars are
+ omitted. */
+
+#define REMOTE_DEBUG_MAX_CHAR 512
+
/* Data for the vFile:pread readahead cache. */
struct readahead_cache
{
*p = '\0';
- std::string str = escape_buffer (buf2, p - buf2);
+ int len = (int) (p - buf2);
+
+ std::string str
+ = escape_buffer (buf2, std::min (len, REMOTE_DEBUG_MAX_CHAR));
+
+ 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);
+ }
+
+ fprintf_unfiltered (gdb_stdlog, "...");
- fprintf_unfiltered (gdb_stdlog, "Sending packet: %s...", str.c_str ());
gdb_flush (gdb_stdlog);
}
remote_serial_write (buf2, p - buf2);
{
if (remote_debug)
{
- std::string str = escape_buffer (*buf, val);
+ std::string str
+ = escape_buffer (*buf,
+ std::min (val, REMOTE_DEBUG_MAX_CHAR));
+
+ 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);
+ }
- fprintf_unfiltered (gdb_stdlog, "Packet received: %s\n", str.c_str ());
+ fprintf_unfiltered (gdb_stdlog, "\n");
}
/* Skip the ack char if we're in no-ack mode. */