From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [RFC v2 05/38] convert to_supports_btrace
Date: Thu, 06 Feb 2014 21:24:00 -0000 [thread overview]
Message-ID: <1391720136-2121-6-git-send-email-tromey@redhat.com> (raw)
In-Reply-To: <1391720136-2121-1-git-send-email-tromey@redhat.com>
This adds a "self" argument to to_supports_btrace. Due to how one
implementation of this method is shared with gdbserver this required a
small change to gdbserver as well.
2014-02-06 Tom Tromey <tromey@redhat.com>
* common/linux-btrace.c (linux_supports_btrace): Add "ops"
argument.
* common/linux-btrace.h (linux_supports_btrace): Update.
* remote.c (remote_supports_btrace): Add "self" argument.
* target-delegates.c: Rebuild.
* target.c (target_supports_btrace): Remove.
* target.h (struct target_ops) <to_supports_btrace>: Add
target_ops argument.
(target_supports_btrace): New define.
2014-02-06 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <supports_btrace>: Add target_ops
argument.
(target_supports_btrace): Update.
---
gdb/ChangeLog | 12 ++++++++++++
gdb/common/linux-btrace.c | 4 ++--
gdb/common/linux-btrace.h | 2 +-
gdb/gdbserver/ChangeLog | 6 ++++++
gdb/gdbserver/target.h | 7 ++++---
gdb/remote.c | 2 +-
gdb/target-delegates.c | 16 ++++++++++++++++
gdb/target.c | 14 --------------
gdb/target.h | 6 ++++--
9 files changed, 46 insertions(+), 23 deletions(-)
diff --git a/gdb/common/linux-btrace.c b/gdb/common/linux-btrace.c
index 218e0ce..188220b 100644
--- a/gdb/common/linux-btrace.c
+++ b/gdb/common/linux-btrace.c
@@ -407,7 +407,7 @@ cpu_supports_btrace (void)
/* See linux-btrace.h. */
int
-linux_supports_btrace (void)
+linux_supports_btrace (struct target_ops *ops)
{
static int cached;
@@ -600,7 +600,7 @@ linux_read_btrace (VEC (btrace_block_s) **btrace,
/* See linux-btrace.h. */
int
-linux_supports_btrace (void)
+linux_supports_btrace (struct target_ops *ops)
{
return 0;
}
diff --git a/gdb/common/linux-btrace.h b/gdb/common/linux-btrace.h
index a97b697..12e9b60 100644
--- a/gdb/common/linux-btrace.h
+++ b/gdb/common/linux-btrace.h
@@ -62,7 +62,7 @@ struct btrace_target_info
};
/* See to_supports_btrace in target.h. */
-extern int linux_supports_btrace (void);
+extern int linux_supports_btrace (struct target_ops *);
/* See to_enable_btrace in target.h. */
extern struct btrace_target_info *linux_enable_btrace (ptid_t ptid);
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index ae48cd7..7374d58 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -350,7 +350,7 @@ struct target_ops
int (*supports_agent) (void);
/* Check whether the target supports branch tracing. */
- int (*supports_btrace) (void);
+ int (*supports_btrace) (struct target_ops *);
/* Enable branch tracing for @ptid and allocate a branch trace target
information struct for reading and for disabling branch trace. */
@@ -491,8 +491,9 @@ int kill_inferior (int);
(the_target->supports_agent ? \
(*the_target->supports_agent) () : 0)
-#define target_supports_btrace() \
- (the_target->supports_btrace ? (*the_target->supports_btrace) () : 0)
+#define target_supports_btrace() \
+ (the_target->supports_btrace \
+ ? (*the_target->supports_btrace) (the_target) : 0)
#define target_enable_btrace(ptid) \
(*the_target->enable_btrace) (ptid)
diff --git a/gdb/remote.c b/gdb/remote.c
index c6767d4..1996571 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -11389,7 +11389,7 @@ struct btrace_target_info
/* Check whether the target supports branch tracing. */
static int
-remote_supports_btrace (void)
+remote_supports_btrace (struct target_ops *self)
{
if (remote_protocol_packets[PACKET_Qbtrace_off].support != PACKET_ENABLE)
return 0;
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 8f28321..a7877cc 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -122,6 +122,19 @@ tdefault_xfer_partial (struct target_ops *self, enum target_object arg1, const
return -1;
}
+static int
+delegate_supports_btrace (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_supports_btrace (self);
+}
+
+static int
+tdefault_supports_btrace (struct target_ops *self)
+{
+ return 0;
+}
+
static void
install_delegators (struct target_ops *ops)
{
@@ -147,6 +160,8 @@ install_delegators (struct target_ops *ops)
ops->to_async = delegate_async;
if (ops->to_xfer_partial == NULL)
ops->to_xfer_partial = delegate_xfer_partial;
+ if (ops->to_supports_btrace == NULL)
+ ops->to_supports_btrace = delegate_supports_btrace;
}
static void
@@ -163,4 +178,5 @@ install_dummy_methods (struct target_ops *ops)
ops->to_is_async_p = find_default_is_async_p;
ops->to_async = tdefault_async;
ops->to_xfer_partial = tdefault_xfer_partial;
+ ops->to_supports_btrace = tdefault_supports_btrace;
}
diff --git a/gdb/target.c b/gdb/target.c
index bde91ab..8ab9cbf 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -4109,20 +4109,6 @@ target_ranged_break_num_registers (void)
/* See target.h. */
-int
-target_supports_btrace (void)
-{
- struct target_ops *t;
-
- for (t = current_target.beneath; t != NULL; t = t->beneath)
- if (t->to_supports_btrace != NULL)
- return t->to_supports_btrace ();
-
- return 0;
-}
-
-/* See target.h. */
-
struct btrace_target_info *
target_enable_btrace (ptid_t ptid)
{
diff --git a/gdb/target.h b/gdb/target.h
index 8d00d3a..76a2d1b 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -859,7 +859,8 @@ struct target_ops
int (*to_can_use_agent) (void);
/* Check whether the target supports branch tracing. */
- int (*to_supports_btrace) (void);
+ int (*to_supports_btrace) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (0);
/* Enable branch tracing for PTID and allocate a branch trace target
information struct for reading and for disabling branch trace. */
@@ -2019,7 +2020,8 @@ extern void update_target_permissions (void);
void target_ignore (void);
/* See to_supports_btrace in struct target_ops. */
-extern int target_supports_btrace (void);
+#define target_supports_btrace() \
+ (current_target.to_supports_btrace (¤t_target))
/* See to_enable_btrace in struct target_ops. */
extern struct btrace_target_info *target_enable_btrace (ptid_t ptid);
--
1.8.1.4
next prev parent reply other threads:[~2014-02-06 21:24 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-06 20:55 [RFC v2 00/38] clean up target delegation Tom Tromey
2014-02-06 20:55 ` [RFC v2 16/38] Add target_ops argument to to_static_tracepoint_markers_by_strid Tom Tromey
2014-02-06 20:55 ` [RFC v2 03/38] add make-target-delegates Tom Tromey
2014-02-06 20:55 ` [RFC v2 09/38] Add target_ops argument to to_insert_vfork_catchpoint Tom Tromey
2014-02-06 20:55 ` [RFC v2 08/38] Add target_ops argument to to_terminal_init Tom Tromey
2014-02-06 20:55 ` [RFC v2 02/38] introduce and use find_target_at Tom Tromey
2014-02-07 15:43 ` Pedro Alves
2014-02-07 21:54 ` Tom Tromey
2014-02-10 14:28 ` Pedro Alves
2014-02-06 20:56 ` [RFC v2 29/38] convert to_search_memory Tom Tromey
2014-02-06 20:56 ` [RFC v2 22/38] convert to_thread_architecture Tom Tromey
2014-02-06 20:56 ` [RFC v2 35/38] remove some calls to INHERIT and de_fault Tom Tromey
2014-02-06 20:56 ` [RFC v2 01/38] add "this" pointers to more target APIs Tom Tromey
2014-02-08 5:19 ` Doug Evans
2014-02-10 22:36 ` Doug Evans
2014-02-10 23:01 ` Doug Evans
2014-02-12 19:56 ` Tom Tromey
2014-02-12 20:22 ` Doug Evans
2014-02-06 20:56 ` [RFC v2 07/38] Add target_ops argument to to_close Tom Tromey
2014-02-08 3:00 ` Yao Qi
2014-02-10 17:50 ` Tom Tromey
2014-02-06 20:56 ` [RFC v2 37/38] fix buglet in nto-procfs.c Tom Tromey
2014-02-07 16:01 ` Pedro Alves
2014-02-06 20:56 ` [RFC v2 27/38] convert to_get_section_table Tom Tromey
2014-02-06 20:56 ` [RFC v2 10/38] Add target_ops argument to to_thread_name Tom Tromey
2014-02-06 20:56 ` [RFC v2 28/38] convert to_insn_history Tom Tromey
2014-02-06 20:56 ` [RFC v2 23/38] convert to_disable_tracepoint Tom Tromey
2014-02-06 20:56 ` [RFC v2 21/38] convert to_extra_thread_info Tom Tromey
2014-02-06 20:56 ` [RFC v2 26/38] convert to_insert_mask_watchpoint Tom Tromey
2014-02-06 20:56 ` [RFC v2 34/38] remove exec_set_find_memory_regions Tom Tromey
2014-02-06 20:56 ` [RFC v2 24/38] convert to_upload_trace_state_variables Tom Tromey
2014-02-06 20:56 ` [RFC v2 32/38] remove function casts from target.c Tom Tromey
2014-02-06 20:56 ` [RFC v2 36/38] convert to_decr_pc_after_break Tom Tromey
2014-02-06 20:58 ` [RFC v2 25/38] convert to_static_tracepoint_markers_by_strid Tom Tromey
2014-02-06 20:58 ` [RFC v2 11/38] Add target_ops argument to to_get_ada_task_ptid Tom Tromey
2014-02-06 20:58 ` [RFC v2 04/38] add target method delegation Tom Tromey
2014-02-07 15:53 ` Pedro Alves
2014-02-07 21:37 ` Tom Tromey
2014-02-06 20:58 ` [RFC v2 17/38] Add target_ops argument to to_save_record Tom Tromey
2014-02-06 20:58 ` [RFC v2 20/38] convert to_load Tom Tromey
2014-02-06 21:23 ` [RFC v2 06/38] introduce remote_load Tom Tromey
2014-02-06 21:23 ` [RFC v2 12/38] Add target_ops argument to to_can_execute_reverse Tom Tromey
2014-02-06 21:23 ` [RFC v2 19/38] convert to_remove_watchpoint Tom Tromey
2014-02-06 21:23 ` [RFC v2 15/38] Add target_ops argument to to_upload_trace_state_variables Tom Tromey
2014-02-06 21:24 ` [RFC v2 31/38] minor cleanups to update_current_target Tom Tromey
2014-02-06 21:24 ` [RFC v2 13/38] Add target_ops argument to to_fileio_pwrite Tom Tromey
2014-02-06 21:24 ` [RFC v2 14/38] Add target_ops argument to to_disable_tracepoint Tom Tromey
2014-02-06 21:24 ` Tom Tromey [this message]
2014-02-06 21:38 ` [RFC v2 30/38] change delegation for to_read_description Tom Tromey
2014-02-06 21:38 ` [RFC v2 33/38] pass NULL to TARGET_DEFAULT_RETURN when appropriate Tom Tromey
2014-02-06 21:42 ` [RFC v2 18/38] convert to_detach Tom Tromey
2014-02-06 21:47 ` [RFC v2 38/38] convert to_get_unwinder and to_get_tailcall_unwinder to methods Tom Tromey
2014-02-07 16:02 ` Pedro Alves
2014-02-07 16:47 ` [RFC v2 00/38] clean up target delegation Pedro Alves
2014-02-19 16:35 ` Tom Tromey
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=1391720136-2121-6-git-send-email-tromey@redhat.com \
--to=tromey@redhat.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