+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)
/* See linux-btrace.h. */
int
-linux_supports_btrace (void)
+linux_supports_btrace (struct target_ops *ops)
{
static int cached;
/* See linux-btrace.h. */
int
-linux_supports_btrace (void)
+linux_supports_btrace (struct target_ops *ops)
{
return 0;
}
};
/* 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);
+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.
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. */
(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)
/* 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;
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)
{
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
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;
}
/* 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)
{
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. */
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);