diff options
-rw-r--r-- | gdb/btrace.c | 2 | ||||
-rw-r--r-- | gdb/ravenscar-thread.c | 10 | ||||
-rw-r--r-- | gdb/remote.c | 8 | ||||
-rw-r--r-- | gdb/target-delegates.c | 12 | ||||
-rw-r--r-- | gdb/target.c | 4 | ||||
-rw-r--r-- | gdb/target.h | 6 | ||||
-rw-r--r-- | gdb/x86-linux-nat.c | 3 | ||||
-rw-r--r-- | gdb/x86-linux-nat.h | 2 | ||||
-rw-r--r-- | gdbserver/linux-low.cc | 4 | ||||
-rw-r--r-- | gdbserver/linux-low.h | 2 | ||||
-rw-r--r-- | gdbserver/server.cc | 4 | ||||
-rw-r--r-- | gdbserver/target.cc | 3 | ||||
-rw-r--r-- | gdbserver/target.h | 8 |
13 files changed, 38 insertions, 30 deletions
diff --git a/gdb/btrace.c b/gdb/btrace.c index dc4d686..ea733fe 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -1618,7 +1618,7 @@ btrace_enable (struct thread_info *tp, const struct btrace_config *conf) 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)."), diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 5f040ce..60fc353 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -120,12 +120,16 @@ struct ravenscar_thread_target final : public target_ops 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; diff --git a/gdb/remote.c b/gdb/remote.c index f19a2f7..9f2c63b 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -658,8 +658,8 @@ public: 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; @@ -14178,7 +14178,8 @@ remote_target::remote_btrace_maybe_reopen () /* 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; @@ -14202,6 +14203,7 @@ remote_target::enable_btrace (ptid_t ptid, const struct btrace_config *conf) btrace_sync_conf (conf); + ptid_t ptid = tp->ptid; set_general_thread (ptid); buf += xsnprintf (buf, endbuf - buf, "%s", packet->name); diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 9636e32..ca1734f 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -145,7 +145,7 @@ struct dummy_target : public target_ops 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; @@ -319,7 +319,7 @@ struct debug_target : public target_ops 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; @@ -3761,25 +3761,25 @@ debug_target::can_use_agent () } 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); diff --git a/gdb/target.c b/gdb/target.c index f3f1c80..548cfad 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -4060,9 +4060,9 @@ target_ranged_break_num_registers (void) /* 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. */ diff --git a/gdb/target.h b/gdb/target.h index 1ac7a45..4cc79df 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1151,10 +1151,10 @@ struct target_ops 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 ()); @@ -2502,7 +2502,7 @@ extern void update_target_permissions (void); /* 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); diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c index 55d2a1d..80be973 100644 --- a/gdb/x86-linux-nat.c +++ b/gdb/x86-linux-nat.c @@ -212,10 +212,11 @@ x86_linux_nat_target::read_description () /* 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); diff --git a/gdb/x86-linux-nat.h b/gdb/x86-linux-nat.h index e0a78bf..1a56234 100644 --- a/gdb/x86-linux-nat.h +++ b/gdb/x86-linux-nat.h @@ -32,7 +32,7 @@ struct x86_linux_nat_target : public x86_nat_target<linux_nat_target> /* 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; diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index 9e571a4..cf73bbc 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -6669,10 +6669,10 @@ linux_process_target::qxfer_libraries_svr4 (const char *annex, #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. */ diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h index 6ee72d7..27cc964 100644 --- a/gdbserver/linux-low.h +++ b/gdbserver/linux-low.h @@ -276,7 +276,7 @@ public: 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; diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 4177239..8e53f22 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -409,7 +409,7 @@ handle_btrace_enable_bts (struct thread_info *thread) 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. */ @@ -421,7 +421,7 @@ handle_btrace_enable_pt (struct thread_info *thread) 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. */ diff --git a/gdbserver/target.cc b/gdbserver/target.cc index 5165957..5009146 100644 --- a/gdbserver/target.cc +++ b/gdbserver/target.cc @@ -736,7 +736,8 @@ process_stratum_target::supports_agent () } 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.")); } diff --git a/gdbserver/target.h b/gdbserver/target.h index f58ed9d..aaa9dab 100644 --- a/gdbserver/target.h +++ b/gdbserver/target.h @@ -403,9 +403,9 @@ public: /* 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. @@ -635,9 +635,9 @@ int kill_inferior (process_info *proc); 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 |