#if !defined (IN_PROCESS_AGENT)
bool remote_debug = false;
+
+bool suppressed_remote_debug = false;
#endif
/* Output file for debugging. Default to standard error. */
int fd = fileno (debug_file);
return write (fd, buf, nbyte);
}
+
+/* See debug.h. */
+
+void
+suppress_next_putpkt_log ()
+{
+ suppressed_remote_debug = true;
+}
#if !defined (IN_PROCESS_AGENT)
extern bool remote_debug;
+/* If true, do not print the packet content sent with the next putpkt.
+ This flag is reset to false after each putpkt logging. Useful to
+ omit printing binary packet contents. */
+extern bool suppressed_remote_debug;
+
/* Print a "remote" debug statement. */
#define remote_debug_printf(fmt, ...) \
/* Async signal safe debug output function that calls write directly. */
ssize_t debug_write (const void *buf, size_t nbyte);
+/* Suppress the next putpkt debug log by omitting the packet contents.
+ Useful to reduce the logs when sending binary packets. */
+
+void suppress_next_putpkt_log ();
+
#endif /* GDBSERVER_DEBUG_H */
#include "dll.h"
#include "gdbsupport/common-gdbthread.h"
#include "gdbsupport/rsp-low.h"
+#include "gdbsupport/scope-exit.h"
#include "gdbsupport/netstuff.h"
#include "gdbsupport/filestuff.h"
#include "gdbsupport/gdb-sigmask.h"
char *p;
int cc;
+ SCOPE_EXIT { suppressed_remote_debug = false; };
+
buf2 = (char *) xmalloc (strlen ("$") + cnt + strlen ("#nn") + 1);
/* Copy the packet into buffer BUF2, encapsulating it
if (cs.noack_mode || is_notif)
{
/* Don't expect an ack then. */
- if (is_notif)
- remote_debug_printf ("putpkt (\"%s\"); [notif]", buf2);
- else
- remote_debug_printf ("putpkt (\"%s\"); [noack mode]", buf2);
+ remote_debug_printf ("putpkt (\"%s\"); [%s]",
+ (suppressed_remote_debug ? "..." : buf2),
+ (is_notif ? "notif" : "noack mode"));
break;
}
- remote_debug_printf ("putpkt (\"%s\"); [looking for ack]", buf2);
+ remote_debug_printf ("putpkt (\"%s\"); [looking for ack]",
+ (suppressed_remote_debug ? "..." : buf2));
cc = readchar ();