mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-17 07:53:51 +08:00
Introduce utility function find_inferior_ptid
This patch introduces find_inferior_ptid to replace the common idiom find_inferior_pid (ptid_get_pid (...)); It replaces all the instances of that idiom that I found with the new function. No significant changes before/after the patch in the regression suite on amd64 linux. gdb/ChangeLog: * inferior.c (find_inferior_ptid): New function. * inferior.h (find_inferior_ptid): New declaration. * ada-tasks.c (ada_get_task_number): Use find_inferior_ptid. * corelow.c (core_pid_to_str): Same. * darwin-nat.c (darwin_resume): Same. * infrun.c (fetch_inferior_event): Same. (get_inferior_stop_soon): Same. (handle_inferior_event): Same. (handle_signal_stop): Same. * linux-nat.c (resume_lwp): Same. (stop_wait_callback): Same. * mi/mi-interp.c (mi_new_thread): Same. (mi_thread_exit): Same. * proc-service.c (ps_pglobal_lookup): Same. * record-btrace.c (record_btrace_step_thread): Same. * remote-sim.c (gdbsim_close_inferior): Same. (gdbsim_resume): Same. (gdbsim_stop): Same. * sol2-tdep.c (sol2_core_pid_to_str): Same. * target.c (memory_xfer_partial_1): Same. (default_thread_address_space): Same. * thread.c (thread_change_ptid): Same. (switch_to_thread): Same. (do_restore_current_thread_cleanup): Same.
This commit is contained in:
@ -747,7 +747,7 @@ thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid)
|
||||
/* It can happen that what we knew as the target inferior id
|
||||
changes. E.g, target remote may only discover the remote process
|
||||
pid after adding the inferior to GDB's list. */
|
||||
inf = find_inferior_pid (ptid_get_pid (old_ptid));
|
||||
inf = find_inferior_ptid (old_ptid);
|
||||
inf->pid = ptid_get_pid (new_ptid);
|
||||
|
||||
tp = find_thread_ptid (old_ptid);
|
||||
@ -1179,7 +1179,7 @@ switch_to_thread (ptid_t ptid)
|
||||
{
|
||||
struct inferior *inf;
|
||||
|
||||
inf = find_inferior_pid (ptid_get_pid (ptid));
|
||||
inf = find_inferior_ptid (ptid);
|
||||
gdb_assert (inf != NULL);
|
||||
set_current_program_space (inf->pspace);
|
||||
set_current_inferior (inf);
|
||||
@ -1290,7 +1290,7 @@ do_restore_current_thread_cleanup (void *arg)
|
||||
then don't revert back to it, but instead simply drop back to no
|
||||
thread selected. */
|
||||
if (tp
|
||||
&& find_inferior_pid (ptid_get_pid (tp->ptid)) != NULL)
|
||||
&& find_inferior_ptid (tp->ptid) != NULL)
|
||||
restore_current_thread (old->inferior_ptid);
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user