[PATCH] store trace default-collect to target [2/6] gdbserver

Hui Zhu
2013-04-11T06:17:19Z

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]

Hi,

This patch add support for "QTDDCsrc" and "qTDC" to gdbserver.

Thanks,
Hui

2013-04-11 Hui Zhu <hui@codesourcery.com>

* tracepoint.c (default_collect_src, cmd_qtdc, cmd_qtddcsrc): New.
(handle_tracepoint_general_set): Call cmd_qtddcsrc.
(handle_tracepoint_query): Call cmd_qtdc.
(initialize_tracepoint): Initialize default_collect_src.

[-- Attachment #2: defc-ser.txt --]
[-- Type: text/plain, Size: 1218 bytes --]

--- a/gdbserver/tracepoint.c
+++ b/gdbserver/tracepoint.c
@@ -4120,6 +4120,22 @@ cmd_qtnotes (char *own_buf)
write_ok (own_buf);
}

+static char *default_collect_src;
+
+static void
+cmd_qtdc (char *packet)
+{
+ sprintf (packet, "DC%s", default_collect_src);
+}
+
+static void
+cmd_qtddcsrc (char *own_buf)
+{
+ xfree (default_collect_src);
+ default_collect_src = xstrdup (own_buf + strlen ("QTDDCsrc:"));
+ write_ok (own_buf);
+}
+
int
handle_tracepoint_general_set (char *packet)
{
@@ -4194,6 +4210,11 @@ handle_tracepoint_general_set (char *pac
cmd_qtnotes (packet);
return 1;
}
+ else if (strncmp ("QTDDCsrc:", packet, strlen ("QTDDCsrc:")) == 0)
+ {
+ cmd_qtddcsrc (packet);
+ return 1;
+ }

return 0;
}
@@ -4261,6 +4282,11 @@ handle_tracepoint_query (char *packet)
cmd_qtminftpilen (packet);
return 1;
}
+ else if (strcmp ("qTDC", packet) == 0)
+ {
+ cmd_qtdc (packet);
+ return 1;
+ }

return 0;
}
@@ -7332,5 +7358,7 @@ initialize_tracepoint: mmap'ing jump pad
strcpy (gdb_trampoline_buffer_error, "No errors reported");

initialize_low_tracepoint ();
+#else
+ default_collect_src = xstrdup ("");
#endif
}