diff options
author | Tom Tromey <tromey@redhat.com> | 2013-12-13 13:26:04 -0700 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2014-02-19 07:45:26 -0700 |
commit | 46917d26c8a2aa8054bbed410c432eadf355d172 (patch) | |
tree | 8f4207d9a430554d7d892515bcfc54cc315b49d9 | |
parent | 6b84065d0e65d86f5c38bf139ec68101ea65d802 (diff) | |
download | gdb-46917d26c8a2aa8054bbed410c432eadf355d172.zip gdb-46917d26c8a2aa8054bbed410c432eadf355d172.tar.gz gdb-46917d26c8a2aa8054bbed410c432eadf355d172.tar.bz2 |
convert to_supports_btrace
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-19 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-19 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <supports_btrace>: Add target_ops
argument.
(target_supports_btrace): Update.
-rw-r--r-- | gdb/ChangeLog | 12 | ||||
-rw-r--r-- | gdb/common/linux-btrace.c | 4 | ||||
-rw-r--r-- | gdb/common/linux-btrace.h | 2 | ||||
-rw-r--r-- | gdb/gdbserver/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/gdbserver/target.h | 7 | ||||
-rw-r--r-- | gdb/remote.c | 2 | ||||
-rw-r--r-- | gdb/target-delegates.c | 16 | ||||
-rw-r--r-- | gdb/target.c | 14 | ||||
-rw-r--r-- | gdb/target.h | 6 |
9 files changed, 46 insertions, 23 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8009cb6..e80562d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,17 @@ 2014-02-19 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-19 Tom Tromey <tromey@redhat.com> + * record-full.c (record_full_beneath_to_resume_ops) (record_full_beneath_to_resume, record_full_beneath_to_wait_ops) (record_full_beneath_to_wait) 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/ChangeLog b/gdb/gdbserver/ChangeLog index 1786bfb..9231f07 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,9 @@ +2014-02-19 Tom Tromey <tromey@redhat.com> + + * target.h (struct target_ops) <supports_btrace>: Add target_ops + argument. + (target_supports_btrace): Update. + 2014-02-14 Yao Qi <yao@codesourcery.com> * Makefile.in (IPA_OBJS): Append rsp-low-ipa.o. 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 e6fd8b3..e5bddb7 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -11199,7 +11199,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 2d6ce79..0685729 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 TARGET_XFER_E_IO; } +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 76f4c15..7ac8728 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -4170,20 +4170,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 25b54d9..7709c16 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -872,7 +872,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. */ @@ -2032,7 +2033,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); |