DEBUG ("enable thread %s (%s)", print_thread_id (tp),
tp->ptid.to_string ().c_str ());
- tp->btrace.target = target_enable_btrace (tp->ptid, conf);
+ tp->btrace.target = target_enable_btrace (tp, conf);
if (tp->btrace.target == NULL)
error (_("Failed to enable recording on thread %s (%s)."),
ptid_t get_ada_task_ptid (long lwp, ULONGEST thread) override;
- struct btrace_target_info *enable_btrace (ptid_t ptid,
+ struct btrace_target_info *enable_btrace (thread_info *tp,
const struct btrace_config *conf)
override
{
- ptid = get_base_thread_from_ravenscar_task (ptid);
- return beneath ()->enable_btrace (ptid, conf);
+ process_stratum_target *proc_target
+ = as_process_stratum_target (this->beneath ());
+ ptid_t underlying = get_base_thread_from_ravenscar_task (tp->ptid);
+ tp = find_thread_ptid (proc_target, underlying);
+
+ return beneath ()->enable_btrace (tp, conf);
}
void mourn_inferior () override;
bool use_agent (bool use) override;
bool can_use_agent () override;
- struct btrace_target_info *enable_btrace (ptid_t ptid,
- const struct btrace_config *conf) override;
+ struct btrace_target_info *
+ enable_btrace (thread_info *tp, const struct btrace_config *conf) override;
void disable_btrace (struct btrace_target_info *tinfo) override;
/* Enable branch tracing. */
struct btrace_target_info *
-remote_target::enable_btrace (ptid_t ptid, const struct btrace_config *conf)
+remote_target::enable_btrace (thread_info *tp,
+ const struct btrace_config *conf)
{
struct btrace_target_info *tinfo = NULL;
struct packet_config *packet = NULL;
btrace_sync_conf (conf);
+ ptid_t ptid = tp->ptid;
set_general_thread (ptid);
buf += xsnprintf (buf, endbuf - buf, "%s", packet->name);
traceframe_info_up traceframe_info () override;
bool use_agent (bool arg0) override;
bool can_use_agent () override;
- struct btrace_target_info *enable_btrace (ptid_t arg0, const struct btrace_config *arg1) override;
+ struct btrace_target_info *enable_btrace (thread_info *arg0, const struct btrace_config *arg1) override;
void disable_btrace (struct btrace_target_info *arg0) override;
void teardown_btrace (struct btrace_target_info *arg0) override;
enum btrace_error read_btrace (struct btrace_data *arg0, struct btrace_target_info *arg1, enum btrace_read_type arg2) override;
traceframe_info_up traceframe_info () override;
bool use_agent (bool arg0) override;
bool can_use_agent () override;
- struct btrace_target_info *enable_btrace (ptid_t arg0, const struct btrace_config *arg1) override;
+ struct btrace_target_info *enable_btrace (thread_info *arg0, const struct btrace_config *arg1) override;
void disable_btrace (struct btrace_target_info *arg0) override;
void teardown_btrace (struct btrace_target_info *arg0) override;
enum btrace_error read_btrace (struct btrace_data *arg0, struct btrace_target_info *arg1, enum btrace_read_type arg2) override;
}
struct btrace_target_info *
-target_ops::enable_btrace (ptid_t arg0, const struct btrace_config *arg1)
+target_ops::enable_btrace (thread_info *arg0, const struct btrace_config *arg1)
{
return this->beneath ()->enable_btrace (arg0, arg1);
}
struct btrace_target_info *
-dummy_target::enable_btrace (ptid_t arg0, const struct btrace_config *arg1)
+dummy_target::enable_btrace (thread_info *arg0, const struct btrace_config *arg1)
{
tcomplain ();
}
struct btrace_target_info *
-debug_target::enable_btrace (ptid_t arg0, const struct btrace_config *arg1)
+debug_target::enable_btrace (thread_info *arg0, const struct btrace_config *arg1)
{
struct btrace_target_info * result;
fprintf_unfiltered (gdb_stdlog, "-> %s->enable_btrace (...)\n", this->beneath ()->shortname ());
result = this->beneath ()->enable_btrace (arg0, arg1);
fprintf_unfiltered (gdb_stdlog, "<- %s->enable_btrace (", this->beneath ()->shortname ());
- target_debug_print_ptid_t (arg0);
+ target_debug_print_thread_info_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_const_struct_btrace_config_p (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
/* See target.h. */
struct btrace_target_info *
-target_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
+target_enable_btrace (thread_info *tp, const struct btrace_config *conf)
{
- return current_inferior ()->top_target ()->enable_btrace (ptid, conf);
+ return current_inferior ()->top_target ()->enable_btrace (tp, conf);
}
/* See target.h. */
virtual bool can_use_agent ()
TARGET_DEFAULT_RETURN (false);
- /* Enable branch tracing for PTID using CONF configuration.
+ /* Enable branch tracing for TP using CONF configuration.
Return a branch trace target information struct for reading and for
disabling branch trace. */
- virtual struct btrace_target_info *enable_btrace (ptid_t ptid,
+ virtual struct btrace_target_info *enable_btrace (thread_info *tp,
const struct btrace_config *conf)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* See to_enable_btrace in struct target_ops. */
extern struct btrace_target_info *
- target_enable_btrace (ptid_t ptid, const struct btrace_config *);
+ target_enable_btrace (thread_info *tp, const struct btrace_config *);
/* See to_disable_btrace in struct target_ops. */
extern void target_disable_btrace (struct btrace_target_info *btinfo);
/* Enable branch tracing. */
struct btrace_target_info *
-x86_linux_nat_target::enable_btrace (ptid_t ptid,
+x86_linux_nat_target::enable_btrace (thread_info *tp,
const struct btrace_config *conf)
{
struct btrace_target_info *tinfo = nullptr;
+ ptid_t ptid = tp->ptid;
try
{
tinfo = linux_enable_btrace (ptid, conf);
/* Add the description reader. */
const struct target_desc *read_description () override;
- struct btrace_target_info *enable_btrace (ptid_t ptid,
+ struct btrace_target_info *enable_btrace (thread_info *tp,
const struct btrace_config *conf) override;
void disable_btrace (struct btrace_target_info *tinfo) override;
void teardown_btrace (struct btrace_target_info *tinfo) override;
#ifdef HAVE_LINUX_BTRACE
btrace_target_info *
-linux_process_target::enable_btrace (ptid_t ptid,
+linux_process_target::enable_btrace (thread_info *tp,
const btrace_config *conf)
{
- return linux_enable_btrace (ptid, conf);
+ return linux_enable_btrace (tp->id, conf);
}
/* See to_disable_btrace target method. */
bool supports_agent () override;
#ifdef HAVE_LINUX_BTRACE
- btrace_target_info *enable_btrace (ptid_t ptid,
+ btrace_target_info *enable_btrace (thread_info *tp,
const btrace_config *conf) override;
int disable_btrace (btrace_target_info *tinfo) override;
error (_("Btrace already enabled."));
current_btrace_conf.format = BTRACE_FORMAT_BTS;
- thread->btrace = target_enable_btrace (thread->id, ¤t_btrace_conf);
+ thread->btrace = target_enable_btrace (thread, ¤t_btrace_conf);
}
/* Handle btrace enabling in Intel Processor Trace format. */
error (_("Btrace already enabled."));
current_btrace_conf.format = BTRACE_FORMAT_PT;
- thread->btrace = target_enable_btrace (thread->id, ¤t_btrace_conf);
+ thread->btrace = target_enable_btrace (thread, ¤t_btrace_conf);
}
/* Handle btrace disabling. */
}
btrace_target_info *
-process_stratum_target::enable_btrace (ptid_t ptid, const btrace_config *conf)
+process_stratum_target::enable_btrace (thread_info *tp,
+ const btrace_config *conf)
{
error (_("Target does not support branch tracing."));
}
/* Return true if target supports debugging agent. */
virtual bool supports_agent ();
- /* Enable branch tracing for PTID based on CONF and allocate a branch trace
+ /* Enable branch tracing for TP based on CONF and allocate a branch trace
target information struct for reading and for disabling branch trace. */
- virtual btrace_target_info *enable_btrace (ptid_t ptid,
+ virtual btrace_target_info *enable_btrace (thread_info *tp,
const btrace_config *conf);
/* Disable branch tracing.
the_target->supports_agent ()
static inline struct btrace_target_info *
-target_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
+target_enable_btrace (thread_info *tp, const struct btrace_config *conf)
{
- return the_target->enable_btrace (ptid, conf);
+ return the_target->enable_btrace (tp, conf);
}
static inline int