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:
10
gdb/infrun.c
10
gdb/infrun.c
@ -3262,7 +3262,7 @@ fetch_inferior_event (void *client_data)
|
||||
|
||||
if (!ecs->wait_some_more)
|
||||
{
|
||||
struct inferior *inf = find_inferior_pid (ptid_get_pid (ecs->ptid));
|
||||
struct inferior *inf = find_inferior_ptid (ecs->ptid);
|
||||
|
||||
delete_just_stopped_threads_infrun_breakpoints ();
|
||||
|
||||
@ -3581,7 +3581,7 @@ fill_in_stop_func (struct gdbarch *gdbarch,
|
||||
static enum stop_kind
|
||||
get_inferior_stop_soon (ptid_t ptid)
|
||||
{
|
||||
struct inferior *inf = find_inferior_pid (ptid_get_pid (ptid));
|
||||
struct inferior *inf = find_inferior_ptid (ptid);
|
||||
|
||||
gdb_assert (inf != NULL);
|
||||
return inf->control.stop_soon;
|
||||
@ -3815,7 +3815,7 @@ handle_inferior_event (struct execution_control_state *ecs)
|
||||
}
|
||||
|
||||
inferior_ptid = ecs->ptid;
|
||||
set_current_inferior (find_inferior_pid (ptid_get_pid (ecs->ptid)));
|
||||
set_current_inferior (find_inferior_ptid (ecs->ptid));
|
||||
set_current_program_space (current_inferior ()->pspace);
|
||||
handle_vfork_child_exec_or_exit (0);
|
||||
target_terminal_ours (); /* Must do this before mourn anyway. */
|
||||
@ -3899,7 +3899,7 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
|
||||
if (displaced && ptid_equal (displaced->step_ptid, ecs->ptid))
|
||||
{
|
||||
struct inferior *parent_inf
|
||||
= find_inferior_pid (ptid_get_pid (ecs->ptid));
|
||||
= find_inferior_ptid (ecs->ptid);
|
||||
struct regcache *child_regcache;
|
||||
CORE_ADDR parent_pc;
|
||||
|
||||
@ -4495,7 +4495,7 @@ handle_signal_stop (struct execution_control_state *ecs)
|
||||
if (random_signal)
|
||||
{
|
||||
/* Signal not for debugging purposes. */
|
||||
struct inferior *inf = find_inferior_pid (ptid_get_pid (ecs->ptid));
|
||||
struct inferior *inf = find_inferior_ptid (ecs->ptid);
|
||||
enum gdb_signal stop_signal = ecs->event_thread->suspend.stop_signal;
|
||||
|
||||
if (debug_infrun)
|
||||
|
Reference in New Issue
Block a user