* [PATCH] store trace default-collect to target [0/6]
@ 2013-04-11 8:35 Hui Zhu
2013-04-11 8:37 ` [PATCH] store trace default-collect to target [1/6] target, trace and remote Hui Zhu
` (6 more replies)
0 siblings, 7 replies; 34+ messages in thread
From: Hui Zhu @ 2013-04-11 8:35 UTC (permalink / raw)
To: gdb-patches ml
Hi,
GDB doesn't store default-collect to target. Then if a clean gdb attach a target that have tracepoint running on it and have default collect. It will cannot tdump all the val that collect by tracepoint.
So I add some patches to let GDB store default-collect to target by packet "QTDDCsrc" when "tstart". And when gdb connect to target, it will use "qTDC" request the default-collect in target.
And I also add support to tfile and let default-collect can be save with command "save tracepoint".
Please help me review them.
Thanks,
Hui
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH] store trace default-collect to target [1/6] target, trace and remote
2013-04-11 8:35 [PATCH] store trace default-collect to target [0/6] Hui Zhu
@ 2013-04-11 8:37 ` Hui Zhu
2013-04-11 22:58 ` Yao Qi
2013-04-11 22:59 ` Abid, Hafiz
2013-04-11 9:14 ` [PATCH] store trace default-collect to target [2/6] gdbserver Hui Zhu
` (5 subsequent siblings)
6 siblings, 2 replies; 34+ messages in thread
From: Hui Zhu @ 2013-04-11 8:37 UTC (permalink / raw)
To: gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 948 bytes --]
Hi,
This is the patch for remote support.
Also add to_download_tracepoint_default_collect as interface for store trace default-collect to target. and call it in start_tracing.
Thanks,
Hui
2013-04-11 Hui Zhu <hui@codesourcery.com>
* remote.c (remote_upload_trace_default_collest): New static.
(remote_start_remote): Call remote_upload_trace_default_collest
and trace_set_default_collect.
(remote_download_tracepoint_default_collect): New.
(remote_can_download_tracepoint): Set
to_download_tracepoint_default_collect.
(remote_upload_trace_default_collest): New.
* target.c (update_current_target): Add
to_download_tracepoint_default_collect.
* target.h (target_ops): to_download_tracepoint_default_collect.
(target_download_tracepoint_default_collect): New.
* tracepoint.c (start_tracing): Call
target_download_tracepoint_default_collect.
(trace_set_default_collect): New.
* tracepoint.h (trace_set_default_collect): New extern.
[-- Attachment #2: defc-remote.txt --]
[-- Type: text/plain, Size: 5623 bytes --]
--- a/remote.c
+++ b/remote.c
@@ -215,6 +215,8 @@ static int remote_get_trace_status (stru
static int remote_upload_tracepoints (struct uploaded_tp **utpp);
static int remote_upload_trace_state_variables (struct uploaded_tsv **utsvp);
+
+static void remote_upload_trace_default_collest (char **collectp);
static void remote_query_supported (void);
@@ -3567,6 +3569,7 @@ remote_start_remote (int from_tty, struc
{
struct uploaded_tp *uploaded_tps = NULL;
struct uploaded_tsv *uploaded_tsvs = NULL;
+ char *uploaded_default_collest = NULL;
if (current_trace_status ()->running)
printf_filtered (_("Trace is already running on the target.\n"));
@@ -3581,6 +3584,10 @@ remote_start_remote (int from_tty, struc
remote_upload_tracepoints (&uploaded_tps);
merge_uploaded_tracepoints (&uploaded_tps);
+
+ remote_upload_trace_default_collest (&uploaded_default_collest);
+
+ trace_set_default_collect (uploaded_default_collest);
}
/* The thread and inferior lists are now synchronized with the
@@ -10567,6 +10574,23 @@ remote_download_tracepoint (struct bp_lo
do_cleanups (old_chain);
}
+static void
+remote_download_tracepoint_default_collect (char *collect)
+{
+ char buf[BUF_SIZE];
+
+ strcpy (buf, "QTDDCsrc:");
+ if (strlen (buf) + strlen (collect) * 2 >= BUF_SIZE)
+ error (_("Source string too long for buffer"));
+ bin2hex (collect, buf + strlen (buf), 0);
+
+ putpkt (buf);
+ remote_get_noisy_reply (&target_buf, &target_buf_size);
+ if (strcmp (target_buf, "OK"))
+ warning (_("\
+Target does not support tracepoint default collect source download."));
+}
+
static int
remote_can_download_tracepoint (void)
{
@@ -11422,6 +11446,8 @@ Specify the serial device it is connecte
remote_ops.to_can_run_breakpoint_commands = remote_can_run_breakpoint_commands;
remote_ops.to_trace_init = remote_trace_init;
remote_ops.to_download_tracepoint = remote_download_tracepoint;
+ remote_ops.to_download_tracepoint_default_collect
+ = remote_download_tracepoint_default_collect;
remote_ops.to_can_download_tracepoint = remote_can_download_tracepoint;
remote_ops.to_download_trace_state_variable
= remote_download_trace_state_variable;
@@ -11644,6 +11670,28 @@ remote_upload_trace_state_variables (str
return 0;
}
+static void
+remote_upload_trace_default_collest (char **collectp)
+{
+ struct remote_state *rs = get_remote_state ();
+ int collect_size;
+
+ putpkt ("qTDC");
+ getpkt (&rs->buf, &rs->buf_size, 0);
+ if (strncmp (rs->buf, "DC", 2))
+ {
+ *collectp = NULL;
+ warning (_("\
+Target does not support tracepoint default collect upload."));
+ return;
+ }
+
+ collect_size = (strlen (rs->buf) - 2) / 2;
+ *collectp = xmalloc (collect_size + 1);
+ hex2bin (rs->buf + 2, *collectp, collect_size);
+ (*collectp)[collect_size] = '\0';
+}
+
void
_initialize_remote (void)
{
--- a/target.c
+++ b/target.c
@@ -706,6 +706,7 @@ update_current_target (void)
INHERIT (to_supports_string_tracing, t);
INHERIT (to_trace_init, t);
INHERIT (to_download_tracepoint, t);
+ INHERIT (to_download_tracepoint_default_collect, t);
INHERIT (to_can_download_tracepoint, t);
INHERIT (to_download_trace_state_variable, t);
INHERIT (to_enable_tracepoint, t);
@@ -890,6 +891,9 @@ update_current_target (void)
de_fault (to_download_tracepoint,
(void (*) (struct bp_location *))
tcomplain);
+ de_fault (to_download_tracepoint_default_collect,
+ (void (*) (char *))
+ tcomplain);
de_fault (to_can_download_tracepoint,
(int (*) (void))
return_zero);
--- a/target.h
+++ b/target.h
@@ -748,6 +748,10 @@ struct target_ops
/* Send full details of a tracepoint location to the target. */
void (*to_download_tracepoint) (struct bp_location *location);
+ /* Send full details of the list of expressions to collect by default
+ to the target. */
+ void (*to_download_tracepoint_default_collect) (char *collect);
+
/* Is the target able to download tracepoint locations in current
state? */
int (*to_can_download_tracepoint) (void);
@@ -1725,6 +1729,9 @@ extern char *target_fileio_read_stralloc
#define target_download_tracepoint(t) \
(*current_target.to_download_tracepoint) (t)
+#define target_download_tracepoint_default_collect(collect) \
+ (*current_target.to_download_tracepoint_default_collect) (collect)
+
#define target_can_download_tracepoint() \
(*current_target.to_can_download_tracepoint) ()
--- a/tracepoint.c
+++ b/tracepoint.c
@@ -1796,6 +1796,8 @@ start_tracing (char *notes)
t->number_on_target = 0;
+ target_download_tracepoint_default_collect (default_collect);
+
for (loc = b->loc; loc; loc = loc->next)
{
/* Since tracepoint locations are never duplicated, `inserted'
@@ -5660,6 +5662,18 @@ traceframe_available_memory (VEC(mem_ran
return 0;
}
+/* Not overwrite default collect If COLLECT is NULL or its size is 0. */
+
+void
+trace_set_default_collect (char *collect)
+{
+ if (collect != NULL && strlen (collect) != 0)
+ {
+ xfree (default_collect);
+ default_collect = collect;
+ }
+}
+
/* Implementation of `sdata' variable. */
static const struct internalvar_funcs sdata_funcs =
--- a/tracepoint.h
+++ b/tracepoint.h
@@ -412,4 +412,6 @@ extern struct traceframe_info *parse_tra
extern int traceframe_available_memory (VEC(mem_range_s) **result,
CORE_ADDR memaddr, ULONGEST len);
+extern void trace_set_default_collect (char *collect);
+
#endif /* TRACEPOINT_H */
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH] store trace default-collect to target [2/6] gdbserver
2013-04-11 8:35 [PATCH] store trace default-collect to target [0/6] Hui Zhu
2013-04-11 8:37 ` [PATCH] store trace default-collect to target [1/6] target, trace and remote Hui Zhu
@ 2013-04-11 9:14 ` Hui Zhu
2013-05-13 6:01 ` Hui Zhu
2013-04-11 10:33 ` [PATCH] store trace default-collect to target [3/6] tfile Hui Zhu
` (4 subsequent siblings)
6 siblings, 1 reply; 34+ messages in thread
From: Hui Zhu @ 2013-04-11 9:14 UTC (permalink / raw)
To: gdb-patches ml
[-- 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
}
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH] store trace default-collect to target [3/6] tfile
2013-04-11 8:35 [PATCH] store trace default-collect to target [0/6] Hui Zhu
2013-04-11 8:37 ` [PATCH] store trace default-collect to target [1/6] target, trace and remote Hui Zhu
2013-04-11 9:14 ` [PATCH] store trace default-collect to target [2/6] gdbserver Hui Zhu
@ 2013-04-11 10:33 ` Hui Zhu
2013-04-11 22:59 ` Yao Qi
2013-04-11 10:36 ` [PATCH] store trace default-collect to target [4/6] save tracepoint Hui Zhu
` (3 subsequent siblings)
6 siblings, 1 reply; 34+ messages in thread
From: Hui Zhu @ 2013-04-11 10:33 UTC (permalink / raw)
To: gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 592 bytes --]
Hi,
This patch is to store trace default-collect to tfile when tsave and read it out when tfile target open a tfile.
Thanks,
Hui
2013-04-11 Hui Zhu <hui@codesourcery.com>
* ctf.c (ctf_write_default_collect): New.
(trace_file_write_ops): Add ctf_write_default_collect.
* tracepoint.c (tfile_write_default_collect): New.
(trace_file_write_ops): Add tfile_write_default_collect.
(trace_save): Call writer->ops->write_default_collect.
(tfile_interp_line): Add collectp.
(tfile_open): Add support of default collect.
* tracepoint.h (trace_file_write_ops): Add write_default_collect.
[-- Attachment #2: defc-tfile.txt --]
[-- Type: text/plain, Size: 4085 bytes --]
--- a/ctf.c
+++ b/ctf.c
@@ -616,6 +616,17 @@ ctf_write_uploaded_tp (struct trace_file
}
/* This is the implementation of trace_file_write_ops method
+ write_default_collect. */
+
+static void
+ctf_write_default_collect (struct trace_file_writer *self,
+ char *collect)
+{
+ /* It is not supported yet to write default collect
+ into CTF trace data. */
+}
+
+/* This is the implementation of trace_file_write_ops method
write_definition_end. */
static void
@@ -847,6 +858,7 @@ static const struct trace_file_write_ops
ctf_write_status,
ctf_write_uploaded_tsv,
ctf_write_uploaded_tp,
+ ctf_write_default_collect,
ctf_write_definition_end,
NULL,
&ctf_write_frame_ops,
--- a/tracepoint.c
+++ b/tracepoint.c
@@ -3237,6 +3237,19 @@ tfile_write_uploaded_tp (struct trace_fi
}
/* This is the implementation of trace_file_write_ops method
+ write_default_collect. */
+
+static void
+tfile_write_default_collect (struct trace_file_writer *self,
+ char *collect)
+{
+ struct tfile_trace_file_writer *writer
+ = (struct tfile_trace_file_writer *) self;
+
+ fprintf (writer->fp, "dc %s\n", collect);
+}
+
+/* This is the implementation of trace_file_write_ops method
write_definition_end. */
static void
@@ -3289,6 +3302,7 @@ static const struct trace_file_write_ops
tfile_write_status,
tfile_write_uploaded_tsv,
tfile_write_uploaded_tp,
+ tfile_write_default_collect,
tfile_write_definition_end,
tfile_write_raw_data,
NULL,
@@ -3378,6 +3392,8 @@ trace_save (const char *filename, struct
for (utp = uploaded_tps; utp; utp = utp->next)
writer->ops->write_uploaded_tp (writer, utp);
+ writer->ops->write_default_collect (writer, default_collect);
+
free_uploaded_tps (&uploaded_tps);
/* Mark the end of the definition section. */
@@ -4147,7 +4163,8 @@ int trace_regblock_size;
static void tfile_interp_line (char *line,
struct uploaded_tp **utpp,
- struct uploaded_tsv **utsvp);
+ struct uploaded_tsv **utsvp,
+ char **collectp);
/* Read SIZE bytes into READBUF from the trace frame, starting at
TRACE_FD's current position. Note that this call `read'
@@ -4182,6 +4199,7 @@ tfile_open (char *filename, int from_tty
struct trace_status *ts;
struct uploaded_tp *uploaded_tps = NULL;
struct uploaded_tsv *uploaded_tsvs = NULL;
+ char *uploaded_default_collest = NULL;
target_preopen (from_tty);
if (!filename)
@@ -4251,7 +4269,8 @@ tfile_open (char *filename, int from_tty
break;
linebuf[i] = '\0';
i = 0;
- tfile_interp_line (linebuf, &uploaded_tps, &uploaded_tsvs);
+ tfile_interp_line (linebuf, &uploaded_tps, &uploaded_tsvs,
+ &uploaded_default_collest);
}
else
linebuf[i++] = byte;
@@ -4289,6 +4308,8 @@ tfile_open (char *filename, int from_tty
merge_uploaded_tracepoints (&uploaded_tps);
+ trace_set_default_collect (uploaded_default_collest);
+
post_create_inferior (&tfile_ops, from_tty);
}
@@ -4297,7 +4318,8 @@ tfile_open (char *filename, int from_tty
static void
tfile_interp_line (char *line,
- struct uploaded_tp **utpp, struct uploaded_tsv **utsvp)
+ struct uploaded_tp **utpp, struct uploaded_tsv **utsvp,
+ char **collectp)
{
char *p = line;
@@ -4321,6 +4343,11 @@ tfile_interp_line (char *line,
p += strlen ("tsv ");
parse_tsv_definition (p, utsvp);
}
+ else if (strncmp (p, "dc ", strlen ("dc ")) == 0)
+ {
+ p += strlen ("dc ");
+ *collectp = xstrdup (p);
+ }
else
warning (_("Ignoring trace file definition \"%s\""), line);
}
--- a/tracepoint.h
+++ b/tracepoint.h
@@ -296,6 +296,10 @@ struct trace_file_write_ops
void (*write_uploaded_tp) (struct trace_file_writer *self,
struct uploaded_tp *tp);
+ /* Write the tracepoint default collect. */
+ void (*write_default_collect) (struct trace_file_writer *self,
+ char *collect);
+
/* Write to mark the end of the definition part. */
void (*write_definition_end) (struct trace_file_writer *self);
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH] store trace default-collect to target [4/6] save tracepoint
2013-04-11 8:35 [PATCH] store trace default-collect to target [0/6] Hui Zhu
` (2 preceding siblings ...)
2013-04-11 10:33 ` [PATCH] store trace default-collect to target [3/6] tfile Hui Zhu
@ 2013-04-11 10:36 ` Hui Zhu
2013-05-13 6:03 ` Hui Zhu
2013-04-11 10:48 ` [PATCH] store trace default-collect to target [5/6] doc Hui Zhu
` (2 subsequent siblings)
6 siblings, 1 reply; 34+ messages in thread
From: Hui Zhu @ 2013-04-11 10:36 UTC (permalink / raw)
To: gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 201 bytes --]
Hi,
This patch make save tracepoint command save default-collect to source file.
Thanks,
Hui
2013-04-11 Hui Zhu <hui@codesourcery.com>
* breakpoint.c (save_breakpoints): Handle default_collect.
[-- Attachment #2: defc-save.txt --]
[-- Type: text/plain, Size: 369 bytes --]
--- a/breakpoint.c
+++ b/breakpoint.c
@@ -15606,7 +15606,10 @@ save_breakpoints (char *filename, int fr
make_cleanup_ui_file_delete (fp);
if (extra_trace_bits)
- save_trace_state_variables (fp);
+ {
+ fprintf_unfiltered (fp, "set default-collect $%s\n", default_collect);
+ save_trace_state_variables (fp);
+ }
ALL_BREAKPOINTS (tp)
{
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH] store trace default-collect to target [5/6] doc
2013-04-11 8:35 [PATCH] store trace default-collect to target [0/6] Hui Zhu
` (3 preceding siblings ...)
2013-04-11 10:36 ` [PATCH] store trace default-collect to target [4/6] save tracepoint Hui Zhu
@ 2013-04-11 10:48 ` Hui Zhu
2013-04-11 22:59 ` Yao Qi
2013-04-11 23:00 ` Eli Zaretskii
2013-04-11 10:49 ` [PATCH] store trace default-collect to target [6/6] test Hui Zhu
2013-05-13 5:33 ` [PATCH] store trace default-collect to target [0/6] Hui Zhu
6 siblings, 2 replies; 34+ messages in thread
From: Hui Zhu @ 2013-04-11 10:48 UTC (permalink / raw)
To: gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 179 bytes --]
Hi,
This patch is doc update for "QTDDCsrc" and "qTDC".
Thanks,
Hui
2013-04-11 Hui Zhu <hui@codesourcery.com>
* gdb.texinfo (Tracepoint Packets) Add "QTDDCsrc" and "qTDC".
[-- Attachment #2: defc-doc.txt --]
[-- Type: text/plain, Size: 1713 bytes --]
--- a/doc/gdb.texinfo
+++ b/doc/gdb.texinfo
@@ -37792,8 +37792,10 @@ encoded). @value{GDBN} will continue to
@itemx QTDP
@itemx QTDPsrc
@itemx QTDV
+@itemx QTDDCsrc
@itemx qTfP
@itemx qTfV
+@itemx qTDC
@itemx QTFrame
@itemx qTMinFTPILen
@@ -38382,6 +38384,22 @@ the option of not using this packet for
target should simply create the trace state variables as they are
mentioned in expressions.
+@item QTDDCsrc:@var{bytes}
+@cindex define default collect, remote request
+@cindex @samp{QTDDCsrc} packet
+@var{bytes} is the string, encoded in hexadecimal.
+It specify a source string of default collect.
+The target does not need to do anything with source strings except
+report them back as part of the replies to the @samp{qTDC} query packets.
+
+Replies:
+@table @samp
+@item OK
+The packet was understood and carried out.
+@item @w{}
+The packet was not recognized.
+@end table
+
@item QTFrame:@var{n}
@cindex @samp{QTFrame} packet
Select the @var{n}'th tracepoint frame from the buffer, and use the
@@ -38637,6 +38655,24 @@ and multiple @code{qTsV} to get addition
these packets follow the syntax of the @code{QTDV} packets that define
trace state variables.
+@item qTDC
+@cindex @samp{qTDC} packet
+@itemx qTDC
+@cindex @samp{qTDC} packet
+These packets request default collect on the target. Replies to
+this packet generally take the form of the @code{QTDDCsrc} packet that
+define default collect.
+
+Replies:
+@table @samp
+@item DC@var{bytes}
+@var{bytes} is the string, encoded in hexadecimal. It take the form of
+the @code{QTDDCsrc} packet that define default collect.
+
+@item @w{}
+The packet was not recognized.
+@end table
+
@item qTfSTM
@itemx qTsSTM
@anchor{qTfSTM}
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH] store trace default-collect to target [6/6] test
2013-04-11 8:35 [PATCH] store trace default-collect to target [0/6] Hui Zhu
` (4 preceding siblings ...)
2013-04-11 10:48 ` [PATCH] store trace default-collect to target [5/6] doc Hui Zhu
@ 2013-04-11 10:49 ` Hui Zhu
2013-04-11 13:14 ` Yao Qi
2013-05-13 5:33 ` [PATCH] store trace default-collect to target [0/6] Hui Zhu
6 siblings, 1 reply; 34+ messages in thread
From: Hui Zhu @ 2013-04-11 10:49 UTC (permalink / raw)
To: gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 435 bytes --]
Hi,
This patch add test about default-collect to disconnected-tracing.exp for remote and tstatus.exp for tfile.
I test them with:
make check RUNTESTFLAGS="--target_board=native-gdbserver disconnected-tracing.exp tstatus.exp"
Thanks,
Hui
2013-04-11 Hui Zhu <hui@codesourcery.com>
* gdb.trace/disconnected-tracing.exp (disconnected_tracing): Add
test for default-collect.
* gdb.trace/tstatus.exp: Add test for default-collect.
[-- Attachment #2: defc-doc.txt --]
[-- Type: text/plain, Size: 1713 bytes --]
--- a/doc/gdb.texinfo
+++ b/doc/gdb.texinfo
@@ -37792,8 +37792,10 @@ encoded). @value{GDBN} will continue to
@itemx QTDP
@itemx QTDPsrc
@itemx QTDV
+@itemx QTDDCsrc
@itemx qTfP
@itemx qTfV
+@itemx qTDC
@itemx QTFrame
@itemx qTMinFTPILen
@@ -38382,6 +38384,22 @@ the option of not using this packet for
target should simply create the trace state variables as they are
mentioned in expressions.
+@item QTDDCsrc:@var{bytes}
+@cindex define default collect, remote request
+@cindex @samp{QTDDCsrc} packet
+@var{bytes} is the string, encoded in hexadecimal.
+It specify a source string of default collect.
+The target does not need to do anything with source strings except
+report them back as part of the replies to the @samp{qTDC} query packets.
+
+Replies:
+@table @samp
+@item OK
+The packet was understood and carried out.
+@item @w{}
+The packet was not recognized.
+@end table
+
@item QTFrame:@var{n}
@cindex @samp{QTFrame} packet
Select the @var{n}'th tracepoint frame from the buffer, and use the
@@ -38637,6 +38655,24 @@ and multiple @code{qTsV} to get addition
these packets follow the syntax of the @code{QTDV} packets that define
trace state variables.
+@item qTDC
+@cindex @samp{qTDC} packet
+@itemx qTDC
+@cindex @samp{qTDC} packet
+These packets request default collect on the target. Replies to
+this packet generally take the form of the @code{QTDDCsrc} packet that
+define default collect.
+
+Replies:
+@table @samp
+@item DC@var{bytes}
+@var{bytes} is the string, encoded in hexadecimal. It take the form of
+the @code{QTDDCsrc} packet that define default collect.
+
+@item @w{}
+The packet was not recognized.
+@end table
+
@item qTfSTM
@itemx qTsSTM
@anchor{qTfSTM}
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [6/6] test
2013-04-11 10:49 ` [PATCH] store trace default-collect to target [6/6] test Hui Zhu
@ 2013-04-11 13:14 ` Yao Qi
2013-04-11 14:01 ` Hui Zhu
0 siblings, 1 reply; 34+ messages in thread
From: Yao Qi @ 2013-04-11 13:14 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches ml
On 04/11/2013 02:19 PM, Hui Zhu wrote:
> This patch add test about default-collect to disconnected-tracing.exp for remote and tstatus.exp for tfile.
>
> I test them with:
> make check RUNTESTFLAGS="--target_board=native-gdbserver disconnected-tracing.exp tstatus.exp"
Hui,
You attached the wrong patch in the mail.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [6/6] test
2013-04-11 13:14 ` Yao Qi
@ 2013-04-11 14:01 ` Hui Zhu
2013-04-11 15:24 ` Yao Qi
0 siblings, 1 reply; 34+ messages in thread
From: Hui Zhu @ 2013-04-11 14:01 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 403 bytes --]
On 04/11/13 15:30, Yao Qi wrote:
> On 04/11/2013 02:19 PM, Hui Zhu wrote:
>> This patch add test about default-collect to disconnected-tracing.exp for remote and tstatus.exp for tfile.
>>
>> I test them with:
>> make check RUNTESTFLAGS="--target_board=native-gdbserver disconnected-tracing.exp tstatus.exp"
>
> Hui,
> You attached the wrong patch in the mail.
>
Oops. post the right one.
Thanks,
Hui
[-- Attachment #2: defc-test.txt --]
[-- Type: text/plain, Size: 2015 bytes --]
--- a/testsuite/gdb.trace/disconnected-tracing.exp
+++ b/testsuite/gdb.trace/disconnected-tracing.exp
@@ -65,6 +65,8 @@ proc disconnected_tracing { } {
"collect foo" "^$"
gdb_test "break end" "Breakpoint ${decimal} at .*"
+ gdb_test_no_output "set default-collect \$regs"
+
gdb_test_no_output "tstart"
gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
@@ -73,6 +75,8 @@ proc disconnected_tracing { } {
gdb_test "info tracepoints" ".*in start at.*" \
"first info tracepoints"
+ gdb_test_no_output "set default-collect"
+
gdb_test "disconnect" "Ending remote debugging\\." "first disconnect"
if { [gdb_reconnect] == 0 } {
pass "first reconnect after unload"
@@ -83,6 +87,8 @@ proc disconnected_tracing { } {
gdb_test "info tracepoints" ".*in start at.*" \
"second info tracepoints"
+ gdb_test "show default-collect" "The list of expressions to collect by default is \"\\\$regs\".*"
+
delete_breakpoints
gdb_test "info tracepoints" ".*No tracepoints..*" \
"third info tracepoints"
--- a/testsuite/gdb.trace/tstatus.exp
+++ b/testsuite/gdb.trace/tstatus.exp
@@ -137,6 +137,8 @@ proc test_tracepoints {} {
test_tracepoints
+gdb_test_no_output "set default-collect \$regs"
+
set tracefile [standard_output_file ${testfile}]
# Save trace frames to tfile.
gdb_test "tsave ${tracefile}.tf" \
@@ -147,6 +149,8 @@ gdb_test "tsave -ctf ${tracefile}.ctf" \
"Trace data saved to directory '${tracefile}.ctf'.*" \
"save ctf trace file"
+gdb_test_no_output "set default-collect"
+
# Change target to tfile.
set test "change to tfile target"
gdb_test_multiple "target tfile ${tracefile}.tf" "$test" {
@@ -159,6 +163,8 @@ gdb_test_multiple "target tfile ${tracef
}
}
+gdb_test "show default-collect" "The list of expressions to collect by default is \"\\\$regs\".*"
+
# Convert "(because I can) to "\(because I can\)"
set tstatus_output [string map {\( \\(} $tstatus_output]
set tstatus_output [string map {\) \\)} $tstatus_output]
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [6/6] test
2013-04-11 14:01 ` Hui Zhu
@ 2013-04-11 15:24 ` Yao Qi
2013-04-16 15:44 ` Hui Zhu
0 siblings, 1 reply; 34+ messages in thread
From: Yao Qi @ 2013-04-11 15:24 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches ml
On 04/11/2013 03:40 PM, Hui Zhu wrote:
> --- a/testsuite/gdb.trace/tstatus.exp
> +++ b/testsuite/gdb.trace/tstatus.exp
> @@ -137,6 +137,8 @@ proc test_tracepoints {} {
>
> test_tracepoints
>
> +gdb_test_no_output "set default-collect \$regs"
> +
> set tracefile [standard_output_file ${testfile}]
> # Save trace frames to tfile.
> gdb_test "tsave ${tracefile}.tf" \
> @@ -147,6 +149,8 @@ gdb_test "tsave -ctf ${tracefile}.ctf" \
> "Trace data saved to directory '${tracefile}.ctf'.*" \
> "save ctf trace file"
>
> +gdb_test_no_output "set default-collect"
> +
> # Change target to tfile.
> set test "change to tfile target"
> gdb_test_multiple "target tfile ${tracefile}.tf" "$test" {
> @@ -159,6 +163,8 @@ gdb_test_multiple "target tfile ${tracef
> }
> }
>
> +gdb_test "show default-collect" "The list of expressions to collect by default is \"\\\$regs\".*"
> +
> # Convert "(because I can) to "\(because I can\)"
> set tstatus_output [string map {\( \\(} $tstatus_output]
> set tstatus_output [string map {\) \\)} $tstatus_output]
I am afraid that tstatus.exp is not a good place to test
"default-collect". The tstatus.exp is to test the output of command
'tstatus' in various situations, and also test that the output of
'tstatus' command on tfile target is identical to its output on the ctf
target. Probably, actions.exp is better, IMO.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [1/6] target, trace and remote
2013-04-11 8:37 ` [PATCH] store trace default-collect to target [1/6] target, trace and remote Hui Zhu
@ 2013-04-11 22:58 ` Yao Qi
2013-04-16 15:22 ` Hui Zhu
2013-04-11 22:59 ` Abid, Hafiz
1 sibling, 1 reply; 34+ messages in thread
From: Yao Qi @ 2013-04-11 22:58 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches ml
On 04/11/2013 02:16 PM, Hui Zhu wrote:
> --- a/remote.c
> +++ b/remote.c
> @@ -215,6 +215,8 @@ static int remote_get_trace_status (stru
> static int remote_upload_tracepoints (struct uploaded_tp **utpp);
>
> static int remote_upload_trace_state_variables (struct uploaded_tsv **utsvp);
> +
> +static void remote_upload_trace_default_collest (char **collectp);
^^^^^^^ typo "collect"
>
> static void remote_query_supported (void);
>
> @@ -3567,6 +3569,7 @@ remote_start_remote (int from_tty, struc
> {
> struct uploaded_tp *uploaded_tps = NULL;
> struct uploaded_tsv *uploaded_tsvs = NULL;
> + char *uploaded_default_collest = NULL;
^^^^^^^ typo.
>
> if (current_trace_status ()->running)
> printf_filtered (_("Trace is already running on the target.\n"));
> @@ -3581,6 +3584,10 @@ remote_start_remote (int from_tty, struc
> remote_upload_tracepoints (&uploaded_tps);
>
> merge_uploaded_tracepoints (&uploaded_tps);
> +
> + remote_upload_trace_default_collest (&uploaded_default_collest);
> +
> + trace_set_default_collect (uploaded_default_collest);
Likewise.
> }
>
> /* The thread and inferior lists are now synchronized with the
> @@ -10567,6 +10574,23 @@ remote_download_tracepoint (struct bp_lo
> do_cleanups (old_chain);
> }
>
> +static void
> +remote_download_tracepoint_default_collect (char *collect)
Add a comment to this function.
>
> +static void
> +remote_upload_trace_default_collest (char **collectp)
Comments to this function are needed as well.
> +/* Not overwrite default collect If COLLECT is NULL or its size is 0. */
> +
> +void
> +trace_set_default_collect (char *collect)
> +{
> + if (collect != NULL && strlen (collect) != 0)
> + {
> + xfree (default_collect);
> + default_collect = collect;
> + }
> +}
It looks incorrect to me. When we change target to a tfile, in which
the default-collect is "", the variable default_collect won't be updated.
Supposing we have two tfile actions.tf and actions1.tf, the
default-collect is "$regs" and "" respectively,
(gdb) target tfile testsuite/gdb.trace/actions.tf
(gdb) show default-collect
The list of expressions to collect by default is "$regs".
(gdb) target tfile testsuite/gdb.trace/actions1.tf
(gdb) show default-collect
The list of expressions to collect by default is "$regs".
I don't have other comments.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [1/6] target, trace and remote
2013-04-11 8:37 ` [PATCH] store trace default-collect to target [1/6] target, trace and remote Hui Zhu
2013-04-11 22:58 ` Yao Qi
@ 2013-04-11 22:59 ` Abid, Hafiz
1 sibling, 0 replies; 34+ messages in thread
From: Abid, Hafiz @ 2013-04-11 22:59 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches ml
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii"; delsp=Yes; format=Flowed, Size: 4884 bytes --]
Hi Hui,
> + putpkt (buf);
> + remote_get_noisy_reply (&target_buf, &target_buf_size);
> + if (strcmp (target_buf, "OK"))
> + warning (_("\
Just a small comment on style. I think it is better to be explicit in
such case and write != 0. Also I was advised by Pedro recently that new
packets should be using packet_ok which will eliminate the need for
strcmp here anyway.
> + putpkt ("qTDC");
> + getpkt (&rs->buf, &rs->buf_size, 0);
> + if (strncmp (rs->buf, "DC", 2))
> + {
Why not remote_get_noisy_reply here.
Regards,
Abid
From gdb-patches-return-100409-listarch-gdb-patches=sources.redhat.com@sourceware.org Thu Apr 11 16:55:38 2013
Return-Path: <gdb-patches-return-100409-listarch-gdb-patches=sources.redhat.com@sourceware.org>
Delivered-To: listarch-gdb-patches@sources.redhat.com
Received: (qmail 16574 invoked by alias); 11 Apr 2013 16:55:38 -0000
Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <gdb-patches.sourceware.org>
List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-patches/>
List-Post: <mailto:gdb-patches@sourceware.org>
List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs>
Sender: gdb-patches-owner@sourceware.org
Delivered-To: mailing list gdb-patches@sourceware.org
Received: (qmail 16523 invoked by uid 89); 11 Apr 2013 16:55:37 -0000
X-Spam-SWARE-Status: No, score=-7.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_YM autolearn=ham version=3.3.1
Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 11 Apr 2013 16:55:37 +0000
Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3BGtZKn021045 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits%6 verify=OK) for <gdb-patches@sourceware.org>; Thu, 11 Apr 2013 12:55:35 -0400
Received: from host2.jankratochvil.net (ovpn-116-44.ams2.redhat.com [10.36.116.44]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3BGtV1f016475 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits\x128 verify=NO); Thu, 11 Apr 2013 12:55:34 -0400
Date: Thu, 11 Apr 2013 22:59:00 -0000
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>, Pedro Alves <palves@redhat.com>
Subject: [commit#2] configure.tgt gcore fix [Re: [commit] [patch 2/2+rfc+doc] Install gcore by default (+new man page)]
Message-ID: <20130411165531.GA1381@host2.jankratochvil.net>
References: <20130407185443.GB15389@host2.jankratochvil.net> <83r4ilawlx.fsf@gnu.org> <20130408172841.GA28868@host2.jankratochvil.net> <87hajgua2o.fsf@fleche.redhat.com> <516424FE.4050307@redhat.com> <20130409165525.GA29570@host2.jankratochvil.net> <51654DF0.3090101@redhat.com> <20130410194910.GA3941@host2.jankratochvil.net> <51669166.5060007@redhat.com> <20130411142957.GA22567@host2.jankratochvil.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20130411142957.GA22567@host2.jankratochvil.net>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-IsSubscribed: yes
X-SW-Source: 2013-04/txt/msg00335.txt.bz2
Content-length: 1390
On Thu, 11 Apr 2013 16:29:57 +0200, Jan Kratochvil wrote:
> Checked in.
I have found gcore is not available for:
i[34567]86-*-linux*)
^I# Target: Intel 386 running GNU/Linux
^Igdb_target_obs="i386-tdep.o i386-linux-tdep.o glibc-tdep.o i387-tdep.o \
^I^I^Isolib-svr4.o symfile-mem.o \
^I^I^Ilinux-tdep.o linux-record.o"
because " linux-tdep.o " is not found there.
Checked in.
Sorry,
Jan
http://sourceware.org/ml/gdb-cvs/2013-04/msg00110.html
--- src/gdb/ChangeLog 2013/04/11 14:13:42 1.15398
+++ src/gdb/ChangeLog 2013/04/11 16:53:01 1.15399
@@ -22,6 +22,9 @@
* gcore.in: ... here. Remove gcore.sh comment. Use GDB_TRANSFORM_NAME
and GCORE_TRANSFORM_NAME substitutions.
+ Fix parsing tabs in ${gdb_target_obs}.
+ * configure.tgt (gdb_have_gcore): Replace case with for and if.
+
2013-04-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* remote.c (unpush_and_perror): Add output message final dot.
--- src/gdb/configure.tgt 2013/04/11 14:13:43 1.273
+++ src/gdb/configure.tgt 2013/04/11 16:53:01 1.274
@@ -707,11 +707,9 @@
# Check whether this target supports gcore.
# Such target has to call set_gdbarch_find_memory_regions.
-case " ${gdb_target_obs} " in
- *" linux-tdep.o "*)
+gdb_have_gcoreúlse
+for t in x ${gdb_target_obs}; do
+ if test "$t" = linux-tdep.o; then
gdb_have_gcore=true
- ;;
- *)
- gdb_have_gcoreúlse
- ;;
-esac
+ fi
+done
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [3/6] tfile
2013-04-11 10:33 ` [PATCH] store trace default-collect to target [3/6] tfile Hui Zhu
@ 2013-04-11 22:59 ` Yao Qi
2013-04-12 14:58 ` Hui Zhu
0 siblings, 1 reply; 34+ messages in thread
From: Yao Qi @ 2013-04-11 22:59 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches ml
On 04/11/2013 02:17 PM, Hui Zhu wrote:
> /* This is the implementation of trace_file_write_ops method
> + write_default_collect. */
> +
> +static void
> +ctf_write_default_collect (struct trace_file_writer *self,
> + char *collect)
> +{
> + /* It is not supported yet to write default collect
> + into CTF trace data. */
> +}
> +
It is pity to see "default-collect" is not written to CTF in this
patch. The patch below is about teaching GDB to write
"default-collect" action in CTF and read "default-collect" action from
CTF. Do you mind incorporating the patch below into your patch series,
so that your series is more complete.
--
Yao (é½å°§)
gdb:
2013-04-11 Yao Qi <yao@codesourcery.com>
* ctf.c (CTF_EVENT_ID_DEFAULT_COLLECT): New macro.
(ctf_write_header): Write metadata for "default-collect"
action.
(ctf_write_default_collect): Write "default-collect" action
in CTF.
(ctf_read_default_collect): New.
(ctf_open): Call ctf_read_default_collect.
---
gdb/ctf.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 2dd2ed8..5757b47 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -74,6 +74,7 @@
#define CTF_EVENT_ID_STATUS 4
#define CTF_EVENT_ID_TSV_DEF 5
#define CTF_EVENT_ID_TP_DEF 6
+#define CTF_EVENT_ID_DEFAULT_COLLECT 7
/* The state kept while writing the CTF datastream file. */
@@ -428,6 +429,16 @@ ctf_write_header (struct trace_file_writer *self)
"\t};\n"
"};\n", CTF_EVENT_ID_TP_DEF);
+ ctf_save_write_metadata (&writer->tcs, "\n");
+ ctf_save_write_metadata (&writer->tcs,
+ "event {\n\tname = \"default_collect\";\n"
+ "\tid = %u;\n"
+ "\tfields := struct { \n"
+ "\t\tchars contents;\n"
+ "\t};\n"
+ "};\n",
+ CTF_EVENT_ID_DEFAULT_COLLECT);
+
gdb_assert (writer->tcs.content_size == 0);
gdb_assert (writer->tcs.packet_start == 0);
@@ -622,8 +633,17 @@ static void
ctf_write_default_collect (struct trace_file_writer *self,
char *collect)
{
- /* It is not supported yet to write default collect
- into CTF trace data. */
+ struct ctf_trace_file_writer *writer
+ = (struct ctf_trace_file_writer *) self;
+ int32_t int32;
+
+ /* Event Id. */
+ int32 = CTF_EVENT_ID_DEFAULT_COLLECT;
+ ctf_save_align_write (&writer->tcs, (gdb_byte *) &int32, 4, 4);
+
+ /* Contents. */
+ ctf_save_write (&writer->tcs, collect, strlen (collect) + 1);
+
}
/* This is the implementation of trace_file_write_ops method
@@ -1149,6 +1169,39 @@ ctf_read_tp (struct uploaded_tp **uploaded_tps)
}
}
+/* Read a CTF event on "default-collect" and update the
+ "default-collect" action. */
+
+static void
+ctf_read_default_collect (void)
+{
+ struct bt_ctf_event *event;
+ const struct bt_definition *scope;
+ uint32_t u32;
+ char *default_collect;
+
+ event = bt_ctf_iter_read_event (ctf_iter);
+ scope = bt_ctf_get_top_level_scope (event,
+ BT_STREAM_EVENT_HEADER);
+ u32 = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope,
+ "id"));
+
+ if (u32 != CTF_EVENT_ID_DEFAULT_COLLECT)
+ error (_("Wrong event id!"));
+
+ default_collect
+ = bt_ctf_get_string (bt_ctf_get_field (event, scope, "contents"));
+
+ if (default_collect == NULL)
+ default_collect = xstrdup ("");
+ else
+ default_collect = xstrdup (default_collect);
+
+ trace_set_default_collect (default_collect);
+
+ bt_iter_next (bt_ctf_get_iter (ctf_iter));
+}
+
/* This is the implementation of target_ops method to_open. Open CTF
trace data, read trace status, trace state variables and tracepoint
definitions from the first packet. Set the start position at the
@@ -1190,6 +1243,8 @@ ctf_open (char *dirname, int from_tty)
ctf_read_tp (&uploaded_tps);
+ ctf_read_default_collect ();
+
event = bt_ctf_iter_read_event (ctf_iter);
/* EVENT can be NULL if we've already gone to the end of stream of
events. */
--
1.7.7.6
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [5/6] doc
2013-04-11 10:48 ` [PATCH] store trace default-collect to target [5/6] doc Hui Zhu
@ 2013-04-11 22:59 ` Yao Qi
2013-04-16 14:35 ` Hui Zhu
2013-04-11 23:00 ` Eli Zaretskii
1 sibling, 1 reply; 34+ messages in thread
From: Yao Qi @ 2013-04-11 22:59 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches ml
On 04/11/2013 02:19 PM, Hui Zhu wrote:
> This patch is doc update for "QTDDCsrc" and "qTDC".
We need a NEWS entry for these new packets.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [5/6] doc
2013-04-11 10:48 ` [PATCH] store trace default-collect to target [5/6] doc Hui Zhu
2013-04-11 22:59 ` Yao Qi
@ 2013-04-11 23:00 ` Eli Zaretskii
2013-04-16 15:39 ` Hui Zhu
1 sibling, 1 reply; 34+ messages in thread
From: Eli Zaretskii @ 2013-04-11 23:00 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches
> Date: Thu, 11 Apr 2013 14:19:03 +0800
> From: Hui Zhu <hui_zhu@mentor.com>
>
> This patch is doc update for "QTDDCsrc" and "qTDC".
Thanks.
> +@item QTDDCsrc:@var{bytes}
> +@cindex define default collect, remote request
> +@cindex @samp{QTDDCsrc} packet
> +@var{bytes} is the string, encoded in hexadecimal.
> +It specify a source string of default collect.
^^^^^^^
"specifies"
By the way, why is it called a "source" string?
> +These packets request default collect on the target. Replies to
> +this packet generally take the form of the @code{QTDDCsrc} packet that
> +define default collect.
^^^^^^
"defines"
> +Replies:
> +@table @samp
> +@item DC@var{bytes}
> +@var{bytes} is the string, encoded in hexadecimal. It take the form of
> +the @code{QTDDCsrc} packet that define default collect.^^^^
^^^^^^
"takes" and "defines"
OK with those changes.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [3/6] tfile
2013-04-11 22:59 ` Yao Qi
@ 2013-04-12 14:58 ` Hui Zhu
2013-04-15 19:01 ` Hui Zhu
0 siblings, 1 reply; 34+ messages in thread
From: Hui Zhu @ 2013-04-12 14:58 UTC (permalink / raw)
To: Yao Qi; +Cc: Hui Zhu, gdb-patches ml
Hi Yao,
Thanks for your patch.
I should do it but I didn't because when I work on this part I cannot
find example in GDB src bceause the code that can be example is still
not check in. :P
Best,
Hui
On Thu, Apr 11, 2013 at 8:53 PM, Yao Qi <yao@codesourcery.com> wrote:
> On 04/11/2013 02:17 PM, Hui Zhu wrote:
>> /* This is the implementation of trace_file_write_ops method
>> + write_default_collect. */
>> +
>> +static void
>> +ctf_write_default_collect (struct trace_file_writer *self,
>> + char *collect)
>> +{
>> + /* It is not supported yet to write default collect
>> + into CTF trace data. */
>> +}
>> +
>
> It is pity to see "default-collect" is not written to CTF in this
> patch. The patch below is about teaching GDB to write
> "default-collect" action in CTF and read "default-collect" action from
> CTF. Do you mind incorporating the patch below into your patch series,
> so that your series is more complete.
>
> --
> Yao (齐尧)
>
> gdb:
>
> 2013-04-11 Yao Qi <yao@codesourcery.com>
>
> * ctf.c (CTF_EVENT_ID_DEFAULT_COLLECT): New macro.
> (ctf_write_header): Write metadata for "default-collect"
> action.
> (ctf_write_default_collect): Write "default-collect" action
> in CTF.
> (ctf_read_default_collect): New.
> (ctf_open): Call ctf_read_default_collect.
> ---
> gdb/ctf.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
> 1 files changed, 57 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/ctf.c b/gdb/ctf.c
> index 2dd2ed8..5757b47 100644
> --- a/gdb/ctf.c
> +++ b/gdb/ctf.c
> @@ -74,6 +74,7 @@
> #define CTF_EVENT_ID_STATUS 4
> #define CTF_EVENT_ID_TSV_DEF 5
> #define CTF_EVENT_ID_TP_DEF 6
> +#define CTF_EVENT_ID_DEFAULT_COLLECT 7
>
> /* The state kept while writing the CTF datastream file. */
>
> @@ -428,6 +429,16 @@ ctf_write_header (struct trace_file_writer *self)
> "\t};\n"
> "};\n", CTF_EVENT_ID_TP_DEF);
>
> + ctf_save_write_metadata (&writer->tcs, "\n");
> + ctf_save_write_metadata (&writer->tcs,
> + "event {\n\tname = \"default_collect\";\n"
> + "\tid = %u;\n"
> + "\tfields := struct { \n"
> + "\t\tchars contents;\n"
> + "\t};\n"
> + "};\n",
> + CTF_EVENT_ID_DEFAULT_COLLECT);
> +
> gdb_assert (writer->tcs.content_size == 0);
> gdb_assert (writer->tcs.packet_start == 0);
>
> @@ -622,8 +633,17 @@ static void
> ctf_write_default_collect (struct trace_file_writer *self,
> char *collect)
> {
> - /* It is not supported yet to write default collect
> - into CTF trace data. */
> + struct ctf_trace_file_writer *writer
> + = (struct ctf_trace_file_writer *) self;
> + int32_t int32;
> +
> + /* Event Id. */
> + int32 = CTF_EVENT_ID_DEFAULT_COLLECT;
> + ctf_save_align_write (&writer->tcs, (gdb_byte *) &int32, 4, 4);
> +
> + /* Contents. */
> + ctf_save_write (&writer->tcs, collect, strlen (collect) + 1);
> +
> }
>
> /* This is the implementation of trace_file_write_ops method
> @@ -1149,6 +1169,39 @@ ctf_read_tp (struct uploaded_tp **uploaded_tps)
> }
> }
>
> +/* Read a CTF event on "default-collect" and update the
> + "default-collect" action. */
> +
> +static void
> +ctf_read_default_collect (void)
> +{
> + struct bt_ctf_event *event;
> + const struct bt_definition *scope;
> + uint32_t u32;
> + char *default_collect;
> +
> + event = bt_ctf_iter_read_event (ctf_iter);
> + scope = bt_ctf_get_top_level_scope (event,
> + BT_STREAM_EVENT_HEADER);
> + u32 = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope,
> + "id"));
> +
> + if (u32 != CTF_EVENT_ID_DEFAULT_COLLECT)
> + error (_("Wrong event id!"));
> +
> + default_collect
> + = bt_ctf_get_string (bt_ctf_get_field (event, scope, "contents"));
> +
> + if (default_collect == NULL)
> + default_collect = xstrdup ("");
> + else
> + default_collect = xstrdup (default_collect);
> +
> + trace_set_default_collect (default_collect);
> +
> + bt_iter_next (bt_ctf_get_iter (ctf_iter));
> +}
> +
> /* This is the implementation of target_ops method to_open. Open CTF
> trace data, read trace status, trace state variables and tracepoint
> definitions from the first packet. Set the start position at the
> @@ -1190,6 +1243,8 @@ ctf_open (char *dirname, int from_tty)
>
> ctf_read_tp (&uploaded_tps);
>
> + ctf_read_default_collect ();
> +
> event = bt_ctf_iter_read_event (ctf_iter);
> /* EVENT can be NULL if we've already gone to the end of stream of
> events. */
> --
> 1.7.7.6
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [3/6] tfile
2013-04-12 14:58 ` Hui Zhu
@ 2013-04-15 19:01 ` Hui Zhu
2013-04-16 15:34 ` Hui Zhu
0 siblings, 1 reply; 34+ messages in thread
From: Hui Zhu @ 2013-04-15 19:01 UTC (permalink / raw)
To: gdb-patches ml; +Cc: Hui Zhu, Yao Qi
[-- Attachment #1: Type: text/plain, Size: 5737 bytes --]
Post a new version to fix the typo of "collest".
Thanks,
Hui
2013-04-15 Hui Zhu <hui@codesourcery.com>
* ctf.c (ctf_write_default_collect): New.
(trace_file_write_ops): Add ctf_write_default_collect.
* tracepoint.c (tfile_write_default_collect): New.
(trace_file_write_ops): Add tfile_write_default_collect.
(trace_save): Call writer->ops->write_default_collect.
(tfile_interp_line): Add collectp.
(tfile_open): Add support of default collect.
* tracepoint.h (trace_file_write_ops): Add write_default_collect.
On Fri, Apr 12, 2013 at 6:45 PM, Hui Zhu <teawater@gmail.com> wrote:
> Hi Yao,
>
> Thanks for your patch.
>
> I should do it but I didn't because when I work on this part I cannot
> find example in GDB src bceause the code that can be example is still
> not check in. :P
>
> Best,
> Hui
>
> On Thu, Apr 11, 2013 at 8:53 PM, Yao Qi <yao@codesourcery.com> wrote:
>> On 04/11/2013 02:17 PM, Hui Zhu wrote:
>>> /* This is the implementation of trace_file_write_ops method
>>> + write_default_collect. */
>>> +
>>> +static void
>>> +ctf_write_default_collect (struct trace_file_writer *self,
>>> + char *collect)
>>> +{
>>> + /* It is not supported yet to write default collect
>>> + into CTF trace data. */
>>> +}
>>> +
>>
>> It is pity to see "default-collect" is not written to CTF in this
>> patch. The patch below is about teaching GDB to write
>> "default-collect" action in CTF and read "default-collect" action from
>> CTF. Do you mind incorporating the patch below into your patch series,
>> so that your series is more complete.
>>
>> --
>> Yao (齐尧)
>>
>> gdb:
>>
>> 2013-04-11 Yao Qi <yao@codesourcery.com>
>>
>> * ctf.c (CTF_EVENT_ID_DEFAULT_COLLECT): New macro.
>> (ctf_write_header): Write metadata for "default-collect"
>> action.
>> (ctf_write_default_collect): Write "default-collect" action
>> in CTF.
>> (ctf_read_default_collect): New.
>> (ctf_open): Call ctf_read_default_collect.
>> ---
>> gdb/ctf.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
>> 1 files changed, 57 insertions(+), 2 deletions(-)
>>
>> diff --git a/gdb/ctf.c b/gdb/ctf.c
>> index 2dd2ed8..5757b47 100644
>> --- a/gdb/ctf.c
>> +++ b/gdb/ctf.c
>> @@ -74,6 +74,7 @@
>> #define CTF_EVENT_ID_STATUS 4
>> #define CTF_EVENT_ID_TSV_DEF 5
>> #define CTF_EVENT_ID_TP_DEF 6
>> +#define CTF_EVENT_ID_DEFAULT_COLLECT 7
>>
>> /* The state kept while writing the CTF datastream file. */
>>
>> @@ -428,6 +429,16 @@ ctf_write_header (struct trace_file_writer *self)
>> "\t};\n"
>> "};\n", CTF_EVENT_ID_TP_DEF);
>>
>> + ctf_save_write_metadata (&writer->tcs, "\n");
>> + ctf_save_write_metadata (&writer->tcs,
>> + "event {\n\tname = \"default_collect\";\n"
>> + "\tid = %u;\n"
>> + "\tfields := struct { \n"
>> + "\t\tchars contents;\n"
>> + "\t};\n"
>> + "};\n",
>> + CTF_EVENT_ID_DEFAULT_COLLECT);
>> +
>> gdb_assert (writer->tcs.content_size == 0);
>> gdb_assert (writer->tcs.packet_start == 0);
>>
>> @@ -622,8 +633,17 @@ static void
>> ctf_write_default_collect (struct trace_file_writer *self,
>> char *collect)
>> {
>> - /* It is not supported yet to write default collect
>> - into CTF trace data. */
>> + struct ctf_trace_file_writer *writer
>> + = (struct ctf_trace_file_writer *) self;
>> + int32_t int32;
>> +
>> + /* Event Id. */
>> + int32 = CTF_EVENT_ID_DEFAULT_COLLECT;
>> + ctf_save_align_write (&writer->tcs, (gdb_byte *) &int32, 4, 4);
>> +
>> + /* Contents. */
>> + ctf_save_write (&writer->tcs, collect, strlen (collect) + 1);
>> +
>> }
>>
>> /* This is the implementation of trace_file_write_ops method
>> @@ -1149,6 +1169,39 @@ ctf_read_tp (struct uploaded_tp **uploaded_tps)
>> }
>> }
>>
>> +/* Read a CTF event on "default-collect" and update the
>> + "default-collect" action. */
>> +
>> +static void
>> +ctf_read_default_collect (void)
>> +{
>> + struct bt_ctf_event *event;
>> + const struct bt_definition *scope;
>> + uint32_t u32;
>> + char *default_collect;
>> +
>> + event = bt_ctf_iter_read_event (ctf_iter);
>> + scope = bt_ctf_get_top_level_scope (event,
>> + BT_STREAM_EVENT_HEADER);
>> + u32 = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope,
>> + "id"));
>> +
>> + if (u32 != CTF_EVENT_ID_DEFAULT_COLLECT)
>> + error (_("Wrong event id!"));
>> +
>> + default_collect
>> + = bt_ctf_get_string (bt_ctf_get_field (event, scope, "contents"));
>> +
>> + if (default_collect == NULL)
>> + default_collect = xstrdup ("");
>> + else
>> + default_collect = xstrdup (default_collect);
>> +
>> + trace_set_default_collect (default_collect);
>> +
>> + bt_iter_next (bt_ctf_get_iter (ctf_iter));
>> +}
>> +
>> /* This is the implementation of target_ops method to_open. Open CTF
>> trace data, read trace status, trace state variables and tracepoint
>> definitions from the first packet. Set the start position at the
>> @@ -1190,6 +1243,8 @@ ctf_open (char *dirname, int from_tty)
>>
>> ctf_read_tp (&uploaded_tps);
>>
>> + ctf_read_default_collect ();
>> +
>> event = bt_ctf_iter_read_event (ctf_iter);
>> /* EVENT can be NULL if we've already gone to the end of stream of
>> events. */
>> --
>> 1.7.7.6
[-- Attachment #2: defc-tfile.txt --]
[-- Type: text/plain, Size: 4085 bytes --]
--- a/ctf.c
+++ b/ctf.c
@@ -616,6 +616,17 @@ ctf_write_uploaded_tp (struct trace_file
}
/* This is the implementation of trace_file_write_ops method
+ write_default_collect. */
+
+static void
+ctf_write_default_collect (struct trace_file_writer *self,
+ char *collect)
+{
+ /* It is not supported yet to write default collect
+ into CTF trace data. */
+}
+
+/* This is the implementation of trace_file_write_ops method
write_definition_end. */
static void
@@ -847,6 +858,7 @@ static const struct trace_file_write_ops
ctf_write_status,
ctf_write_uploaded_tsv,
ctf_write_uploaded_tp,
+ ctf_write_default_collect,
ctf_write_definition_end,
NULL,
&ctf_write_frame_ops,
--- a/tracepoint.c
+++ b/tracepoint.c
@@ -3237,6 +3237,19 @@ tfile_write_uploaded_tp (struct trace_fi
}
/* This is the implementation of trace_file_write_ops method
+ write_default_collect. */
+
+static void
+tfile_write_default_collect (struct trace_file_writer *self,
+ char *collect)
+{
+ struct tfile_trace_file_writer *writer
+ = (struct tfile_trace_file_writer *) self;
+
+ fprintf (writer->fp, "dc %s\n", collect);
+}
+
+/* This is the implementation of trace_file_write_ops method
write_definition_end. */
static void
@@ -3289,6 +3302,7 @@ static const struct trace_file_write_ops
tfile_write_status,
tfile_write_uploaded_tsv,
tfile_write_uploaded_tp,
+ tfile_write_default_collect,
tfile_write_definition_end,
tfile_write_raw_data,
NULL,
@@ -3378,6 +3392,8 @@ trace_save (const char *filename, struct
for (utp = uploaded_tps; utp; utp = utp->next)
writer->ops->write_uploaded_tp (writer, utp);
+ writer->ops->write_default_collect (writer, default_collect);
+
free_uploaded_tps (&uploaded_tps);
/* Mark the end of the definition section. */
@@ -4147,7 +4163,8 @@ int trace_regblock_size;
static void tfile_interp_line (char *line,
struct uploaded_tp **utpp,
- struct uploaded_tsv **utsvp);
+ struct uploaded_tsv **utsvp,
+ char **collectp);
/* Read SIZE bytes into READBUF from the trace frame, starting at
TRACE_FD's current position. Note that this call `read'
@@ -4182,6 +4199,7 @@ tfile_open (char *filename, int from_tty
struct trace_status *ts;
struct uploaded_tp *uploaded_tps = NULL;
struct uploaded_tsv *uploaded_tsvs = NULL;
+ char *uploaded_default_collect = NULL;
target_preopen (from_tty);
if (!filename)
@@ -4251,7 +4269,8 @@ tfile_open (char *filename, int from_tty
break;
linebuf[i] = '\0';
i = 0;
- tfile_interp_line (linebuf, &uploaded_tps, &uploaded_tsvs);
+ tfile_interp_line (linebuf, &uploaded_tps, &uploaded_tsvs,
+ &uploaded_default_collect);
}
else
linebuf[i++] = byte;
@@ -4289,6 +4308,8 @@ tfile_open (char *filename, int from_tty
merge_uploaded_tracepoints (&uploaded_tps);
+ trace_set_default_collect (uploaded_default_collect);
+
post_create_inferior (&tfile_ops, from_tty);
}
@@ -4297,7 +4318,8 @@ tfile_open (char *filename, int from_tty
static void
tfile_interp_line (char *line,
- struct uploaded_tp **utpp, struct uploaded_tsv **utsvp)
+ struct uploaded_tp **utpp, struct uploaded_tsv **utsvp,
+ char **collectp)
{
char *p = line;
@@ -4321,6 +4343,11 @@ tfile_interp_line (char *line,
p += strlen ("tsv ");
parse_tsv_definition (p, utsvp);
}
+ else if (strncmp (p, "dc ", strlen ("dc ")) == 0)
+ {
+ p += strlen ("dc ");
+ *collectp = xstrdup (p);
+ }
else
warning (_("Ignoring trace file definition \"%s\""), line);
}
--- a/tracepoint.h
+++ b/tracepoint.h
@@ -296,6 +296,10 @@ struct trace_file_write_ops
void (*write_uploaded_tp) (struct trace_file_writer *self,
struct uploaded_tp *tp);
+ /* Write the tracepoint default collect. */
+ void (*write_default_collect) (struct trace_file_writer *self,
+ char *collect);
+
/* Write to mark the end of the definition part. */
void (*write_definition_end) (struct trace_file_writer *self);
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [5/6] doc
2013-04-11 22:59 ` Yao Qi
@ 2013-04-16 14:35 ` Hui Zhu
0 siblings, 0 replies; 34+ messages in thread
From: Hui Zhu @ 2013-04-16 14:35 UTC (permalink / raw)
To: Yao Qi; +Cc: Hui Zhu, gdb-patches ml
Hi Yao,
On Thu, Apr 11, 2013 at 6:49 PM, Yao Qi <yao@codesourcery.com> wrote:
> On 04/11/2013 02:19 PM, Hui Zhu wrote:
>>
>> This patch is doc update for "QTDDCsrc" and "qTDC".
>
>
> We need a NEWS entry for these new packets.
>
Thanks for your remind. I will include it in the new patch that will
post later.
Thanks,
Hui
> --
> Yao (齐尧)
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [1/6] target, trace and remote
2013-04-11 22:58 ` Yao Qi
@ 2013-04-16 15:22 ` Hui Zhu
2013-05-13 6:00 ` Hui Zhu
0 siblings, 1 reply; 34+ messages in thread
From: Hui Zhu @ 2013-04-16 15:22 UTC (permalink / raw)
To: Yao Qi, Abid, Hafiz; +Cc: Hui Zhu, gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 4937 bytes --]
Hi Yao and Abid,
Thanks for your review.
On Thu, Apr 11, 2013 at 6:48 PM, Yao Qi <yao@codesourcery.com> wrote:
> On 04/11/2013 02:16 PM, Hui Zhu wrote:
>>
>> --- a/remote.c
>> +++ b/remote.c
>> @@ -215,6 +215,8 @@ static int remote_get_trace_status (stru
>> static int remote_upload_tracepoints (struct uploaded_tp **utpp);
>>
>> static int remote_upload_trace_state_variables (struct uploaded_tsv
>> **utsvp);
>> +
>> +static void remote_upload_trace_default_collest (char **collectp);
>
> ^^^^^^^ typo "collect"
Oops, all fixed.
>
>>
>> static void remote_query_supported (void);
>>
>> @@ -3567,6 +3569,7 @@ remote_start_remote (int from_tty, struc
>> {
>> struct uploaded_tp *uploaded_tps = NULL;
>> struct uploaded_tsv *uploaded_tsvs = NULL;
>> + char *uploaded_default_collest = NULL;
>
> ^^^^^^^ typo.
>
>>
>> if (current_trace_status ()->running)
>> printf_filtered (_("Trace is already running on the target.\n"));
>> @@ -3581,6 +3584,10 @@ remote_start_remote (int from_tty, struc
>> remote_upload_tracepoints (&uploaded_tps);
>>
>> merge_uploaded_tracepoints (&uploaded_tps);
>> +
>> + remote_upload_trace_default_collest (&uploaded_default_collest);
>> +
>> + trace_set_default_collect (uploaded_default_collest);
>
>
> Likewise.
>
>> }
>>
>> /* The thread and inferior lists are now synchronized with the
>> @@ -10567,6 +10574,23 @@ remote_download_tracepoint (struct bp_lo
>> do_cleanups (old_chain);
>> }
>>
>> +static void
>> +remote_download_tracepoint_default_collect (char *collect)
>
>
> Add a comment to this function.
Fixed.
/* Download COLLECT that is default collect string to target. */
>
>>
>> +static void
>> +remote_upload_trace_default_collest (char **collectp)
>
>
> Comments to this function are needed as well.
Fixed.
/* Download COLLECT that is default collect string to target. */
static void
remote_download_tracepoint_default_collect (char *collect)
>
>> +/* Not overwrite default collect If COLLECT is NULL or its size is 0. */
>> +
>> +void
>> +trace_set_default_collect (char *collect)
>> +{
>> + if (collect != NULL && strlen (collect) != 0)
>> + {
>> + xfree (default_collect);
>> + default_collect = collect;
>> + }
>> +}
>
>
> It looks incorrect to me. When we change target to a tfile, in which the
> default-collect is "", the variable default_collect won't be updated.
>
> Supposing we have two tfile actions.tf and actions1.tf, the default-collect
> is "$regs" and "" respectively,
>
> (gdb) target tfile testsuite/gdb.trace/actions.tf
> (gdb) show default-collect
> The list of expressions to collect by default is "$regs".
> (gdb) target tfile testsuite/gdb.trace/actions1.tf
> (gdb) show default-collect
> The list of expressions to collect by default is "$regs".
>
> I don't have other comments.
Agree with you. Updated patch for it.
>
> --
> Yao (齐尧)
On Thu, Apr 11, 2013 at 10:08 PM, Abid, Hafiz <hafiz_abid@mentor.com> wrote:
> Hi Hui,
>>
>> + putpkt (buf);
>> + remote_get_noisy_reply (&target_buf, &target_buf_size);
>> + if (strcmp (target_buf, "OK"))
>> + warning (_("\
>
>
> Just a small comment on style. I think it is better to be explicit in such
> case and write != 0. Also I was advised by Pedro recently that new packets
> should be using packet_ok which will eliminate the need for strcmp here
> anyway.
>
Update there part use packet_ok.
>> + putpkt ("qTDC");
>> + getpkt (&rs->buf, &rs->buf_size, 0);
>> + if (strncmp (rs->buf, "DC", 2))
>> + {
>
> Why not remote_get_noisy_reply here.
Changed. And I also add "PACKET_qTDC" for this part. But I am not
sure set "remote_protocol_packets[PACKET_qTDC].support" inside the
function is a good choice or not.
>
>
> Regards,
> Abid
Post a new version for that. Please help me review it.
Best,
Hui
2013-04-16 Hui Zhu <hui@codesourcery.com>
* remote.c (remote_upload_trace_default_collect): New static.
(PACKET_QTDDCsrc, PACKET_qTDC): New.
(remote_start_remote): Call remote_upload_trace_default_collect
and trace_set_default_collect.
(remote_download_tracepoint_default_collect): New.
(remote_can_download_tracepoint): Set
to_download_tracepoint_default_collect.
(remote_upload_trace_default_collect): New.
(_initialize_remote): Add QTDDCsrc and qTDC.
* target.c (update_current_target): Add
to_download_tracepoint_default_collect.
* target.h (target_ops): to_download_tracepoint_default_collect.
(target_download_tracepoint_default_collect): New.
* tracepoint.c (start_tracing): Call
target_download_tracepoint_default_collect.
(trace_set_default_collect): New.
* tracepoint.h (trace_set_default_collect): New extern.
[-- Attachment #2: defc-remote.txt --]
[-- Type: text/plain, Size: 7071 bytes --]
--- a/remote.c
+++ b/remote.c
@@ -215,6 +215,8 @@ static int remote_get_trace_status (stru
static int remote_upload_tracepoints (struct uploaded_tp **utpp);
static int remote_upload_trace_state_variables (struct uploaded_tsv **utsvp);
+
+static void remote_upload_trace_default_collect (char **collectp);
static void remote_query_supported (void);
@@ -1286,6 +1288,8 @@ enum {
PACKET_Qbtrace_off,
PACKET_Qbtrace_bts,
PACKET_qXfer_btrace,
+ PACKET_QTDDCsrc,
+ PACKET_qTDC,
PACKET_MAX
};
@@ -3567,6 +3571,7 @@ remote_start_remote (int from_tty, struc
{
struct uploaded_tp *uploaded_tps = NULL;
struct uploaded_tsv *uploaded_tsvs = NULL;
+ char *uploaded_default_collect = NULL;
if (current_trace_status ()->running)
printf_filtered (_("Trace is already running on the target.\n"));
@@ -3581,6 +3586,10 @@ remote_start_remote (int from_tty, struc
remote_upload_tracepoints (&uploaded_tps);
merge_uploaded_tracepoints (&uploaded_tps);
+
+ remote_upload_trace_default_collect (&uploaded_default_collect);
+
+ trace_set_default_collect (uploaded_default_collect);
}
/* The thread and inferior lists are now synchronized with the
@@ -10567,6 +10576,33 @@ remote_download_tracepoint (struct bp_lo
do_cleanups (old_chain);
}
+/* Download COLLECT that is default collect string to target. */
+
+static void
+remote_download_tracepoint_default_collect (char *collect)
+{
+ char buf[BUF_SIZE];
+ struct remote_state *rs = get_remote_state ();
+ enum packet_result ret;
+
+ if (remote_protocol_packets[PACKET_QTDDCsrc].support == PACKET_DISABLE)
+ return;
+
+ strcpy (buf, "QTDDCsrc:");
+ if (strlen (buf) + strlen (collect) * 2 >= BUF_SIZE)
+ error (_("Source string too long for buffer"));
+ bin2hex (collect, buf + strlen (buf), 0);
+
+ putpkt (buf);
+ getpkt (&rs->buf, &rs->buf_size, 0);
+ ret = packet_ok (rs->buf, &remote_protocol_packets[PACKET_QTDDCsrc]);
+ if (ret == PACKET_UNKNOWN)
+ warning (_("\
+Target does not support tracepoint default collect source download."));
+ else if (ret == PACKET_ERROR)
+ warning (_("Remote failure reply: %s"), rs->buf);
+}
+
static int
remote_can_download_tracepoint (void)
{
@@ -11422,6 +11458,8 @@ Specify the serial device it is connecte
remote_ops.to_can_run_breakpoint_commands = remote_can_run_breakpoint_commands;
remote_ops.to_trace_init = remote_trace_init;
remote_ops.to_download_tracepoint = remote_download_tracepoint;
+ remote_ops.to_download_tracepoint_default_collect
+ = remote_download_tracepoint_default_collect;
remote_ops.to_can_download_tracepoint = remote_can_download_tracepoint;
remote_ops.to_download_trace_state_variable
= remote_download_trace_state_variable;
@@ -11644,6 +11682,36 @@ remote_upload_trace_state_variables (str
return 0;
}
+/* Request target upload default collect, alloc buf for it and put it
+ to COLLECTP. */
+
+static void
+remote_upload_trace_default_collect (char **collectp)
+{
+ struct remote_state *rs = get_remote_state ();
+ int collect_size;
+
+ if (remote_protocol_packets[PACKET_qTDC].support == PACKET_DISABLE)
+ return;
+
+ putpkt ("qTDC");
+ remote_get_noisy_reply (&rs->buf, &rs->buf_size);
+ if (strncmp (rs->buf, "DC", 2))
+ {
+ remote_protocol_packets[PACKET_qTDC].support = PACKET_DISABLE;
+ *collectp = NULL;
+ warning (_("\
+Target does not support tracepoint default collect upload."));
+ return;
+ }
+
+ remote_protocol_packets[PACKET_qTDC].support = PACKET_ENABLE;
+ collect_size = (strlen (rs->buf) - 2) / 2;
+ *collectp = xmalloc (collect_size + 1);
+ hex2bin (rs->buf + 2, *collectp, collect_size);
+ (*collectp)[collect_size] = '\0';
+}
+
void
_initialize_remote (void)
{
@@ -12000,6 +12068,12 @@ Show the maximum size of the address (in
add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_btrace],
"qXfer:btrace", "read-btrace", 0);
+ add_packet_config_cmd (&remote_protocol_packets[PACKET_QTDDCsrc],
+ "QTDDCsrc", "set-default-collect", 1);
+
+ add_packet_config_cmd (&remote_protocol_packets[PACKET_qTDC],
+ "qTDC", "get-default-collect", 1);
+
/* Keep the old ``set remote Z-packet ...'' working. Each individual
Z sub-packet has its own set and show commands, but users may
have sets to this variable in their .gdbinit files (or in their
--- a/target.c
+++ b/target.c
@@ -706,6 +706,7 @@ update_current_target (void)
INHERIT (to_supports_string_tracing, t);
INHERIT (to_trace_init, t);
INHERIT (to_download_tracepoint, t);
+ INHERIT (to_download_tracepoint_default_collect, t);
INHERIT (to_can_download_tracepoint, t);
INHERIT (to_download_trace_state_variable, t);
INHERIT (to_enable_tracepoint, t);
@@ -890,6 +891,9 @@ update_current_target (void)
de_fault (to_download_tracepoint,
(void (*) (struct bp_location *))
tcomplain);
+ de_fault (to_download_tracepoint_default_collect,
+ (void (*) (char *))
+ tcomplain);
de_fault (to_can_download_tracepoint,
(int (*) (void))
return_zero);
--- a/target.h
+++ b/target.h
@@ -748,6 +748,10 @@ struct target_ops
/* Send full details of a tracepoint location to the target. */
void (*to_download_tracepoint) (struct bp_location *location);
+ /* Send full details of the list of expressions to collect by default
+ to the target. */
+ void (*to_download_tracepoint_default_collect) (char *collect);
+
/* Is the target able to download tracepoint locations in current
state? */
int (*to_can_download_tracepoint) (void);
@@ -1725,6 +1729,9 @@ extern char *target_fileio_read_stralloc
#define target_download_tracepoint(t) \
(*current_target.to_download_tracepoint) (t)
+#define target_download_tracepoint_default_collect(collect) \
+ (*current_target.to_download_tracepoint_default_collect) (collect)
+
#define target_can_download_tracepoint() \
(*current_target.to_can_download_tracepoint) ()
--- a/tracepoint.c
+++ b/tracepoint.c
@@ -1796,6 +1796,8 @@ start_tracing (char *notes)
t->number_on_target = 0;
+ target_download_tracepoint_default_collect (default_collect);
+
for (loc = b->loc; loc; loc = loc->next)
{
/* Since tracepoint locations are never duplicated, `inserted'
@@ -5660,6 +5662,18 @@ traceframe_available_memory (VEC(mem_ran
return 0;
}
+/* Not overwrite default collect If COLLECT is NULL or its size is 0. */
+
+void
+trace_set_default_collect (char *collect)
+{
+ if (collect != NULL)
+ {
+ xfree (default_collect);
+ default_collect = collect;
+ }
+}
+
/* Implementation of `sdata' variable. */
static const struct internalvar_funcs sdata_funcs =
--- a/tracepoint.h
+++ b/tracepoint.h
@@ -412,4 +412,6 @@ extern struct traceframe_info *parse_tra
extern int traceframe_available_memory (VEC(mem_range_s) **result,
CORE_ADDR memaddr, ULONGEST len);
+extern void trace_set_default_collect (char *collect);
+
#endif /* TRACEPOINT_H */
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [3/6] tfile
2013-04-15 19:01 ` Hui Zhu
@ 2013-04-16 15:34 ` Hui Zhu
2013-04-17 11:21 ` Yao Qi
0 siblings, 1 reply; 34+ messages in thread
From: Hui Zhu @ 2013-04-16 15:34 UTC (permalink / raw)
To: gdb-patches ml; +Cc: Hui Zhu, Yao Qi
[-- Attachment #1: Type: text/plain, Size: 6546 bytes --]
The old patch cannot patch to the upstream, so post a new version for that.
Thanks,
Hui
2013-04-16 Hui Zhu <hui@codesourcery.com>
* ctf.c (ctf_write_default_collect): New.
(trace_file_write_ops): Add ctf_write_default_collect.
* tracepoint.c (tfile_write_default_collect): New.
(trace_file_write_ops): Add tfile_write_default_collect.
(trace_save): Call writer->ops->write_default_collect.
(tfile_interp_line): Add collectp.
(tfile_open): Add support of default collect.
* tracepoint.h (trace_file_write_ops): Add write_default_collect.
On Mon, Apr 15, 2013 at 11:11 PM, Hui Zhu <teawater@gmail.com> wrote:
> Post a new version to fix the typo of "collest".
>
> Thanks,
> Hui
>
> 2013-04-15 Hui Zhu <hui@codesourcery.com>
>
> * ctf.c (ctf_write_default_collect): New.
> (trace_file_write_ops): Add ctf_write_default_collect.
> * tracepoint.c (tfile_write_default_collect): New.
> (trace_file_write_ops): Add tfile_write_default_collect.
> (trace_save): Call writer->ops->write_default_collect.
> (tfile_interp_line): Add collectp.
> (tfile_open): Add support of default collect.
> * tracepoint.h (trace_file_write_ops): Add write_default_collect.
>
> On Fri, Apr 12, 2013 at 6:45 PM, Hui Zhu <teawater@gmail.com> wrote:
>> Hi Yao,
>>
>> Thanks for your patch.
>>
>> I should do it but I didn't because when I work on this part I cannot
>> find example in GDB src bceause the code that can be example is still
>> not check in. :P
>>
>> Best,
>> Hui
>>
>> On Thu, Apr 11, 2013 at 8:53 PM, Yao Qi <yao@codesourcery.com> wrote:
>>> On 04/11/2013 02:17 PM, Hui Zhu wrote:
>>>> /* This is the implementation of trace_file_write_ops method
>>>> + write_default_collect. */
>>>> +
>>>> +static void
>>>> +ctf_write_default_collect (struct trace_file_writer *self,
>>>> + char *collect)
>>>> +{
>>>> + /* It is not supported yet to write default collect
>>>> + into CTF trace data. */
>>>> +}
>>>> +
>>>
>>> It is pity to see "default-collect" is not written to CTF in this
>>> patch. The patch below is about teaching GDB to write
>>> "default-collect" action in CTF and read "default-collect" action from
>>> CTF. Do you mind incorporating the patch below into your patch series,
>>> so that your series is more complete.
>>>
>>> --
>>> Yao (齐尧)
>>>
>>> gdb:
>>>
>>> 2013-04-11 Yao Qi <yao@codesourcery.com>
>>>
>>> * ctf.c (CTF_EVENT_ID_DEFAULT_COLLECT): New macro.
>>> (ctf_write_header): Write metadata for "default-collect"
>>> action.
>>> (ctf_write_default_collect): Write "default-collect" action
>>> in CTF.
>>> (ctf_read_default_collect): New.
>>> (ctf_open): Call ctf_read_default_collect.
>>> ---
>>> gdb/ctf.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
>>> 1 files changed, 57 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/gdb/ctf.c b/gdb/ctf.c
>>> index 2dd2ed8..5757b47 100644
>>> --- a/gdb/ctf.c
>>> +++ b/gdb/ctf.c
>>> @@ -74,6 +74,7 @@
>>> #define CTF_EVENT_ID_STATUS 4
>>> #define CTF_EVENT_ID_TSV_DEF 5
>>> #define CTF_EVENT_ID_TP_DEF 6
>>> +#define CTF_EVENT_ID_DEFAULT_COLLECT 7
>>>
>>> /* The state kept while writing the CTF datastream file. */
>>>
>>> @@ -428,6 +429,16 @@ ctf_write_header (struct trace_file_writer *self)
>>> "\t};\n"
>>> "};\n", CTF_EVENT_ID_TP_DEF);
>>>
>>> + ctf_save_write_metadata (&writer->tcs, "\n");
>>> + ctf_save_write_metadata (&writer->tcs,
>>> + "event {\n\tname = \"default_collect\";\n"
>>> + "\tid = %u;\n"
>>> + "\tfields := struct { \n"
>>> + "\t\tchars contents;\n"
>>> + "\t};\n"
>>> + "};\n",
>>> + CTF_EVENT_ID_DEFAULT_COLLECT);
>>> +
>>> gdb_assert (writer->tcs.content_size == 0);
>>> gdb_assert (writer->tcs.packet_start == 0);
>>>
>>> @@ -622,8 +633,17 @@ static void
>>> ctf_write_default_collect (struct trace_file_writer *self,
>>> char *collect)
>>> {
>>> - /* It is not supported yet to write default collect
>>> - into CTF trace data. */
>>> + struct ctf_trace_file_writer *writer
>>> + = (struct ctf_trace_file_writer *) self;
>>> + int32_t int32;
>>> +
>>> + /* Event Id. */
>>> + int32 = CTF_EVENT_ID_DEFAULT_COLLECT;
>>> + ctf_save_align_write (&writer->tcs, (gdb_byte *) &int32, 4, 4);
>>> +
>>> + /* Contents. */
>>> + ctf_save_write (&writer->tcs, collect, strlen (collect) + 1);
>>> +
>>> }
>>>
>>> /* This is the implementation of trace_file_write_ops method
>>> @@ -1149,6 +1169,39 @@ ctf_read_tp (struct uploaded_tp **uploaded_tps)
>>> }
>>> }
>>>
>>> +/* Read a CTF event on "default-collect" and update the
>>> + "default-collect" action. */
>>> +
>>> +static void
>>> +ctf_read_default_collect (void)
>>> +{
>>> + struct bt_ctf_event *event;
>>> + const struct bt_definition *scope;
>>> + uint32_t u32;
>>> + char *default_collect;
>>> +
>>> + event = bt_ctf_iter_read_event (ctf_iter);
>>> + scope = bt_ctf_get_top_level_scope (event,
>>> + BT_STREAM_EVENT_HEADER);
>>> + u32 = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope,
>>> + "id"));
>>> +
>>> + if (u32 != CTF_EVENT_ID_DEFAULT_COLLECT)
>>> + error (_("Wrong event id!"));
>>> +
>>> + default_collect
>>> + = bt_ctf_get_string (bt_ctf_get_field (event, scope, "contents"));
>>> +
>>> + if (default_collect == NULL)
>>> + default_collect = xstrdup ("");
>>> + else
>>> + default_collect = xstrdup (default_collect);
>>> +
>>> + trace_set_default_collect (default_collect);
>>> +
>>> + bt_iter_next (bt_ctf_get_iter (ctf_iter));
>>> +}
>>> +
>>> /* This is the implementation of target_ops method to_open. Open CTF
>>> trace data, read trace status, trace state variables and tracepoint
>>> definitions from the first packet. Set the start position at the
>>> @@ -1190,6 +1243,8 @@ ctf_open (char *dirname, int from_tty)
>>>
>>> ctf_read_tp (&uploaded_tps);
>>>
>>> + ctf_read_default_collect ();
>>> +
>>> event = bt_ctf_iter_read_event (ctf_iter);
>>> /* EVENT can be NULL if we've already gone to the end of stream of
>>> events. */
>>> --
>>> 1.7.7.6
[-- Attachment #2: defc-tfile.txt --]
[-- Type: text/plain, Size: 4062 bytes --]
--- a/ctf.c
+++ b/ctf.c
@@ -617,6 +617,17 @@ ctf_write_uploaded_tp (struct trace_file
}
/* This is the implementation of trace_file_write_ops method
+ write_default_collect. */
+
+static void
+ctf_write_default_collect (struct trace_file_writer *self,
+ char *collect)
+{
+ /* It is not supported yet to write default collect
+ into CTF trace data. */
+}
+
+/* This is the implementation of trace_file_write_ops method
write_definition_end. */
static void
@@ -848,6 +859,7 @@ static const struct trace_file_write_ops
ctf_write_status,
ctf_write_uploaded_tsv,
ctf_write_uploaded_tp,
+ ctf_write_default_collect,
ctf_write_definition_end,
NULL,
&ctf_write_frame_ops,
--- a/tracepoint.c
+++ b/tracepoint.c
@@ -3237,6 +3237,19 @@ tfile_write_uploaded_tp (struct trace_fi
}
/* This is the implementation of trace_file_write_ops method
+ write_default_collect. */
+
+static void
+tfile_write_default_collect (struct trace_file_writer *self,
+ char *collect)
+{
+ struct tfile_trace_file_writer *writer
+ = (struct tfile_trace_file_writer *) self;
+
+ fprintf (writer->fp, "dc %s\n", collect);
+}
+
+/* This is the implementation of trace_file_write_ops method
write_definition_end. */
static void
@@ -3289,6 +3302,7 @@ static const struct trace_file_write_ops
tfile_write_status,
tfile_write_uploaded_tsv,
tfile_write_uploaded_tp,
+ tfile_write_default_collect,
tfile_write_definition_end,
tfile_write_raw_data,
NULL,
@@ -3378,6 +3392,8 @@ trace_save (const char *filename, struct
for (utp = uploaded_tps; utp; utp = utp->next)
writer->ops->write_uploaded_tp (writer, utp);
+ writer->ops->write_default_collect (writer, default_collect);
+
free_uploaded_tps (&uploaded_tps);
/* Mark the end of the definition section. */
@@ -4147,7 +4163,8 @@ int trace_regblock_size;
static void tfile_interp_line (char *line,
struct uploaded_tp **utpp,
- struct uploaded_tsv **utsvp);
+ struct uploaded_tsv **utsvp,
+ char **collectp);
/* Read SIZE bytes into READBUF from the trace frame, starting at
TRACE_FD's current position. Note that this call `read'
@@ -4182,6 +4199,7 @@ tfile_open (char *filename, int from_tty
struct trace_status *ts;
struct uploaded_tp *uploaded_tps = NULL;
struct uploaded_tsv *uploaded_tsvs = NULL;
+ char *uploaded_default_collect = NULL;
target_preopen (from_tty);
if (!filename)
@@ -4251,7 +4269,8 @@ tfile_open (char *filename, int from_tty
break;
linebuf[i] = '\0';
i = 0;
- tfile_interp_line (linebuf, &uploaded_tps, &uploaded_tsvs);
+ tfile_interp_line (linebuf, &uploaded_tps, &uploaded_tsvs,
+ &uploaded_default_collect);
}
else
linebuf[i++] = byte;
@@ -4289,6 +4308,8 @@ tfile_open (char *filename, int from_tty
merge_uploaded_tracepoints (&uploaded_tps);
+ trace_set_default_collect (uploaded_default_collect);
+
post_create_inferior (&tfile_ops, from_tty);
}
@@ -4297,7 +4318,7 @@ tfile_open (char *filename, int from_tty
static void
tfile_interp_line (char *line, struct uploaded_tp **utpp,
- struct uploaded_tsv **utsvp)
+ struct uploaded_tsv **utsvp, char **collectp)
{
char *p = line;
@@ -4321,6 +4342,11 @@ tfile_interp_line (char *line, struct up
p += strlen ("tsv ");
parse_tsv_definition (p, utsvp);
}
+ else if (strncmp (p, "dc ", strlen ("dc ")) == 0)
+ {
+ p += strlen ("dc ");
+ *collectp = xstrdup (p);
+ }
else
warning (_("Ignoring trace file definition \"%s\""), line);
}
--- a/tracepoint.h
+++ b/tracepoint.h
@@ -296,6 +296,10 @@ struct trace_file_write_ops
void (*write_uploaded_tp) (struct trace_file_writer *self,
struct uploaded_tp *tp);
+ /* Write the tracepoint default collect. */
+ void (*write_default_collect) (struct trace_file_writer *self,
+ char *collect);
+
/* Write to mark the end of the definition part. */
void (*write_definition_end) (struct trace_file_writer *self);
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [5/6] doc
2013-04-11 23:00 ` Eli Zaretskii
@ 2013-04-16 15:39 ` Hui Zhu
2013-04-16 15:44 ` Eli Zaretskii
0 siblings, 1 reply; 34+ messages in thread
From: Hui Zhu @ 2013-04-16 15:39 UTC (permalink / raw)
To: Eli Zaretskii, Yao Qi; +Cc: Hui Zhu, gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 1365 bytes --]
Hi Eli,
Thanks for your review.
On Fri, Apr 12, 2013 at 1:52 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Thu, 11 Apr 2013 14:19:03 +0800
>> From: Hui Zhu <hui_zhu@mentor.com>
>>
>> This patch is doc update for "QTDDCsrc" and "qTDC".
>
> Thanks.
>
>> +@item QTDDCsrc:@var{bytes}
>> +@cindex define default collect, remote request
>> +@cindex @samp{QTDDCsrc} packet
>> +@var{bytes} is the string, encoded in hexadecimal.
>> +It specify a source string of default collect.
> ^^^^^^^
> "specifies"
>
> By the way, why is it called a "source" string?
Because it is same with QTDPsrc: string, encoded in hexadecimal. I
think it is not very good for this part now. So I removed it.
>
>> +These packets request default collect on the target. Replies to
>> +this packet generally take the form of the @code{QTDDCsrc} packet that
>> +define default collect.
> ^^^^^^
> "defines"
Fixed.
>
>> +Replies:
>> +@table @samp
>> +@item DC@var{bytes}
>> +@var{bytes} is the string, encoded in hexadecimal. It take the form of
>> +the @code{QTDDCsrc} packet that define default collect.^^^^
> ^^^^^^
> "takes" and "defines"
Fixed.
>
> OK with those changes.
Post a new version. Please help me review.
Best,
Hui
2013-04-16 Hui Zhu <hui@codesourcery.com>
* gdb.texinfo (Tracepoint Packets) Add "QTDDCsrc" and "qTDC".
[-- Attachment #2: defc-doc.txt --]
[-- Type: text/plain, Size: 2108 bytes --]
--- a/NEWS
+++ b/NEWS
@@ -45,6 +45,14 @@ show remote trace-status-packet
** The -trace-save MI command can optionally save trace buffer in Common
Trace Format now.
+* New remote packets
+
+QTDDCsrc
+ Download trace default collect string to target.
+
+qTDC
+ Request target upload trace default collect.
+
*** Changes in GDB 7.6
* Target record has been renamed to record-full.
--- a/doc/gdb.texinfo
+++ b/doc/gdb.texinfo
@@ -37825,8 +37825,10 @@ encoded). @value{GDBN} will continue to
@itemx QTDP
@itemx QTDPsrc
@itemx QTDV
+@itemx QTDDCsrc
@itemx qTfP
@itemx qTfV
+@itemx qTDC
@itemx QTFrame
@itemx qTMinFTPILen
@@ -38415,6 +38417,22 @@ the option of not using this packet for
target should simply create the trace state variables as they are
mentioned in expressions.
+@item QTDDCsrc:@var{bytes}
+@cindex define default collect, remote request
+@cindex @samp{QTDDCsrc} packet
+@var{bytes} is the string, encoded in hexadecimal.
+It specifies a string of default collect.
+The target does not need to do anything with source strings except
+report them back as part of the replies to the @samp{qTDC} query packets.
+
+Replies:
+@table @samp
+@item OK
+The packet was understood and carried out.
+@item @w{}
+The packet was not recognized.
+@end table
+
@item QTFrame:@var{n}
@cindex @samp{QTFrame} packet
Select the @var{n}'th tracepoint frame from the buffer, and use the
@@ -38670,6 +38688,24 @@ and multiple @code{qTsV} to get addition
these packets follow the syntax of the @code{QTDV} packets that define
trace state variables.
+@item qTDC
+@cindex @samp{qTDC} packet
+@itemx qTDC
+@cindex @samp{qTDC} packet
+These packets request default collect on the target. Replies to
+this packet generally take the form of the @code{QTDDCsrc} packet that
+defines default collect.
+
+Replies:
+@table @samp
+@item DC@var{bytes}
+@var{bytes} is the string, encoded in hexadecimal. It takes the form of
+the @code{QTDDCsrc} packet that defines default collect.
+
+@item @w{}
+The packet was not recognized.
+@end table
+
@item qTfSTM
@itemx qTsSTM
@anchor{qTfSTM}
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [5/6] doc
2013-04-16 15:44 ` Eli Zaretskii
@ 2013-04-16 15:44 ` Hui Zhu
2013-05-13 6:04 ` Hui Zhu
0 siblings, 1 reply; 34+ messages in thread
From: Hui Zhu @ 2013-04-16 15:44 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Yao Qi, Hui Zhu, gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 396 bytes --]
On Tue, Apr 16, 2013 at 5:46 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Hui Zhu <teawater@gmail.com>
>> Date: Tue, 16 Apr 2013 17:31:16 +0800
>> Cc: Hui Zhu <hui_zhu@mentor.com>, gdb-patches ml <gdb-patches@sourceware.org>
>>
>> +qTDC
>> + Request target upload trace default collect.
>
> "Request target to upload trace default collect."
Fixed.
>
> OK with this change.
Thanks,
Hui
[-- Attachment #2: defc-doc.txt --]
[-- Type: text/plain, Size: 2111 bytes --]
--- a/NEWS
+++ b/NEWS
@@ -45,6 +45,14 @@ show remote trace-status-packet
** The -trace-save MI command can optionally save trace buffer in Common
Trace Format now.
+* New remote packets
+
+QTDDCsrc
+ Download trace default collect string to target.
+
+qTDC
+ Request target to upload trace default collect.
+
*** Changes in GDB 7.6
* Target record has been renamed to record-full.
--- a/doc/gdb.texinfo
+++ b/doc/gdb.texinfo
@@ -37825,8 +37825,10 @@ encoded). @value{GDBN} will continue to
@itemx QTDP
@itemx QTDPsrc
@itemx QTDV
+@itemx QTDDCsrc
@itemx qTfP
@itemx qTfV
+@itemx qTDC
@itemx QTFrame
@itemx qTMinFTPILen
@@ -38415,6 +38417,22 @@ the option of not using this packet for
target should simply create the trace state variables as they are
mentioned in expressions.
+@item QTDDCsrc:@var{bytes}
+@cindex define default collect, remote request
+@cindex @samp{QTDDCsrc} packet
+@var{bytes} is the string, encoded in hexadecimal.
+It specifies a string of default collect.
+The target does not need to do anything with source strings except
+report them back as part of the replies to the @samp{qTDC} query packets.
+
+Replies:
+@table @samp
+@item OK
+The packet was understood and carried out.
+@item @w{}
+The packet was not recognized.
+@end table
+
@item QTFrame:@var{n}
@cindex @samp{QTFrame} packet
Select the @var{n}'th tracepoint frame from the buffer, and use the
@@ -38670,6 +38688,24 @@ and multiple @code{qTsV} to get addition
these packets follow the syntax of the @code{QTDV} packets that define
trace state variables.
+@item qTDC
+@cindex @samp{qTDC} packet
+@itemx qTDC
+@cindex @samp{qTDC} packet
+These packets request default collect on the target. Replies to
+this packet generally take the form of the @code{QTDDCsrc} packet that
+defines default collect.
+
+Replies:
+@table @samp
+@item DC@var{bytes}
+@var{bytes} is the string, encoded in hexadecimal. It takes the form of
+the @code{QTDDCsrc} packet that defines default collect.
+
+@item @w{}
+The packet was not recognized.
+@end table
+
@item qTfSTM
@itemx qTsSTM
@anchor{qTfSTM}
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [6/6] test
2013-04-11 15:24 ` Yao Qi
@ 2013-04-16 15:44 ` Hui Zhu
2013-05-13 6:06 ` Hui Zhu
0 siblings, 1 reply; 34+ messages in thread
From: Hui Zhu @ 2013-04-16 15:44 UTC (permalink / raw)
To: Yao Qi; +Cc: Hui Zhu, gdb-patches ml
[-- Attachment #1: Type: text/plain, Size: 1877 bytes --]
Hi Yao,
Thanks for your review.
On Thu, Apr 11, 2013 at 4:19 PM, Yao Qi <yao@codesourcery.com> wrote:
> On 04/11/2013 03:40 PM, Hui Zhu wrote:
>>
>> --- a/testsuite/gdb.trace/tstatus.exp
>> +++ b/testsuite/gdb.trace/tstatus.exp
>> @@ -137,6 +137,8 @@ proc test_tracepoints {} {
>>
>> test_tracepoints
>>
>> +gdb_test_no_output "set default-collect \$regs"
>> +
>> set tracefile [standard_output_file ${testfile}]
>> # Save trace frames to tfile.
>> gdb_test "tsave ${tracefile}.tf" \
>> @@ -147,6 +149,8 @@ gdb_test "tsave -ctf ${tracefile}.ctf" \
>> "Trace data saved to directory '${tracefile}.ctf'.*" \
>> "save ctf trace file"
>>
>> +gdb_test_no_output "set default-collect"
>> +
>> # Change target to tfile.
>> set test "change to tfile target"
>> gdb_test_multiple "target tfile ${tracefile}.tf" "$test" {
>> @@ -159,6 +163,8 @@ gdb_test_multiple "target tfile ${tracef
>> }
>> }
>>
>> +gdb_test "show default-collect" "The list of expressions to collect by
>> default is \"\\\$regs\".*"
>> +
>> # Convert "(because I can) to "\(because I can\)"
>> set tstatus_output [string map {\( \\(} $tstatus_output]
>> set tstatus_output [string map {\) \\)} $tstatus_output]
>
>
> I am afraid that tstatus.exp is not a good place to test "default-collect".
> The tstatus.exp is to test the output of command 'tstatus' in various
> situations, and also test that the output of 'tstatus' command on tfile
> target is identical to its output on the ctf target. Probably, actions.exp
> is better, IMO.
Move it to actions.exp
Post a new version for it.
Best,
Hui
2013-04-16 Hui Zhu <hui@codesourcery.com>
* gdb.trace/disconnected-tracing.exp (disconnected_tracing): Add
test for default-collect.
* gdb.trace/actions.exp: Add test for default-collect.
>
> --
> Yao (齐尧)
[-- Attachment #2: defc-test.txt --]
[-- Type: text/plain, Size: 1673 bytes --]
--- a/testsuite/gdb.trace/actions.exp
+++ b/testsuite/gdb.trace/actions.exp
@@ -248,6 +248,8 @@ gdb_trace_setactions "set actions for fi
"collect \$regs" "^$" \
"end" ""
+gdb_test_no_output "set default-collect \$regs"
+
# Check the definition of tracepoints. These tracepoints may have
# different number in different runs.
@@ -256,6 +258,8 @@ proc check_tracepoint { data_source } {
global gdb_prompt
global srcfile
+ gdb_test "show default-collect" "The list of expressions to collect by default is \"\\\$regs\".*"
+
set tp_on_gdb_c_test 0
set tp_on_gdb_asm_test 0
set tp_on_gdb_recursion_test 0
--- a/testsuite/gdb.trace/disconnected-tracing.exp
+++ b/testsuite/gdb.trace/disconnected-tracing.exp
@@ -65,6 +65,8 @@ proc disconnected_tracing { } {
"collect foo" "^$"
gdb_test "break end" "Breakpoint ${decimal} at .*"
+ gdb_test_no_output "set default-collect \$regs"
+
gdb_test_no_output "tstart"
gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
@@ -73,6 +75,8 @@ proc disconnected_tracing { } {
gdb_test "info tracepoints" ".*in start at.*" \
"first info tracepoints"
+ gdb_test_no_output "set default-collect"
+
gdb_test "disconnect" "Ending remote debugging\\." "first disconnect"
if { [gdb_reconnect] == 0 } {
pass "first reconnect after unload"
@@ -83,6 +87,8 @@ proc disconnected_tracing { } {
gdb_test "info tracepoints" ".*in start at.*" \
"second info tracepoints"
+ gdb_test "show default-collect" "The list of expressions to collect by default is \"\\\$regs\".*"
+
delete_breakpoints
gdb_test "info tracepoints" ".*No tracepoints..*" \
"third info tracepoints"
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [5/6] doc
2013-04-16 15:39 ` Hui Zhu
@ 2013-04-16 15:44 ` Eli Zaretskii
2013-04-16 15:44 ` Hui Zhu
0 siblings, 1 reply; 34+ messages in thread
From: Eli Zaretskii @ 2013-04-16 15:44 UTC (permalink / raw)
To: Hui Zhu; +Cc: yao, hui_zhu, gdb-patches
> From: Hui Zhu <teawater@gmail.com>
> Date: Tue, 16 Apr 2013 17:31:16 +0800
> Cc: Hui Zhu <hui_zhu@mentor.com>, gdb-patches ml <gdb-patches@sourceware.org>
>
> +qTDC
> + Request target upload trace default collect.
"Request target to upload trace default collect."
OK with this change.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [3/6] tfile
2013-04-16 15:34 ` Hui Zhu
@ 2013-04-17 11:21 ` Yao Qi
2013-05-13 6:02 ` Hui Zhu
0 siblings, 1 reply; 34+ messages in thread
From: Yao Qi @ 2013-04-17 11:21 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches ml, Hui Zhu
On 04/16/2013 05:30 PM, Hui Zhu wrote:
> The old patch cannot patch to the upstream, so post a new version for that.
>
> Thanks,
> Hui
>
> 2013-04-16 Hui Zhu<hui@codesourcery.com>
>
> * ctf.c (ctf_write_default_collect): New.
> (trace_file_write_ops): Add ctf_write_default_collect.
> * tracepoint.c (tfile_write_default_collect): New.
> (trace_file_write_ops): Add tfile_write_default_collect.
> (trace_save): Call writer->ops->write_default_collect.
> (tfile_interp_line): Add collectp.
> (tfile_open): Add support of default collect.
> * tracepoint.h (trace_file_write_ops): Add write_default_collect.
Hui, it is pity (again) to see you didn't incorporate my ctf part into
this patch, so I did it for you.
--
Yao (é½å°§)
gdb:
2013-04-17 Hui Zhu <hui@codesourcery.com>
Yao Qi <yao@codesourcery.com>
* ctf.c (CTF_EVENT_ID_DEFAULT_COLLECT): New macro.
(ctf_write_header): Write metadata for "default-collect"
action.
(ctf_write_default_collect): New.
(trace_file_write_ops): Add ctf_write_default_collect.
(ctf_read_default_collect): New.
(ctf_open): Call ctf_read_default_collect.
* tracepoint.c (tfile_write_default_collect): New.
(trace_file_write_ops): Add tfile_write_default_collect.
(trace_save): Call writer->ops->write_default_collect.
(tfile_interp_line): Add parameter 'collectp'.
(tfile_open): Add support of default collect.
* tracepoint.h (trace_file_write_ops) <write_default_collect>:
New.
---
gdb/ctf.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
gdb/tracepoint.c | 32 +++++++++++++++++++++++--
gdb/tracepoint.h | 4 +++
3 files changed, 101 insertions(+), 3 deletions(-)
diff --git a/gdb/ctf.c b/gdb/ctf.c
index b8252e4..413ce52 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -75,6 +75,7 @@
#define CTF_EVENT_ID_STATUS 4
#define CTF_EVENT_ID_TSV_DEF 5
#define CTF_EVENT_ID_TP_DEF 6
+#define CTF_EVENT_ID_DEFAULT_COLLECT 7
/* The state kept while writing the CTF datastream file. */
@@ -429,6 +430,16 @@ ctf_write_header (struct trace_file_writer *self)
"\t};\n"
"};\n", CTF_EVENT_ID_TP_DEF);
+ ctf_save_write_metadata (&writer->tcs, "\n");
+ ctf_save_write_metadata (&writer->tcs,
+ "event {\n\tname = \"default_collect\";\n"
+ "\tid = %u;\n"
+ "\tfields := struct { \n"
+ "\t\tchars contents;\n"
+ "\t};\n"
+ "};\n",
+ CTF_EVENT_ID_DEFAULT_COLLECT);
+
gdb_assert (writer->tcs.content_size == 0);
gdb_assert (writer->tcs.packet_start == 0);
@@ -617,6 +628,26 @@ ctf_write_uploaded_tp (struct trace_file_writer *self,
}
/* This is the implementation of trace_file_write_ops method
+ write_default_collect. */
+
+static void
+ctf_write_default_collect (struct trace_file_writer *self,
+ char *collect)
+{
+ struct ctf_trace_file_writer *writer
+ = (struct ctf_trace_file_writer *) self;
+ int32_t int32;
+
+ /* Event Id. */
+ int32 = CTF_EVENT_ID_DEFAULT_COLLECT;
+ ctf_save_align_write (&writer->tcs, (gdb_byte *) &int32, 4, 4);
+
+ /* Contents. */
+ ctf_save_write (&writer->tcs, collect, strlen (collect) + 1);
+
+}
+
+/* This is the implementation of trace_file_write_ops method
write_definition_end. */
static void
@@ -848,6 +879,7 @@ static const struct trace_file_write_ops ctf_write_ops =
ctf_write_status,
ctf_write_uploaded_tsv,
ctf_write_uploaded_tp,
+ ctf_write_default_collect,
ctf_write_definition_end,
NULL,
&ctf_write_frame_ops,
@@ -1138,6 +1170,40 @@ ctf_read_tp (struct uploaded_tp **uploaded_tps)
}
}
+/* Read a CTF event on "default-collect" and update the
+ "default-collect" action. */
+
+static void
+ctf_read_default_collect (void)
+{
+ struct bt_ctf_event *event;
+ const struct bt_definition *scope;
+ uint32_t u32;
+ char *default_collect;
+
+ event = bt_ctf_iter_read_event (ctf_iter);
+ scope = bt_ctf_get_top_level_scope (event,
+ BT_STREAM_EVENT_HEADER);
+ u32 = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope,
+ "id"));
+
+ if (u32 != CTF_EVENT_ID_DEFAULT_COLLECT)
+ error (_("Wrong event id!"));
+
+ scope = bt_ctf_get_top_level_scope (event, BT_EVENT_FIELDS);
+ default_collect
+ = bt_ctf_get_string (bt_ctf_get_field (event, scope, "contents"));
+
+ if (default_collect == NULL)
+ default_collect = xstrdup ("");
+ else
+ default_collect = xstrdup (default_collect);
+
+ trace_set_default_collect (default_collect);
+
+ bt_iter_next (bt_ctf_get_iter (ctf_iter));
+}
+
/* This is the implementation of target_ops method to_open. Open CTF
trace data, read trace status, trace state variables and tracepoint
definitions from the first packet. Set the start position at the
@@ -1179,6 +1245,8 @@ ctf_open (char *dirname, int from_tty)
ctf_read_tp (&uploaded_tps);
+ ctf_read_default_collect ();
+
event = bt_ctf_iter_read_event (ctf_iter);
/* EVENT can be NULL if we've already gone to the end of stream of
events. */
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index c1c4d8f..b2ce6f4 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -3237,6 +3237,19 @@ tfile_write_uploaded_tp (struct trace_file_writer *self,
}
/* This is the implementation of trace_file_write_ops method
+ write_default_collect. */
+
+static void
+tfile_write_default_collect (struct trace_file_writer *self,
+ char *collect)
+{
+ struct tfile_trace_file_writer *writer
+ = (struct tfile_trace_file_writer *) self;
+
+ fprintf (writer->fp, "dc %s\n", collect);
+}
+
+/* This is the implementation of trace_file_write_ops method
write_definition_end. */
static void
@@ -3289,6 +3302,7 @@ static const struct trace_file_write_ops tfile_write_ops =
tfile_write_status,
tfile_write_uploaded_tsv,
tfile_write_uploaded_tp,
+ tfile_write_default_collect,
tfile_write_definition_end,
tfile_write_raw_data,
NULL,
@@ -3378,6 +3392,8 @@ trace_save (const char *filename, struct trace_file_writer *writer,
for (utp = uploaded_tps; utp; utp = utp->next)
writer->ops->write_uploaded_tp (writer, utp);
+ writer->ops->write_default_collect (writer, default_collect);
+
free_uploaded_tps (&uploaded_tps);
/* Mark the end of the definition section. */
@@ -4147,7 +4163,8 @@ int trace_regblock_size;
static void tfile_interp_line (char *line,
struct uploaded_tp **utpp,
- struct uploaded_tsv **utsvp);
+ struct uploaded_tsv **utsvp,
+ char **collectp);
/* Read SIZE bytes into READBUF from the trace frame, starting at
TRACE_FD's current position. Note that this call `read'
@@ -4182,6 +4199,7 @@ tfile_open (char *filename, int from_tty)
struct trace_status *ts;
struct uploaded_tp *uploaded_tps = NULL;
struct uploaded_tsv *uploaded_tsvs = NULL;
+ char *uploaded_default_collect = NULL;
target_preopen (from_tty);
if (!filename)
@@ -4251,7 +4269,8 @@ tfile_open (char *filename, int from_tty)
break;
linebuf[i] = '\0';
i = 0;
- tfile_interp_line (linebuf, &uploaded_tps, &uploaded_tsvs);
+ tfile_interp_line (linebuf, &uploaded_tps, &uploaded_tsvs,
+ &uploaded_default_collect);
}
else
linebuf[i++] = byte;
@@ -4289,6 +4308,8 @@ tfile_open (char *filename, int from_tty)
merge_uploaded_tracepoints (&uploaded_tps);
+ trace_set_default_collect (uploaded_default_collect);
+
post_create_inferior (&tfile_ops, from_tty);
}
@@ -4297,7 +4318,7 @@ tfile_open (char *filename, int from_tty)
static void
tfile_interp_line (char *line, struct uploaded_tp **utpp,
- struct uploaded_tsv **utsvp)
+ struct uploaded_tsv **utsvp, char **collectp)
{
char *p = line;
@@ -4321,6 +4342,11 @@ tfile_interp_line (char *line, struct uploaded_tp **utpp,
p += strlen ("tsv ");
parse_tsv_definition (p, utsvp);
}
+ else if (strncmp (p, "dc ", strlen ("dc ")) == 0)
+ {
+ p += strlen ("dc ");
+ *collectp = xstrdup (p);
+ }
else
warning (_("Ignoring trace file definition \"%s\""), line);
}
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index 3bf8d8f..cc38121 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -296,6 +296,10 @@ struct trace_file_write_ops
void (*write_uploaded_tp) (struct trace_file_writer *self,
struct uploaded_tp *tp);
+ /* Write the tracepoint default collect. */
+ void (*write_default_collect) (struct trace_file_writer *self,
+ char *collect);
+
/* Write to mark the end of the definition part. */
void (*write_definition_end) (struct trace_file_writer *self);
--
1.7.7.6
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [0/6]
2013-04-11 8:35 [PATCH] store trace default-collect to target [0/6] Hui Zhu
` (5 preceding siblings ...)
2013-04-11 10:49 ` [PATCH] store trace default-collect to target [6/6] test Hui Zhu
@ 2013-05-13 5:33 ` Hui Zhu
6 siblings, 0 replies; 34+ messages in thread
From: Hui Zhu @ 2013-05-13 5:33 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches ml
Ping http://sourceware.org/ml/gdb-patches/2013-04/msg00296.html
Thanks,
Hui
On Thu, Apr 11, 2013 at 2:15 PM, Hui Zhu <hui_zhu@mentor.com> wrote:
> Hi,
>
> GDB doesn't store default-collect to target. Then if a clean gdb attach a
> target that have tracepoint running on it and have default collect. It
> will cannot tdump all the val that collect by tracepoint.
>
> So I add some patches to let GDB store default-collect to target by packet
> "QTDDCsrc" when "tstart". And when gdb connect to target, it will use
> "qTDC" request the default-collect in target.
>
> And I also add support to tfile and let default-collect can be save with
> command "save tracepoint".
>
> Please help me review them.
>
> Thanks,
> Hui
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [1/6] target, trace and remote
2013-04-16 15:22 ` Hui Zhu
@ 2013-05-13 6:00 ` Hui Zhu
0 siblings, 0 replies; 34+ messages in thread
From: Hui Zhu @ 2013-05-13 6:00 UTC (permalink / raw)
To: gdb-patches ml; +Cc: Hui Zhu, Yao Qi, Abid, Hafiz
Ping http://sourceware.org/ml/gdb-patches/2013-04/msg00452.html
Thanks,
Hui
On Tue, Apr 16, 2013 at 5:28 PM, Hui Zhu <teawater@gmail.com> wrote:
> Hi Yao and Abid,
>
> Thanks for your review.
>
> On Thu, Apr 11, 2013 at 6:48 PM, Yao Qi <yao@codesourcery.com> wrote:
>> On 04/11/2013 02:16 PM, Hui Zhu wrote:
>>>
>>> --- a/remote.c
>>> +++ b/remote.c
>>> @@ -215,6 +215,8 @@ static int remote_get_trace_status (stru
>>> static int remote_upload_tracepoints (struct uploaded_tp **utpp);
>>>
>>> static int remote_upload_trace_state_variables (struct uploaded_tsv
>>> **utsvp);
>>> +
>>> +static void remote_upload_trace_default_collest (char **collectp);
>>
>> ^^^^^^^ typo "collect"
>
> Oops, all fixed.
>
>>
>>>
>>> static void remote_query_supported (void);
>>>
>>> @@ -3567,6 +3569,7 @@ remote_start_remote (int from_tty, struc
>>> {
>>> struct uploaded_tp *uploaded_tps = NULL;
>>> struct uploaded_tsv *uploaded_tsvs = NULL;
>>> + char *uploaded_default_collest = NULL;
>>
>> ^^^^^^^ typo.
>>
>>>
>>> if (current_trace_status ()->running)
>>> printf_filtered (_("Trace is already running on the target.\n"));
>>> @@ -3581,6 +3584,10 @@ remote_start_remote (int from_tty, struc
>>> remote_upload_tracepoints (&uploaded_tps);
>>>
>>> merge_uploaded_tracepoints (&uploaded_tps);
>>> +
>>> + remote_upload_trace_default_collest (&uploaded_default_collest);
>>> +
>>> + trace_set_default_collect (uploaded_default_collest);
>>
>>
>> Likewise.
>>
>>> }
>>>
>>> /* The thread and inferior lists are now synchronized with the
>>> @@ -10567,6 +10574,23 @@ remote_download_tracepoint (struct bp_lo
>>> do_cleanups (old_chain);
>>> }
>>>
>>> +static void
>>> +remote_download_tracepoint_default_collect (char *collect)
>>
>>
>> Add a comment to this function.
>
> Fixed.
>
> /* Download COLLECT that is default collect string to target. */
>
>>
>>>
>>> +static void
>>> +remote_upload_trace_default_collest (char **collectp)
>>
>>
>> Comments to this function are needed as well.
>
> Fixed.
>
>
> /* Download COLLECT that is default collect string to target. */
>
> static void
> remote_download_tracepoint_default_collect (char *collect)
>
>>
>>> +/* Not overwrite default collect If COLLECT is NULL or its size is 0. */
>>> +
>>> +void
>>> +trace_set_default_collect (char *collect)
>>> +{
>>> + if (collect != NULL && strlen (collect) != 0)
>>> + {
>>> + xfree (default_collect);
>>> + default_collect = collect;
>>> + }
>>> +}
>>
>>
>> It looks incorrect to me. When we change target to a tfile, in which the
>> default-collect is "", the variable default_collect won't be updated.
>>
>> Supposing we have two tfile actions.tf and actions1.tf, the default-collect
>> is "$regs" and "" respectively,
>>
>> (gdb) target tfile testsuite/gdb.trace/actions.tf
>> (gdb) show default-collect
>> The list of expressions to collect by default is "$regs".
>> (gdb) target tfile testsuite/gdb.trace/actions1.tf
>> (gdb) show default-collect
>> The list of expressions to collect by default is "$regs".
>>
>> I don't have other comments.
>
> Agree with you. Updated patch for it.
>
>>
>> --
>> Yao (齐尧)
>
> On Thu, Apr 11, 2013 at 10:08 PM, Abid, Hafiz <hafiz_abid@mentor.com> wrote:
>> Hi Hui,
>>>
>>> + putpkt (buf);
>>> + remote_get_noisy_reply (&target_buf, &target_buf_size);
>>> + if (strcmp (target_buf, "OK"))
>>> + warning (_("\
>>
>>
>> Just a small comment on style. I think it is better to be explicit in such
>> case and write != 0. Also I was advised by Pedro recently that new packets
>> should be using packet_ok which will eliminate the need for strcmp here
>> anyway.
>>
>
> Update there part use packet_ok.
>
>>> + putpkt ("qTDC");
>>> + getpkt (&rs->buf, &rs->buf_size, 0);
>>> + if (strncmp (rs->buf, "DC", 2))
>>> + {
>>
>> Why not remote_get_noisy_reply here.
>
> Changed. And I also add "PACKET_qTDC" for this part. But I am not
> sure set "remote_protocol_packets[PACKET_qTDC].support" inside the
> function is a good choice or not.
>
>>
>>
>> Regards,
>> Abid
>
>
> Post a new version for that. Please help me review it.
>
> Best,
> Hui
>
>
> 2013-04-16 Hui Zhu <hui@codesourcery.com>
>
> * remote.c (remote_upload_trace_default_collect): New static.
> (PACKET_QTDDCsrc, PACKET_qTDC): New.
> (remote_start_remote): Call remote_upload_trace_default_collect
> and trace_set_default_collect.
> (remote_download_tracepoint_default_collect): New.
> (remote_can_download_tracepoint): Set
> to_download_tracepoint_default_collect.
> (remote_upload_trace_default_collect): New.
> (_initialize_remote): Add QTDDCsrc and qTDC.
> * target.c (update_current_target): Add
> to_download_tracepoint_default_collect.
> * target.h (target_ops): to_download_tracepoint_default_collect.
> (target_download_tracepoint_default_collect): New.
> * tracepoint.c (start_tracing): Call
> target_download_tracepoint_default_collect.
> (trace_set_default_collect): New.
> * tracepoint.h (trace_set_default_collect): New extern.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [2/6] gdbserver
2013-04-11 9:14 ` [PATCH] store trace default-collect to target [2/6] gdbserver Hui Zhu
@ 2013-05-13 6:01 ` Hui Zhu
0 siblings, 0 replies; 34+ messages in thread
From: Hui Zhu @ 2013-05-13 6:01 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches ml
Ping http://sourceware.org/ml/gdb-patches/2013-04/msg00298.html
Thanks,
Hui
On Thu, Apr 11, 2013 at 2:17 PM, Hui Zhu <hui_zhu@mentor.com> wrote:
> 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.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [3/6] tfile
2013-04-17 11:21 ` Yao Qi
@ 2013-05-13 6:02 ` Hui Zhu
0 siblings, 0 replies; 34+ messages in thread
From: Hui Zhu @ 2013-05-13 6:02 UTC (permalink / raw)
To: gdb-patches ml; +Cc: Hui Zhu, Yao Qi
Ping http://sourceware.org/ml/gdb-patches/2013-04/msg00502.html
Thanks,
Hui
On Wed, Apr 17, 2013 at 9:58 AM, Yao Qi <yao@codesourcery.com> wrote:
> On 04/16/2013 05:30 PM, Hui Zhu wrote:
>> The old patch cannot patch to the upstream, so post a new version for that.
>>
>> Thanks,
>> Hui
>>
>> 2013-04-16 Hui Zhu<hui@codesourcery.com>
>>
>> * ctf.c (ctf_write_default_collect): New.
>> (trace_file_write_ops): Add ctf_write_default_collect.
>> * tracepoint.c (tfile_write_default_collect): New.
>> (trace_file_write_ops): Add tfile_write_default_collect.
>> (trace_save): Call writer->ops->write_default_collect.
>> (tfile_interp_line): Add collectp.
>> (tfile_open): Add support of default collect.
>> * tracepoint.h (trace_file_write_ops): Add write_default_collect.
>
> Hui, it is pity (again) to see you didn't incorporate my ctf part into
> this patch, so I did it for you.
>
> --
> Yao (齐尧)
>
> gdb:
>
> 2013-04-17 Hui Zhu <hui@codesourcery.com>
> Yao Qi <yao@codesourcery.com>
>
> * ctf.c (CTF_EVENT_ID_DEFAULT_COLLECT): New macro.
> (ctf_write_header): Write metadata for "default-collect"
> action.
> (ctf_write_default_collect): New.
> (trace_file_write_ops): Add ctf_write_default_collect.
> (ctf_read_default_collect): New.
> (ctf_open): Call ctf_read_default_collect.
> * tracepoint.c (tfile_write_default_collect): New.
> (trace_file_write_ops): Add tfile_write_default_collect.
> (trace_save): Call writer->ops->write_default_collect.
> (tfile_interp_line): Add parameter 'collectp'.
> (tfile_open): Add support of default collect.
> * tracepoint.h (trace_file_write_ops) <write_default_collect>:
> New.
> ---
> gdb/ctf.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> gdb/tracepoint.c | 32 +++++++++++++++++++++++--
> gdb/tracepoint.h | 4 +++
> 3 files changed, 101 insertions(+), 3 deletions(-)
>
> diff --git a/gdb/ctf.c b/gdb/ctf.c
> index b8252e4..413ce52 100644
> --- a/gdb/ctf.c
> +++ b/gdb/ctf.c
> @@ -75,6 +75,7 @@
> #define CTF_EVENT_ID_STATUS 4
> #define CTF_EVENT_ID_TSV_DEF 5
> #define CTF_EVENT_ID_TP_DEF 6
> +#define CTF_EVENT_ID_DEFAULT_COLLECT 7
>
> /* The state kept while writing the CTF datastream file. */
>
> @@ -429,6 +430,16 @@ ctf_write_header (struct trace_file_writer *self)
> "\t};\n"
> "};\n", CTF_EVENT_ID_TP_DEF);
>
> + ctf_save_write_metadata (&writer->tcs, "\n");
> + ctf_save_write_metadata (&writer->tcs,
> + "event {\n\tname = \"default_collect\";\n"
> + "\tid = %u;\n"
> + "\tfields := struct { \n"
> + "\t\tchars contents;\n"
> + "\t};\n"
> + "};\n",
> + CTF_EVENT_ID_DEFAULT_COLLECT);
> +
> gdb_assert (writer->tcs.content_size == 0);
> gdb_assert (writer->tcs.packet_start == 0);
>
> @@ -617,6 +628,26 @@ ctf_write_uploaded_tp (struct trace_file_writer *self,
> }
>
> /* This is the implementation of trace_file_write_ops method
> + write_default_collect. */
> +
> +static void
> +ctf_write_default_collect (struct trace_file_writer *self,
> + char *collect)
> +{
> + struct ctf_trace_file_writer *writer
> + = (struct ctf_trace_file_writer *) self;
> + int32_t int32;
> +
> + /* Event Id. */
> + int32 = CTF_EVENT_ID_DEFAULT_COLLECT;
> + ctf_save_align_write (&writer->tcs, (gdb_byte *) &int32, 4, 4);
> +
> + /* Contents. */
> + ctf_save_write (&writer->tcs, collect, strlen (collect) + 1);
> +
> +}
> +
> +/* This is the implementation of trace_file_write_ops method
> write_definition_end. */
>
> static void
> @@ -848,6 +879,7 @@ static const struct trace_file_write_ops ctf_write_ops =
> ctf_write_status,
> ctf_write_uploaded_tsv,
> ctf_write_uploaded_tp,
> + ctf_write_default_collect,
> ctf_write_definition_end,
> NULL,
> &ctf_write_frame_ops,
> @@ -1138,6 +1170,40 @@ ctf_read_tp (struct uploaded_tp **uploaded_tps)
> }
> }
>
> +/* Read a CTF event on "default-collect" and update the
> + "default-collect" action. */
> +
> +static void
> +ctf_read_default_collect (void)
> +{
> + struct bt_ctf_event *event;
> + const struct bt_definition *scope;
> + uint32_t u32;
> + char *default_collect;
> +
> + event = bt_ctf_iter_read_event (ctf_iter);
> + scope = bt_ctf_get_top_level_scope (event,
> + BT_STREAM_EVENT_HEADER);
> + u32 = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope,
> + "id"));
> +
> + if (u32 != CTF_EVENT_ID_DEFAULT_COLLECT)
> + error (_("Wrong event id!"));
> +
> + scope = bt_ctf_get_top_level_scope (event, BT_EVENT_FIELDS);
> + default_collect
> + = bt_ctf_get_string (bt_ctf_get_field (event, scope, "contents"));
> +
> + if (default_collect == NULL)
> + default_collect = xstrdup ("");
> + else
> + default_collect = xstrdup (default_collect);
> +
> + trace_set_default_collect (default_collect);
> +
> + bt_iter_next (bt_ctf_get_iter (ctf_iter));
> +}
> +
> /* This is the implementation of target_ops method to_open. Open CTF
> trace data, read trace status, trace state variables and tracepoint
> definitions from the first packet. Set the start position at the
> @@ -1179,6 +1245,8 @@ ctf_open (char *dirname, int from_tty)
>
> ctf_read_tp (&uploaded_tps);
>
> + ctf_read_default_collect ();
> +
> event = bt_ctf_iter_read_event (ctf_iter);
> /* EVENT can be NULL if we've already gone to the end of stream of
> events. */
> diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
> index c1c4d8f..b2ce6f4 100644
> --- a/gdb/tracepoint.c
> +++ b/gdb/tracepoint.c
> @@ -3237,6 +3237,19 @@ tfile_write_uploaded_tp (struct trace_file_writer *self,
> }
>
> /* This is the implementation of trace_file_write_ops method
> + write_default_collect. */
> +
> +static void
> +tfile_write_default_collect (struct trace_file_writer *self,
> + char *collect)
> +{
> + struct tfile_trace_file_writer *writer
> + = (struct tfile_trace_file_writer *) self;
> +
> + fprintf (writer->fp, "dc %s\n", collect);
> +}
> +
> +/* This is the implementation of trace_file_write_ops method
> write_definition_end. */
>
> static void
> @@ -3289,6 +3302,7 @@ static const struct trace_file_write_ops tfile_write_ops =
> tfile_write_status,
> tfile_write_uploaded_tsv,
> tfile_write_uploaded_tp,
> + tfile_write_default_collect,
> tfile_write_definition_end,
> tfile_write_raw_data,
> NULL,
> @@ -3378,6 +3392,8 @@ trace_save (const char *filename, struct trace_file_writer *writer,
> for (utp = uploaded_tps; utp; utp = utp->next)
> writer->ops->write_uploaded_tp (writer, utp);
>
> + writer->ops->write_default_collect (writer, default_collect);
> +
> free_uploaded_tps (&uploaded_tps);
>
> /* Mark the end of the definition section. */
> @@ -4147,7 +4163,8 @@ int trace_regblock_size;
>
> static void tfile_interp_line (char *line,
> struct uploaded_tp **utpp,
> - struct uploaded_tsv **utsvp);
> + struct uploaded_tsv **utsvp,
> + char **collectp);
>
> /* Read SIZE bytes into READBUF from the trace frame, starting at
> TRACE_FD's current position. Note that this call `read'
> @@ -4182,6 +4199,7 @@ tfile_open (char *filename, int from_tty)
> struct trace_status *ts;
> struct uploaded_tp *uploaded_tps = NULL;
> struct uploaded_tsv *uploaded_tsvs = NULL;
> + char *uploaded_default_collect = NULL;
>
> target_preopen (from_tty);
> if (!filename)
> @@ -4251,7 +4269,8 @@ tfile_open (char *filename, int from_tty)
> break;
> linebuf[i] = '\0';
> i = 0;
> - tfile_interp_line (linebuf, &uploaded_tps, &uploaded_tsvs);
> + tfile_interp_line (linebuf, &uploaded_tps, &uploaded_tsvs,
> + &uploaded_default_collect);
> }
> else
> linebuf[i++] = byte;
> @@ -4289,6 +4308,8 @@ tfile_open (char *filename, int from_tty)
>
> merge_uploaded_tracepoints (&uploaded_tps);
>
> + trace_set_default_collect (uploaded_default_collect);
> +
> post_create_inferior (&tfile_ops, from_tty);
> }
>
> @@ -4297,7 +4318,7 @@ tfile_open (char *filename, int from_tty)
>
> static void
> tfile_interp_line (char *line, struct uploaded_tp **utpp,
> - struct uploaded_tsv **utsvp)
> + struct uploaded_tsv **utsvp, char **collectp)
> {
> char *p = line;
>
> @@ -4321,6 +4342,11 @@ tfile_interp_line (char *line, struct uploaded_tp **utpp,
> p += strlen ("tsv ");
> parse_tsv_definition (p, utsvp);
> }
> + else if (strncmp (p, "dc ", strlen ("dc ")) == 0)
> + {
> + p += strlen ("dc ");
> + *collectp = xstrdup (p);
> + }
> else
> warning (_("Ignoring trace file definition \"%s\""), line);
> }
> diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
> index 3bf8d8f..cc38121 100644
> --- a/gdb/tracepoint.h
> +++ b/gdb/tracepoint.h
> @@ -296,6 +296,10 @@ struct trace_file_write_ops
> void (*write_uploaded_tp) (struct trace_file_writer *self,
> struct uploaded_tp *tp);
>
> + /* Write the tracepoint default collect. */
> + void (*write_default_collect) (struct trace_file_writer *self,
> + char *collect);
> +
> /* Write to mark the end of the definition part. */
> void (*write_definition_end) (struct trace_file_writer *self);
>
> --
> 1.7.7.6
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [4/6] save tracepoint
2013-04-11 10:36 ` [PATCH] store trace default-collect to target [4/6] save tracepoint Hui Zhu
@ 2013-05-13 6:03 ` Hui Zhu
0 siblings, 0 replies; 34+ messages in thread
From: Hui Zhu @ 2013-05-13 6:03 UTC (permalink / raw)
To: gdb-patches ml; +Cc: Hui Zhu
Ping http://sourceware.org/ml/gdb-patches/2013-04/msg00300.html
Thanks,
Hui
On Thu, Apr 11, 2013 at 2:18 PM, Hui Zhu <hui_zhu@mentor.com> wrote:
> Hi,
>
> This patch make save tracepoint command save default-collect to source file.
>
> Thanks,
> Hui
>
> 2013-04-11 Hui Zhu <hui@codesourcery.com>
>
> * breakpoint.c (save_breakpoints): Handle default_collect.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [5/6] doc
2013-04-16 15:44 ` Hui Zhu
@ 2013-05-13 6:04 ` Hui Zhu
2013-05-13 16:02 ` Eli Zaretskii
0 siblings, 1 reply; 34+ messages in thread
From: Hui Zhu @ 2013-05-13 6:04 UTC (permalink / raw)
To: gdb-patches ml; +Cc: Yao Qi, Hui Zhu, Eli Zaretskii
Ping http://sourceware.org/ml/gdb-patches/2013-04/msg00457.html
Thanks,
Hui
On Tue, Apr 16, 2013 at 6:11 PM, Hui Zhu <teawater@gmail.com> wrote:
> On Tue, Apr 16, 2013 at 5:46 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>>> From: Hui Zhu <teawater@gmail.com>
>>> Date: Tue, 16 Apr 2013 17:31:16 +0800
>>> Cc: Hui Zhu <hui_zhu@mentor.com>, gdb-patches ml <gdb-patches@sourceware.org>
>>>
>>> +qTDC
>>> + Request target upload trace default collect.
>>
>> "Request target to upload trace default collect."
>
> Fixed.
>
>>
>> OK with this change.
>
> Thanks,
> Hui
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [6/6] test
2013-04-16 15:44 ` Hui Zhu
@ 2013-05-13 6:06 ` Hui Zhu
0 siblings, 0 replies; 34+ messages in thread
From: Hui Zhu @ 2013-05-13 6:06 UTC (permalink / raw)
To: gdb-patches ml; +Cc: Hui Zhu, Yao Qi
Ping http://sourceware.org/ml/gdb-patches/2013-04/msg00455.html
Thanks,
Hui
On Tue, Apr 16, 2013 at 5:32 PM, Hui Zhu <teawater@gmail.com> wrote:
> Hi Yao,
>
> Thanks for your review.
>
> On Thu, Apr 11, 2013 at 4:19 PM, Yao Qi <yao@codesourcery.com> wrote:
>> On 04/11/2013 03:40 PM, Hui Zhu wrote:
>>>
>>> --- a/testsuite/gdb.trace/tstatus.exp
>>> +++ b/testsuite/gdb.trace/tstatus.exp
>>> @@ -137,6 +137,8 @@ proc test_tracepoints {} {
>>>
>>> test_tracepoints
>>>
>>> +gdb_test_no_output "set default-collect \$regs"
>>> +
>>> set tracefile [standard_output_file ${testfile}]
>>> # Save trace frames to tfile.
>>> gdb_test "tsave ${tracefile}.tf" \
>>> @@ -147,6 +149,8 @@ gdb_test "tsave -ctf ${tracefile}.ctf" \
>>> "Trace data saved to directory '${tracefile}.ctf'.*" \
>>> "save ctf trace file"
>>>
>>> +gdb_test_no_output "set default-collect"
>>> +
>>> # Change target to tfile.
>>> set test "change to tfile target"
>>> gdb_test_multiple "target tfile ${tracefile}.tf" "$test" {
>>> @@ -159,6 +163,8 @@ gdb_test_multiple "target tfile ${tracef
>>> }
>>> }
>>>
>>> +gdb_test "show default-collect" "The list of expressions to collect by
>>> default is \"\\\$regs\".*"
>>> +
>>> # Convert "(because I can) to "\(because I can\)"
>>> set tstatus_output [string map {\( \\(} $tstatus_output]
>>> set tstatus_output [string map {\) \\)} $tstatus_output]
>>
>>
>> I am afraid that tstatus.exp is not a good place to test "default-collect".
>> The tstatus.exp is to test the output of command 'tstatus' in various
>> situations, and also test that the output of 'tstatus' command on tfile
>> target is identical to its output on the ctf target. Probably, actions.exp
>> is better, IMO.
>
> Move it to actions.exp
>
> Post a new version for it.
>
> Best,
> Hui
>
> 2013-04-16 Hui Zhu <hui@codesourcery.com>
>
> * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Add
> test for default-collect.
> * gdb.trace/actions.exp: Add test for default-collect.
>
>>
>> --
>> Yao (齐尧)
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [5/6] doc
2013-05-13 6:04 ` Hui Zhu
@ 2013-05-13 16:02 ` Eli Zaretskii
2013-05-14 1:36 ` Hui Zhu
0 siblings, 1 reply; 34+ messages in thread
From: Eli Zaretskii @ 2013-05-13 16:02 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches, yao, hui_zhu
> From: Hui Zhu <teawater@gmail.com>
> Date: Mon, 13 May 2013 14:04:13 +0800
> Cc: Yao Qi <yao@codesourcery.com>, Hui Zhu <hui_zhu@mentor.com>,
> Eli Zaretskii <eliz@gnu.org>
>
> Ping http://sourceware.org/ml/gdb-patches/2013-04/msg00457.html
I said "OK with that change", which means no further approval is
needed once you make that change.
Thanks.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH] store trace default-collect to target [5/6] doc
2013-05-13 16:02 ` Eli Zaretskii
@ 2013-05-14 1:36 ` Hui Zhu
0 siblings, 0 replies; 34+ messages in thread
From: Hui Zhu @ 2013-05-14 1:36 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches, yao, hui_zhu
On Tue, May 14, 2013 at 12:01 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Hui Zhu <teawater@gmail.com>
>> Date: Mon, 13 May 2013 14:04:13 +0800
>> Cc: Yao Qi <yao@codesourcery.com>, Hui Zhu <hui_zhu@mentor.com>,
>> Eli Zaretskii <eliz@gnu.org>
>>
>> Ping http://sourceware.org/ml/gdb-patches/2013-04/msg00457.html
>
> I said "OK with that change", which means no further approval is
> needed once you make that change.
>
> Thanks.
Got it.
Thanks,
Hui
^ permalink raw reply [flat|nested] 34+ messages in thread
end of thread, other threads:[~2013-05-14 1:36 UTC | newest]
Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-11 8:35 [PATCH] store trace default-collect to target [0/6] Hui Zhu
2013-04-11 8:37 ` [PATCH] store trace default-collect to target [1/6] target, trace and remote Hui Zhu
2013-04-11 22:58 ` Yao Qi
2013-04-16 15:22 ` Hui Zhu
2013-05-13 6:00 ` Hui Zhu
2013-04-11 22:59 ` Abid, Hafiz
2013-04-11 9:14 ` [PATCH] store trace default-collect to target [2/6] gdbserver Hui Zhu
2013-05-13 6:01 ` Hui Zhu
2013-04-11 10:33 ` [PATCH] store trace default-collect to target [3/6] tfile Hui Zhu
2013-04-11 22:59 ` Yao Qi
2013-04-12 14:58 ` Hui Zhu
2013-04-15 19:01 ` Hui Zhu
2013-04-16 15:34 ` Hui Zhu
2013-04-17 11:21 ` Yao Qi
2013-05-13 6:02 ` Hui Zhu
2013-04-11 10:36 ` [PATCH] store trace default-collect to target [4/6] save tracepoint Hui Zhu
2013-05-13 6:03 ` Hui Zhu
2013-04-11 10:48 ` [PATCH] store trace default-collect to target [5/6] doc Hui Zhu
2013-04-11 22:59 ` Yao Qi
2013-04-16 14:35 ` Hui Zhu
2013-04-11 23:00 ` Eli Zaretskii
2013-04-16 15:39 ` Hui Zhu
2013-04-16 15:44 ` Eli Zaretskii
2013-04-16 15:44 ` Hui Zhu
2013-05-13 6:04 ` Hui Zhu
2013-05-13 16:02 ` Eli Zaretskii
2013-05-14 1:36 ` Hui Zhu
2013-04-11 10:49 ` [PATCH] store trace default-collect to target [6/6] test Hui Zhu
2013-04-11 13:14 ` Yao Qi
2013-04-11 14:01 ` Hui Zhu
2013-04-11 15:24 ` Yao Qi
2013-04-16 15:44 ` Hui Zhu
2013-05-13 6:06 ` Hui Zhu
2013-05-13 5:33 ` [PATCH] store trace default-collect to target [0/6] Hui Zhu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox