Global renaming of find_thread_pid to find_thread_ptid.
	* gdbthread.h (find_thread_ptid): Renamed from find_thread_pid.
	* thread.c (find_thread_ptid): Renamed from find_thread_pid.
	All callers updated.
gdbserver:
	Global renaming of find_thread_pid to find_thread_ptid.
	* server.h (find_thread_ptid): Renamed from find_thread_pid.
	* inferiors.c (find_thread_ptid): Renamed from find_thread_pid.
	All callers updated.
This commit is contained in:
Doug Evans 2009-05-24 21:06:53 +00:00
parent 4e3990f4f9
commit e09875d410
18 changed files with 62 additions and 52 deletions

View File

@ -1,5 +1,10 @@
2009-05-24 Doug Evans <dje@google.com>
Global renaming of find_thread_pid to find_thread_ptid.
* gdbthread.h (find_thread_ptid): Renamed from find_thread_pid.
* thread.c (find_thread_ptid): Renamed from find_thread_pid.
All callers updated.
* infrun.c (follow_fork): Initialize new step_* locals
to avoid "may be used uninitialized" warnings.

View File

@ -986,7 +986,7 @@ aix_thread_resume (struct target_ops *ops,
}
else
{
thread = find_thread_pid (ptid);
thread = find_thread_ptid (ptid);
if (!thread)
error (_("aix-thread resume: unknown pthread %ld"),
TIDGET (ptid));
@ -1302,7 +1302,7 @@ aix_thread_fetch_registers (struct target_ops *ops,
beneath->to_fetch_registers (beneath, regcache, regno);
else
{
thread = find_thread_pid (inferior_ptid);
thread = find_thread_ptid (inferior_ptid);
tid = thread->private->tid;
if (tid == PTHDB_INVALID_TID)
@ -1643,7 +1643,7 @@ aix_thread_store_registers (struct target_ops *ops,
beneath->to_store_registers (beneath, regcache, regno);
else
{
thread = find_thread_pid (inferior_ptid);
thread = find_thread_ptid (inferior_ptid);
tid = thread->private->tid;
if (tid == PTHDB_INVALID_TID)

View File

@ -219,7 +219,7 @@ throw_exception (struct gdb_exception exception)
immediate_quit = 0;
if (!ptid_equal (inferior_ptid, null_ptid))
tp = find_thread_pid (inferior_ptid);
tp = find_thread_ptid (inferior_ptid);
/* Perhaps it would be cleaner to do this via the cleanup chain (not sure
I can think of a reason why that is vital, though). */

View File

@ -1,5 +1,10 @@
2009-05-24 Doug Evans <dje@google.com>
Global renaming of find_thread_pid to find_thread_ptid.
* server.h (find_thread_ptid): Renamed from find_thread_pid.
* inferiors.c (find_thread_ptid): Renamed from find_thread_pid.
All callers updated.
* linux-low.c (handle_extended_wait): Use linux_resume_one_lwp
to resume the newly created thread, don't call ptrace (PTRACE_CONT)
directly.

View File

@ -210,7 +210,7 @@ thread_to_gdb_id (struct thread_info *thread)
}
struct thread_info *
find_thread_pid (ptid_t ptid)
find_thread_ptid (ptid_t ptid)
{
struct inferior_list_entry *inf = all_threads.head;
@ -228,7 +228,7 @@ find_thread_pid (ptid_t ptid)
ptid_t
gdb_id_to_thread_id (ptid_t gdb_id)
{
struct thread_info *thread = find_thread_pid (gdb_id);
struct thread_info *thread = find_thread_ptid (gdb_id);
return thread ? thread->entry.id : null_ptid;
}

View File

@ -1091,7 +1091,7 @@ prepare_resume_reply (char *buf, ptid_t ptid,
saved_inferior = current_inferior;
current_inferior = find_thread_pid (ptid);
current_inferior = find_thread_ptid (ptid);
if (the_target->stopped_by_watchpoint != NULL
&& (*the_target->stopped_by_watchpoint) ())

View File

@ -1156,7 +1156,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
err = 1;
else
{
struct thread_info *thread = find_thread_pid (ptid);
struct thread_info *thread = find_thread_ptid (ptid);
if (thread == NULL)
err = 2;

View File

@ -239,7 +239,7 @@ struct process_info *find_process_pid (int pid);
int have_started_inferiors_p (void);
int have_attached_inferiors_p (void);
struct thread_info *find_thread_pid (ptid_t ptid);
struct thread_info *find_thread_ptid (ptid_t ptid);
ptid_t thread_id_to_gdb_id (ptid_t);
ptid_t thread_to_gdb_id (struct thread_info *);

View File

@ -29,7 +29,7 @@ set_desired_inferior (int use_general)
struct thread_info *found;
if (use_general == 1)
found = find_thread_pid (general_thread);
found = find_thread_ptid (general_thread);
else
{
found = NULL;
@ -41,10 +41,10 @@ set_desired_inferior (int use_general)
&& !ptid_equal (step_thread, minus_one_ptid))
&& (ptid_equal (cont_thread, null_ptid)
|| ptid_equal (cont_thread, minus_one_ptid)))
found = find_thread_pid (step_thread);
found = find_thread_ptid (step_thread);
if (found == NULL)
found = find_thread_pid (cont_thread);
found = find_thread_ptid (cont_thread);
}
if (found == NULL)

View File

@ -229,7 +229,7 @@ extern int in_thread_list (ptid_t ptid);
extern int valid_thread_id (int thread);
/* Search function to lookup a thread by 'pid'. */
extern struct thread_info *find_thread_pid (ptid_t ptid);
extern struct thread_info *find_thread_ptid (ptid_t ptid);
/* Find thread by GDB user-visible thread number. */
struct thread_info *find_thread_id (int num);

View File

@ -884,7 +884,7 @@ inf_ttrace_resume (struct target_ops *ops,
if (resume_all)
ptid = inferior_ptid;
info = find_thread_pid (ptid);
info = find_thread_ptid (ptid);
inf_ttrace_resume_lwp (info, request, sig);
if (resume_all)
@ -957,7 +957,7 @@ inf_ttrace_wait (struct target_ops *ops,
/* We haven't set the private member on the main thread yet. Do
it now. */
ti = find_thread_pid (inferior_ptid);
ti = find_thread_ptid (inferior_ptid);
gdb_assert (ti != NULL && ti->private == NULL);
ti->private =
xmalloc (sizeof (struct inf_ttrace_private_thread_info));
@ -1058,7 +1058,7 @@ inf_ttrace_wait (struct target_ops *ops,
case TTEVT_LWP_EXIT:
if (print_thread_events)
printf_unfiltered (_("[%s exited]\n"), target_pid_to_str (ptid));
ti = find_thread_pid (ptid);
ti = find_thread_ptid (ptid);
gdb_assert (ti != NULL);
((struct inf_ttrace_private_thread_info *)ti->private)->dying = 1;
inf_ttrace_num_lwps--;
@ -1075,7 +1075,7 @@ inf_ttrace_wait (struct target_ops *ops,
if (print_thread_events)
printf_unfiltered(_("[%s has been terminated]\n"),
target_pid_to_str (ptid));
ti = find_thread_pid (ptid);
ti = find_thread_ptid (ptid);
gdb_assert (ti != NULL);
((struct inf_ttrace_private_thread_info *)ti->private)->dying = 1;
inf_ttrace_num_lwps--;

View File

@ -350,7 +350,7 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
/* At this point the current thread may have changed. Refresh
CALL_THREAD as it could be invalid if its thread has exited. */
call_thread = find_thread_pid (call_thread_ptid);
call_thread = find_thread_ptid (call_thread_ptid);
/* Don't restore the async mask if the target has changed,
saved_async is for the original target. */

View File

@ -709,14 +709,14 @@ Can't resume all threads and specify proceed count simultaneously."));
struct thread_info *tp;
if (non_stop)
tp = find_thread_pid (inferior_ptid);
tp = find_thread_ptid (inferior_ptid);
else
{
ptid_t last_ptid;
struct target_waitstatus ws;
get_last_target_status (&last_ptid, &ws);
tp = find_thread_pid (last_ptid);
tp = find_thread_ptid (last_ptid);
}
if (tp != NULL)
bs = tp->stop_bpstat;
@ -1583,7 +1583,7 @@ program_info (char *args, int from_tty)
else if (is_running (ptid))
error (_("Selected thread is running."));
tp = find_thread_pid (ptid);
tp = find_thread_ptid (ptid);
bs = tp->stop_bpstat;
stat = bpstat_num (&bs, &num);

View File

@ -374,7 +374,7 @@ follow_fork (void)
or another. The previous selected thread may be gone
from the lists by now, but if it is still around, need
to clear the pending follow request. */
tp = find_thread_pid (parent);
tp = find_thread_ptid (parent);
if (tp)
tp->pending_follow.kind = TARGET_WAITKIND_SPURIOUS;
@ -1528,7 +1528,7 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
&& !ptid_equal (last_ptid, null_ptid)
&& !ptid_equal (last_ptid, minus_one_ptid))
{
last_thread = find_thread_pid (last_ptid);
last_thread = find_thread_ptid (last_ptid);
if (last_thread)
{
tp->stop_signal = last_thread->stop_signal;
@ -1757,7 +1757,7 @@ infrun_thread_stop_requested_callback (struct thread_info *info, void *arg)
have consistent output as if the stop event had been
reported. */
ecs->ptid = info->ptid;
ecs->event_thread = find_thread_pid (info->ptid);
ecs->event_thread = find_thread_ptid (info->ptid);
ecs->ws.kind = TARGET_WAITKIND_STOPPED;
ecs->ws.value.sig = TARGET_SIGNAL_0;
@ -2337,7 +2337,7 @@ handle_inferior_event (struct execution_control_state *ecs)
&& ecs->ws.kind != TARGET_WAITKIND_SIGNALLED && ecs->new_thread_event)
add_thread (ecs->ptid);
ecs->event_thread = find_thread_pid (ecs->ptid);
ecs->event_thread = find_thread_ptid (ecs->ptid);
/* Dependent on valid ECS->EVENT_THREAD. */
adjust_pc_after_break (ecs);
@ -2864,7 +2864,7 @@ targets should add new threads to the thread list themselves in non-stop mode.")
stop_signal = ecs->event_thread->stop_signal;
ecs->event_thread->stop_signal = TARGET_SIGNAL_0;
ecs->ptid = singlestep_ptid;
ecs->event_thread = find_thread_pid (ecs->ptid);
ecs->event_thread = find_thread_ptid (ecs->ptid);
ecs->event_thread->stop_signal = stop_signal;
stop_pc = new_singlestep_pc;
}

View File

@ -1096,7 +1096,7 @@ linux_nat_switch_fork (ptid_t new_ptid)
static void
exit_lwp (struct lwp_info *lp)
{
struct thread_info *th = find_thread_pid (lp->ptid);
struct thread_info *th = find_thread_ptid (lp->ptid);
if (th)
{
@ -1426,7 +1426,7 @@ get_pending_status (struct lwp_info *lp, int *status)
have the last signal recorded in
thread_info->stop_signal. */
struct thread_info *tp = find_thread_pid (lp->ptid);
struct thread_info *tp = find_thread_ptid (lp->ptid);
signo = tp->stop_signal;
}
@ -1455,7 +1455,7 @@ GPT: lwp %s had signal %s, but it is in no pass state\n",
{
if (GET_LWP (lp->ptid) == GET_LWP (last_ptid))
{
struct thread_info *tp = find_thread_pid (lp->ptid);
struct thread_info *tp = find_thread_ptid (lp->ptid);
if (tp->stop_signal != TARGET_SIGNAL_0
&& signal_pass_state (tp->stop_signal))
*status = W_STOPCODE (target_signal_to_host (tp->stop_signal));
@ -4515,7 +4515,7 @@ linux_nat_stop_lwp (struct lwp_info *lwp, void *data)
if (debug_linux_nat)
{
if (find_thread_pid (lwp->ptid)->stop_requested)
if (find_thread_ptid (lwp->ptid)->stop_requested)
fprintf_unfiltered (gdb_stdlog, "\
LNSL: already stopped/stop_requested %s\n",
target_pid_to_str (lwp->ptid));

View File

@ -371,7 +371,7 @@ thread_get_info_callback (const td_thrhandle_t *thp, void *argp)
/* Fill the cache. */
thread_ptid = ptid_build (info->pid, ti.ti_lid, 0);
inout->thread_info = find_thread_pid (thread_ptid);
inout->thread_info = find_thread_ptid (thread_ptid);
/* In the case of a zombie thread, don't continue. We don't want to
attach to it thinking it is a new thread. */
@ -385,7 +385,7 @@ thread_get_info_callback (const td_thrhandle_t *thp, void *argp)
thread_db_find_new_threads_1 (thread_ptid);
else
attach_thread (thread_ptid, thp, &ti);
inout->thread_info = find_thread_pid (thread_ptid);
inout->thread_info = find_thread_ptid (thread_ptid);
gdb_assert (inout->thread_info != NULL);
}
@ -975,7 +975,7 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
thread and attach to the new one. */
if (in_thread_list (ptid))
{
tp = find_thread_pid (ptid);
tp = find_thread_ptid (ptid);
gdb_assert (tp != NULL);
/* If tp->private is NULL, then GDB is already attached to this
@ -1046,7 +1046,7 @@ detach_thread (ptid_t ptid)
until we notice that it's dead (via prune_threads), or until
something re-uses its thread ID. We'll report the thread exit
when the underlying LWP dies. */
thread_info = find_thread_pid (ptid);
thread_info = find_thread_ptid (ptid);
gdb_assert (thread_info != NULL && thread_info->private != NULL);
thread_info->private->dying = 1;
}
@ -1309,7 +1309,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
}
ptid = ptid_build (info->pid, ti.ti_lid, 0);
tp = find_thread_pid (ptid);
tp = find_thread_ptid (ptid);
if (tp == NULL || tp->private == NULL)
attach_thread (ptid, th_p, &ti);
@ -1364,7 +1364,7 @@ thread_db_find_new_threads (struct target_ops *ops)
static char *
thread_db_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
struct thread_info *thread_info = find_thread_pid (ptid);
struct thread_info *thread_info = find_thread_ptid (ptid);
struct target_ops *beneath;
if (thread_info != NULL && thread_info->private != NULL)
@ -1418,7 +1418,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
thread_db_find_new_threads_1 (ptid);
/* Find the matching thread. */
thread_info = find_thread_pid (ptid);
thread_info = find_thread_ptid (ptid);
if (thread_info != NULL && thread_info->private != NULL)
{

View File

@ -422,7 +422,7 @@ mi_on_resume (ptid_t ptid)
if (ptid_equal (ptid, minus_one_ptid) || ptid_is_pid (ptid))
tp = inferior_thread ();
else
tp = find_thread_pid (ptid);
tp = find_thread_ptid (ptid);
/* Suppress output while calling an inferior function. */
if (tp->in_infcall)
@ -461,7 +461,7 @@ mi_on_resume (ptid_t ptid)
}
else
{
struct thread_info *ti = find_thread_pid (ptid);
struct thread_info *ti = find_thread_ptid (ptid);
gdb_assert (ti);
fprintf_unfiltered (raw_stdout, "*running,thread-id=\"%d\"\n", ti->num);
}

View File

@ -75,7 +75,7 @@ enum thread_state
struct thread_info*
inferior_thread (void)
{
struct thread_info *tp = find_thread_pid (inferior_ptid);
struct thread_info *tp = find_thread_ptid (inferior_ptid);
gdb_assert (tp);
return tp;
}
@ -168,7 +168,7 @@ add_thread_silent (ptid_t ptid)
{
struct thread_info *tp;
tp = find_thread_pid (ptid);
tp = find_thread_ptid (ptid);
if (tp)
/* Found an old thread with the same id. It has to be dead,
otherwise we wouldn't be adding a new thread with the same id.
@ -313,7 +313,7 @@ find_thread_id (int num)
/* Find a thread_info by matching PTID. */
struct thread_info *
find_thread_pid (ptid_t ptid)
find_thread_ptid (ptid_t ptid)
{
struct thread_info *tp;
@ -510,7 +510,7 @@ thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid)
inf = find_inferior_pid (ptid_get_pid (old_ptid));
inf->pid = ptid_get_pid (new_ptid);
tp = find_thread_pid (old_ptid);
tp = find_thread_ptid (old_ptid);
tp->ptid = new_ptid;
observer_notify_thread_ptid_changed (old_ptid, new_ptid);
@ -543,7 +543,7 @@ set_running (ptid_t ptid, int running)
else
{
int started = 0;
tp = find_thread_pid (ptid);
tp = find_thread_ptid (ptid);
gdb_assert (tp);
gdb_assert (tp->state_ != THREAD_EXITED);
if (running && tp->state_ == THREAD_STOPPED)
@ -562,7 +562,7 @@ is_thread_state (ptid_t ptid, enum thread_state state)
if (!target_has_execution)
return 0;
tp = find_thread_pid (ptid);
tp = find_thread_ptid (ptid);
gdb_assert (tp);
return tp->state_ == state;
}
@ -620,7 +620,7 @@ is_executing (ptid_t ptid)
if (!target_has_execution)
return 0;
tp = find_thread_pid (ptid);
tp = find_thread_ptid (ptid);
gdb_assert (tp);
return tp->executing_;
}
@ -639,7 +639,7 @@ set_executing (ptid_t ptid, int executing)
}
else
{
tp = find_thread_pid (ptid);
tp = find_thread_ptid (ptid);
gdb_assert (tp);
tp->executing_ = executing;
}
@ -659,7 +659,7 @@ set_stop_requested (ptid_t ptid, int stop)
}
else
{
tp = find_thread_pid (ptid);
tp = find_thread_ptid (ptid);
gdb_assert (tp);
tp->stop_requested = stop;
}
@ -695,7 +695,7 @@ finish_thread_state (ptid_t ptid)
}
else
{
tp = find_thread_pid (ptid);
tp = find_thread_ptid (ptid);
gdb_assert (tp);
if (tp->state_ != THREAD_EXITED)
{
@ -948,7 +948,7 @@ do_restore_current_thread_cleanup (void *arg)
struct thread_info *tp;
struct current_thread_cleanup *old = arg;
tp = find_thread_pid (old->inferior_ptid);
tp = find_thread_ptid (old->inferior_ptid);
/* If the previously selected thread belonged to a process that has
in the mean time been deleted (due to normal exit, detach, etc.),
@ -977,7 +977,7 @@ restore_current_thread_cleanup_dtor (void *arg)
{
struct current_thread_cleanup *old = arg;
struct thread_info *tp;
tp = find_thread_pid (old->inferior_ptid);
tp = find_thread_ptid (old->inferior_ptid);
if (tp)
tp->refcount--;
xfree (old);
@ -1007,7 +1007,7 @@ make_cleanup_restore_current_thread (void)
old->selected_frame_id = get_frame_id (frame);
old->selected_frame_level = frame_relative_level (frame);
tp = find_thread_pid (inferior_ptid);
tp = find_thread_ptid (inferior_ptid);
if (tp)
tp->refcount++;
}