diff options
author | Markus Metzger <markus.t.metzger@intel.com> | 2021-11-25 15:15:52 +0100 |
---|---|---|
committer | Markus Metzger <markus.t.metzger@intel.com> | 2022-01-27 13:31:20 +0100 |
commit | 696c0d5ef2a6edaa2094e808f53acd502a157641 (patch) | |
tree | 351b7bfa2d640104e2a5b1db0136fc29814ee388 /gdb | |
parent | b674665b51112de22260709a214d4d6ba01c7e57 (diff) | |
download | gdb-696c0d5ef2a6edaa2094e808f53acd502a157641.zip gdb-696c0d5ef2a6edaa2094e808f53acd502a157641.tar.gz gdb-696c0d5ef2a6edaa2094e808f53acd502a157641.tar.bz2 |
gdb, gdbserver: update thread identifier in enable_btrace target method
The enable_btrace target method takes a ptid_t to identify the thread on
which tracing shall be enabled.
Change this to thread_info * to avoid translating back and forth between
the two. This will be used in a subsequent patch.
Diffstat (limited to 'gdb')
-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 |
8 files changed, 27 insertions, 20 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; |