From: Hui Zhu <hui_zhu@mentor.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Subject: [PATCH] store trace default-collect to target [1/6] target, trace and remote
Date: Thu, 11 Apr 2013 08:37:00 -0000 [thread overview]
Message-ID: <5166554D.2070906@mentor.com> (raw)
In-Reply-To: <51665508.5050706@mentor.com>
[-- 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 */
next prev parent reply other threads:[~2013-04-11 6:16 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-11 8:35 [PATCH] store trace default-collect to target [0/6] Hui Zhu
2013-04-11 8:37 ` Hui Zhu [this message]
2013-04-11 22:58 ` [PATCH] store trace default-collect to target [1/6] target, trace and remote 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5166554D.2070906@mentor.com \
--to=hui_zhu@mentor.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox