diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2024-11-06 13:39:48 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2024-11-08 09:16:23 -0500 |
commit | 3470a0e144df6c01f8479fa649f43aa907936e7e (patch) | |
tree | 2b66e9a0acc8136adfd1d8756e73b9bd33a5f97d /gdbserver/inferiors.cc | |
parent | 6672ccafd90865b9a8916caa3a2f9a0687c301d2 (diff) | |
download | gdb-3470a0e144df6c01f8479fa649f43aa907936e7e.zip gdb-3470a0e144df6c01f8479fa649f43aa907936e7e.tar.gz gdb-3470a0e144df6c01f8479fa649f43aa907936e7e.tar.bz2 |
gdbserver: remove for_each_thread(pid, func)
Remove this overload, prefer to use `process_info::for_each_thread`. In
many instances, the `process_info` is already available, so this saves a
map lookup. In other instances, add the `process_info` lookup at the
call site.
In `linux-arm-low.cc` and `win32-i386-low.cc`, use `current_process ()`
instead of `current_thread->id.pid ()`. I presume that if
`current_process ()` and `current_thread` don't match, it's a bug
orthogonal to this change.
Change-Id: I751ed497cb1f313cf937b35125151bee9316fc51
Reviewed-By: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Diffstat (limited to 'gdbserver/inferiors.cc')
-rw-r--r-- | gdbserver/inferiors.cc | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/gdbserver/inferiors.cc b/gdbserver/inferiors.cc index 07c74c6..93555ec 100644 --- a/gdbserver/inferiors.cc +++ b/gdbserver/inferiors.cc @@ -353,24 +353,17 @@ process_info::for_each_thread (gdb::function_view<void (thread_info *)> func) /* See gdbthread.h. */ void -for_each_thread (int pid, gdb::function_view<void (thread_info *)> func) -{ - process_info *process = find_process_pid (pid); - if (process == nullptr) - return; - - process->for_each_thread (func); -} - -/* See gdbthread.h. */ - -void for_each_thread (ptid_t ptid, gdb::function_view<void (thread_info *)> func) { if (ptid == minus_one_ptid) for_each_thread (func); else if (ptid.is_pid ()) - for_each_thread (ptid.pid (), func); + { + process_info *process = find_process_pid (ptid.pid ()); + + if (process != nullptr) + process->for_each_thread (func); + } else find_thread (ptid, [func] (thread_info *thread) { |