This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] remote_set_trace_notes
- From: "Abid, Hafiz" <hafiz_abid at mentor dot com>
- To: <stan at codesourcery dot com>, <palves at redhat dot com>, <gdb-patches at sourceware dot org>
- Date: Fri, 1 Mar 2013 17:43:09 +0000
- Subject: [patch] remote_set_trace_notes
Hi All,
During review of trace-buffer-size patch, I was asked to move a change
into a separate patch. This is simple change in remote_set_trace_notes
that will make this function return if all arguments are NULL.
2012-03-01 Stan Shebs <stan@codesourcery.com>
Hafiz Abid Qadeer <abidh@codesourcery.com>
gdb/
* remote.c (remote_set_trace_notes): Handle no-op case better.
diff --git a/gdb/remote.c b/gdb/remote.c
index 88a57c8..8326ce8 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -11050,6 +11050,7 @@ remote_set_trace_notes (char *user, char *notes, char *stop_notes)
char *buf = rs->buf;
char *endbuf = rs->buf + get_remote_packet_size ();
int nbytes;
+ int any = 0;
buf += xsnprintf (buf, endbuf - buf, "QTNotes:");
if (user)
@@ -11058,6 +11059,7 @@ remote_set_trace_notes (char *user, char *notes, char *stop_notes)
nbytes = bin2hex (user, buf, 0);
buf += 2 * nbytes;
*buf++ = ';';
+ any = 1;
}
if (notes)
{
@@ -11065,6 +11067,7 @@ remote_set_trace_notes (char *user, char *notes, char *stop_notes)
nbytes = bin2hex (notes, buf, 0);
buf += 2 * nbytes;
*buf++ = ';';
+ any = 1;
}
if (stop_notes)
{
@@ -11072,7 +11075,11 @@ remote_set_trace_notes (char *user, char *notes, char *stop_notes)
nbytes = bin2hex (stop_notes, buf, 0);
buf += 2 * nbytes;
*buf++ = ';';
+ any = 1;
}
+ if (any == 0)
+ return 0;
+
/* Ensure the buffer is terminated. */
*buf = '\0';