From: Yao Qi <yao@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: [patch 3/8] New target hook `to_can_download_tracepoint_loc'
Date: Tue, 08 Nov 2011 06:21:00 -0000 [thread overview]
Message-ID: <4EB8CA57.2020108@codesourcery.com> (raw)
In-Reply-To: <4EB8C551.9090609@codesourcery.com>
[-- Attachment #1: Type: text/plain, Size: 371 bytes --]
This patch is to add a new target hook 'to_can_download_tracepoint_loc'
to determine whether it is OK for remote target to receive tracepoint
locations.
Note that, `download_tracepoint_loc' itself can check this in lower
level, but it is not efficient, and it leaves managing location's status
to lower level.
This patch is needed by patch 4/8.
--
Yao (é½å°§)
[-- Attachment #2: 0003-new-target-hook-can_download_tracepoint_loc.patch --]
[-- Type: text/x-patch, Size: 3450 bytes --]
* target.h (struct target): New field
`to_can_download_tracepoint_loc'.
(target_can_download_tracepoint_loc): New macro.
* target.c (update_current_target): Update.
* remote.c (remote_can_download_tracepoint_loc): New.
---
gdb/remote.c | 19 +++++++++++++++++++
gdb/target.c | 4 ++++
gdb/target.h | 7 +++++++
3 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/gdb/remote.c b/gdb/remote.c
index c34d47b..5ba497a 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -10036,6 +10036,24 @@ remote_download_tracepoint_loc (struct bp_location *loc)
}
+static int
+remote_can_download_tracepoint_loc ()
+{
+ struct trace_status *ts = current_trace_status ();
+ int status = remote_get_trace_status (ts);
+
+ if (status == -1 || !ts->running_known || !ts->running)
+ return 0;
+
+ /* If we are in a tracing experiment, but remote stub doesn't support
+ installing tracepoint in trace, we have to return. */
+ if (!remote_supports_install_in_trace ())
+ return 0;
+
+ return 1;
+}
+
+
static void
remote_download_trace_state_variable (struct trace_state_variable *tsv)
{
@@ -10508,6 +10526,7 @@ Specify the serial device it is connected to\n\
remote_ops.to_supports_string_tracing = remote_supports_string_tracing;
remote_ops.to_trace_init = remote_trace_init;
remote_ops.to_download_tracepoint_loc = remote_download_tracepoint_loc;
+ remote_ops.to_can_download_tracepoint_loc = remote_can_download_tracepoint_loc;
remote_ops.to_download_trace_state_variable
= remote_download_trace_state_variable;
remote_ops.to_enable_tracepoint = remote_enable_tracepoint;
diff --git a/gdb/target.c b/gdb/target.c
index 48cd888..d236530 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -675,6 +675,7 @@ update_current_target (void)
INHERIT (to_supports_string_tracing, t);
INHERIT (to_trace_init, t);
INHERIT (to_download_tracepoint_loc, t);
+ INHERIT (to_can_download_tracepoint_loc, t);
INHERIT (to_download_trace_state_variable, t);
INHERIT (to_enable_tracepoint, t);
INHERIT (to_disable_tracepoint, t);
@@ -850,6 +851,9 @@ update_current_target (void)
de_fault (to_download_tracepoint_loc,
(int (*) (struct bp_location *))
tcomplain);
+ de_fault (to_can_download_tracepoint_loc,
+ (int (*) (void))
+ return_zero);
de_fault (to_download_trace_state_variable,
(void (*) (struct trace_state_variable *))
tcomplain);
diff --git a/gdb/target.h b/gdb/target.h
index 74e1d8a..69a2a32 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -693,6 +693,10 @@ struct target_ops
otherwise return 1. */
int (*to_download_tracepoint_loc) (struct bp_location *location);
+ /* Can the target be able to download tracepoint locations in current
+ status? */
+ int (*to_can_download_tracepoint_loc) (void);
+
/* Send full details of a trace state variable to the target. */
void (*to_download_trace_state_variable) (struct trace_state_variable *tsv);
@@ -1481,6 +1485,9 @@ extern int target_search_memory (CORE_ADDR start_addr,
#define target_download_tracepoint_loc(t) \
(*current_target.to_download_tracepoint_loc) (t)
+#define target_can_download_tracepoint_loc() \
+ (*current_target.to_can_download_tracepoint_loc) ()
+
#define target_download_trace_state_variable(tsv) \
(*current_target.to_download_trace_state_variable) (tsv)
--
1.7.0.4
next prev parent reply other threads:[~2011-11-08 6:21 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 6:00 [patch 0/8] Download tracepoint locations when tracing is running Yao Qi
2011-11-08 6:08 ` [patch 1/8] Download tracepoint on location level Yao Qi
2011-11-09 3:34 ` Yao Qi
2011-11-10 14:54 ` Pedro Alves
2011-11-08 6:12 ` [patch 2/8] New remote feature InstallInTrace Yao Qi
2011-11-10 15:03 ` Pedro Alves
2011-11-08 6:21 ` Yao Qi [this message]
2011-11-10 15:11 ` [patch 3/8] New target hook `to_can_download_tracepoint_loc' Pedro Alves
2011-11-08 6:30 ` [patch 4/8] Download tracepoint locations and track its status Yao Qi
2011-11-09 3:47 ` Yao Qi
2011-11-10 15:51 ` Pedro Alves
2011-11-12 2:11 ` Yao Qi
2011-11-14 12:24 ` Pedro Alves
2011-11-08 6:33 ` [patch 5/8] refactor gdbserver on installing fast tracepoint Yao Qi
2011-11-10 15:57 ` Pedro Alves
2011-11-08 6:40 ` [patch 6/8] gdbserver - Install tracepoint when tracing is running Yao Qi
2011-11-08 8:20 ` Eli Zaretskii
2011-11-08 8:41 ` Yao Qi
2011-11-08 11:38 ` Eli Zaretskii
2011-11-10 16:53 ` Pedro Alves
2011-11-12 2:40 ` Yao Qi
2011-11-14 12:32 ` Pedro Alves
2011-11-08 6:43 ` [patch 7/8] Documentation changes Yao Qi
2011-11-08 8:37 ` Eli Zaretskii
2011-11-10 17:02 ` Pedro Alves
2011-11-12 3:09 ` Yao Qi
2011-11-08 6:56 ` [patch 8/8] Test cases Yao Qi
2011-11-10 17:16 ` Pedro Alves
2011-11-10 18:28 ` Pedro Alves
2011-11-12 3:35 ` Yao Qi
2011-11-14 13:00 ` Pedro Alves
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=4EB8CA57.2020108@codesourcery.com \
--to=yao@codesourcery.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