aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2024-11-06 15:02:11 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2024-11-08 09:16:23 -0500
commit65b7d4502b20a5a3130310e9039bf4525862d78c (patch)
tree0976b9621ce4c1befe00ebf02585bd5e0caae14c
parent5929ef8975c0af9333694b69b06c23768b28ede6 (diff)
downloadgdb-65b7d4502b20a5a3130310e9039bf4525862d78c.zip
gdb-65b7d4502b20a5a3130310e9039bf4525862d78c.tar.gz
gdb-65b7d4502b20a5a3130310e9039bf4525862d78c.tar.bz2
gdbserver: remove pid_of(thread)
This function doesn't seem so useful, use `thread_info::id::pid` directly instead. Change-Id: I7450c4223e5b0bf66788eeb5b070ab6f5287f798 Reviewed-By: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
-rw-r--r--gdbserver/gdbthread.h8
-rw-r--r--gdbserver/linux-aarch64-low.cc6
-rw-r--r--gdbserver/linux-arm-low.cc2
-rw-r--r--gdbserver/linux-low.cc11
-rw-r--r--gdbserver/linux-s390-low.cc2
-rw-r--r--gdbserver/server.cc2
6 files changed, 11 insertions, 20 deletions
diff --git a/gdbserver/gdbthread.h b/gdbserver/gdbthread.h
index ff43977..11ab7f4 100644
--- a/gdbserver/gdbthread.h
+++ b/gdbserver/gdbthread.h
@@ -136,14 +136,6 @@ thread_info *find_thread_in_random
thread_info *find_thread_in_random
(ptid_t ptid, gdb::function_view<bool (thread_info *)> func);
-/* Get the pid of THREAD. */
-
-static inline int
-pid_of (const thread_info *thread)
-{
- return thread->id.pid ();
-}
-
/* Switch the current thread. */
void switch_to_thread (thread_info *thread);
diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
index 2ad818b..7dabd57 100644
--- a/gdbserver/linux-aarch64-low.cc
+++ b/gdbserver/linux-aarch64-low.cc
@@ -436,7 +436,7 @@ aarch64_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
int ret;
enum target_hw_bp_type targ_type;
struct aarch64_debug_reg_state *state
- = aarch64_get_debug_reg_state (pid_of (current_thread));
+ = aarch64_get_debug_reg_state (current_thread->id.pid ());
if (show_debug_regs)
fprintf (stderr, "insert_point on entry (addr=0x%08lx, len=%d)\n",
@@ -487,7 +487,7 @@ aarch64_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
int ret;
enum target_hw_bp_type targ_type;
struct aarch64_debug_reg_state *state
- = aarch64_get_debug_reg_state (pid_of (current_thread));
+ = aarch64_get_debug_reg_state (current_thread->id.pid ());
if (show_debug_regs)
fprintf (stderr, "remove_point on entry (addr=0x%08lx, len=%d)\n",
@@ -573,7 +573,7 @@ aarch64_target::low_stopped_data_address ()
= aarch64_remove_non_address_bits ((CORE_ADDR) siginfo.si_addr);
/* Check if the address matches any watched address. */
- state = aarch64_get_debug_reg_state (pid_of (current_thread));
+ state = aarch64_get_debug_reg_state (current_thread->id.pid ());
CORE_ADDR result;
if (aarch64_stopped_data_address (state, addr_trap, &result))
return result;
diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc
index 4f938a2..4626662 100644
--- a/gdbserver/linux-arm-low.cc
+++ b/gdbserver/linux-arm-low.cc
@@ -854,7 +854,7 @@ arm_target::low_prepare_to_resume (lwp_info *lwp)
{
struct thread_info *thread = get_lwp_thread (lwp);
int pid = thread->id.lwp ();
- struct process_info *proc = find_process_pid (pid_of (thread));
+ process_info *proc = find_process_pid (thread->id.pid ());
struct arch_process_info *proc_info = proc->priv->arch_private;
struct arch_lwp_info *lwp_info = lwp->arch_private;
int i;
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index e23127e..fa8aaf8 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -2346,10 +2346,9 @@ linux_process_target::filter_event (int lwpid, int wstat)
if (WIFSTOPPED (wstat))
{
- struct process_info *proc;
-
/* Architecture-specific setup after inferior is running. */
- proc = find_process_pid (pid_of (thread));
+ process_info *proc = find_process_pid (thread->id.pid ());
+
if (proc->tdesc == NULL)
{
if (proc->attached)
@@ -2373,7 +2372,7 @@ linux_process_target::filter_event (int lwpid, int wstat)
if (WIFSTOPPED (wstat) && child->must_set_ptrace_flags)
{
- struct process_info *proc = find_process_pid (pid_of (thread));
+ process_info *proc = find_process_pid (thread->id.pid ());
int options = linux_low_ptrace_options (proc->attached);
linux_enable_event_reporting (lwpid, options);
@@ -4279,7 +4278,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n)
|| ptid == thread->id
/* Handle both 'pPID' and 'pPID.-1' as meaning 'all threads
of PID'. */
- || (ptid.pid () == pid_of (thread)
+ || (ptid.pid () == thread->id.pid ()
&& (ptid.is_pid ()
|| ptid.lwp () == -1)))
{
@@ -5975,7 +5974,7 @@ linux_process_target::handle_new_gdb_connection ()
else
{
/* Already stopped; go ahead and set the ptrace options. */
- struct process_info *proc = find_process_pid (pid_of (thread));
+ process_info *proc = find_process_pid (thread->id.pid ());
int options = linux_low_ptrace_options (proc->attached);
linux_enable_event_reporting (thread->id.lwp (), options);
diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc
index ee2c192..a91c77f 100644
--- a/gdbserver/linux-s390-low.cc
+++ b/gdbserver/linux-s390-low.cc
@@ -589,7 +589,7 @@ s390_target::low_arch_setup ()
struct regset_info *regset;
/* Determine word size and HWCAP. */
- int pid = pid_of (current_thread);
+ int pid = current_thread->id.pid ();
int wordsize = s390_get_wordsize (pid);
unsigned long hwcap = linux_get_hwcap (pid, wordsize);
diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index 7731cfa..b7ea4cc 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -1823,7 +1823,7 @@ handle_qxfer_exec_file (const char *annex,
if (current_thread == NULL)
return -1;
- pid = pid_of (current_thread);
+ pid = current_thread->id.pid ();
}
else
{