* [RFA] rename find_thread_pid to find_thread_ptid
@ 2009-05-01 22:51 Doug Evans
2009-05-06 19:02 ` Joel Brobecker
2009-05-18 23:21 ` Doug Evans
0 siblings, 2 replies; 5+ messages in thread
From: Doug Evans @ 2009-05-01 22:51 UTC (permalink / raw)
To: gdb-patches
Hi.
Anyone mind a global renaming of find_thread_pid to find_thread_ptid?
Tested on x86_64-linux only, but the global search-and-replace
was mechanical, not hand-done.
2009-05-01 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.
(inferior_thread, add_thread_silent, thread_change_ptid): Update.
(set_running, is_thread_state, is_executing): Update.
(set_executing, set_stop_requested, finish_thread_state): Update.
(do_restore_current_thread_cleanup): Update.
(restore_current_thread_cleanup_dtor): Update.
(make_cleanup_restore_current_thread): Update.
* aix-thread.c (aix_thread_resume): Update.
(aix_thread_fetch_registers, aix_thread_store_registers): Update.
* exceptions.c (throw_exception): Update.
* inf-ptrace.c (inf_ptrace_follow_fork): Update.
* inf-ttrace.c (inf_ttrace_follow_fork): Update.
(inf_ttrace_resume, inf_ttrace_wait): Update.
* infcall.c (run_inferior_call): Update.
* infcmd.c (continue_command): Update.
(program_info): Update.
* infrun.c (proceed): Update.
(infrun_thread_stop_requested_callback): Update.
(handle_inferior_event): Update.
* linux-nat.c (linux_child_follow_fork): Update.
(linux_nat_switch_fork, get_pending_status): Update.
(linux_nat_stop_lwp): Update.
* linux-thread-db.c (thread_get_info_callback): Update.
(attach_thread, detach_thread, find_new_threads_callback): Update.
(thread_db_find_new_threads): Update.
(thread_db_get_thread_local_address): Update.
* mi/mi-interp.c (mi_on_resume): Update.
In 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.
(gdb_id_to_thread_id): Update.
* remote-utils.c (prepare_resume_reply): Update.
* server.c (handle_query): Update.
* target.c (set_desired_inferior): Update.
Index: aix-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/aix-thread.c,v
retrieving revision 1.63
diff -u -p -r1.63 aix-thread.c
--- aix-thread.c 15 Mar 2009 21:05:41 -0000 1.63
+++ aix-thread.c 1 May 2009 22:24:06 -0000
@@ -972,7 +972,7 @@ aix_thread_resume (struct target_ops *op
}
else
{
- thread = find_thread_pid (ptid);
+ thread = find_thread_ptid (ptid);
if (!thread)
error (_("aix-thread resume: unknown pthread %ld"),
TIDGET (ptid));
@@ -1288,7 +1288,7 @@ aix_thread_fetch_registers (struct targe
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)
@@ -1629,7 +1629,7 @@ aix_thread_store_registers (struct targe
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)
Index: exceptions.c
===================================================================
RCS file: /cvs/src/src/gdb/exceptions.c,v
retrieving revision 1.33
diff -u -p -r1.33 exceptions.c
--- exceptions.c 13 Mar 2009 17:26:59 -0000 1.33
+++ exceptions.c 1 May 2009 22:24:06 -0000
@@ -219,7 +219,7 @@ throw_exception (struct gdb_exception ex
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). */
Index: gdbthread.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbthread.h,v
retrieving revision 1.47
diff -u -p -r1.47 gdbthread.h
--- gdbthread.h 31 Mar 2009 15:23:57 -0000 1.47
+++ gdbthread.h 1 May 2009 22:24:07 -0000
@@ -224,7 +224,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);
Index: inf-ptrace.c
===================================================================
RCS file: /cvs/src/src/gdb/inf-ptrace.c,v
retrieving revision 1.59
diff -u -p -r1.59 inf-ptrace.c
--- inf-ptrace.c 17 Mar 2009 19:28:09 -0000 1.59
+++ inf-ptrace.c 1 May 2009 22:24:07 -0000
@@ -57,7 +57,7 @@ inf_ptrace_follow_fork (struct target_op
gdb_assert (status.kind == TARGET_WAITKIND_FORKED);
pid = ptid_get_pid (ptid);
- last_tp = find_thread_pid (ptid);
+ last_tp = find_thread_ptid (ptid);
}
if (ptrace (PT_GET_PROCESS_STATE, pid,
Index: inf-ttrace.c
===================================================================
RCS file: /cvs/src/src/gdb/inf-ttrace.c,v
retrieving revision 1.44
diff -u -p -r1.44 inf-ttrace.c
--- inf-ttrace.c 17 Mar 2009 19:28:09 -0000 1.44
+++ inf-ttrace.c 1 May 2009 22:24:07 -0000
@@ -428,7 +428,7 @@ inf_ttrace_follow_fork (struct target_op
pid = ptid_get_pid (ptid);
lwpid = ptid_get_lwp (ptid);
- last_tp = find_thread_pid (ptid);
+ last_tp = find_thread_ptid (ptid);
}
/* Get all important details that core GDB doesn't (and shouldn't)
@@ -909,7 +909,7 @@ inf_ttrace_resume (struct target_ops *op
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)
@@ -982,7 +982,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));
@@ -1083,7 +1083,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--;
@@ -1100,7 +1100,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--;
Index: infcall.c
===================================================================
RCS file: /cvs/src/src/gdb/infcall.c,v
retrieving revision 1.111
diff -u -p -r1.111 infcall.c
--- infcall.c 22 Mar 2009 17:59:59 -0000 1.111
+++ infcall.c 1 May 2009 22:24:07 -0000
@@ -349,7 +349,7 @@ run_inferior_call (struct thread_info *c
/* 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. */
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.238
diff -u -p -r1.238 infcmd.c
--- infcmd.c 25 Mar 2009 21:42:34 -0000 1.238
+++ infcmd.c 1 May 2009 22:24:07 -0000
@@ -706,14 +706,14 @@ Can't resume all threads and specify pro
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;
@@ -1580,7 +1580,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);
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.370
diff -u -p -r1.370 infrun.c
--- infrun.c 30 Apr 2009 03:09:59 -0000 1.370
+++ infrun.c 1 May 2009 22:24:07 -0000
@@ -1413,7 +1413,7 @@ proceed (CORE_ADDR addr, enum target_sig
&& !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;
@@ -1645,7 +1645,7 @@ infrun_thread_stop_requested_callback (s
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;
@@ -2227,7 +2227,7 @@ handle_inferior_event (struct execution_
&& 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);
@@ -2720,7 +2720,7 @@ targets should add new threads to the th
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;
}
Index: linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.c,v
retrieving revision 1.128
diff -u -p -r1.128 linux-nat.c
--- linux-nat.c 1 Apr 2009 19:07:50 -0000 1.128
+++ linux-nat.c 1 May 2009 22:24:07 -0000
@@ -809,7 +809,7 @@ linux_child_follow_fork (struct target_o
}
else
{
- struct thread_info *last_tp = find_thread_pid (last_ptid);
+ struct thread_info *last_tp = find_thread_ptid (last_ptid);
struct thread_info *tp;
char child_pid_spelling[40];
struct inferior *parent_inf, *child_inf;
@@ -1154,7 +1154,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)
{
@@ -1505,7 +1505,7 @@ get_pending_status (struct lwp_info *lp,
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;
}
@@ -1534,7 +1534,7 @@ GPT: lwp %s had signal %s, but it is in
{
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));
@@ -4694,7 +4694,7 @@ linux_nat_stop_lwp (struct lwp_info *lwp
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));
Index: linux-thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-thread-db.c,v
retrieving revision 1.55
diff -u -p -r1.55 linux-thread-db.c
--- linux-thread-db.c 1 May 2009 22:05:46 -0000 1.55
+++ linux-thread-db.c 1 May 2009 22:24:07 -0000
@@ -266,7 +266,7 @@ thread_get_info_callback (const td_thrha
/* Fill the cache. */
thread_ptid = ptid_build (GET_PID (proc_handle.ptid), ti.ti_lid, 0);
- thread_info = find_thread_pid (thread_ptid);
+ 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. */
@@ -284,7 +284,7 @@ thread_get_info_callback (const td_thrha
thread_db_find_new_threads_1 ();
else
attach_thread (thread_ptid, thp, &ti);
- thread_info = find_thread_pid (thread_ptid);
+ thread_info = find_thread_ptid (thread_ptid);
gdb_assert (thread_info != NULL);
}
@@ -696,7 +696,7 @@ attach_thread (ptid_t ptid, const td_thr
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
@@ -765,7 +765,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;
}
@@ -981,7 +981,7 @@ find_new_threads_callback (const td_thrh
return 0;
}
- tp = find_thread_pid (ptid);
+ tp = find_thread_ptid (ptid);
if (tp == NULL || tp->private == NULL)
attach_thread (ptid, th_p, &ti);
@@ -1026,7 +1026,7 @@ thread_db_find_new_threads (struct targe
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)
@@ -1080,7 +1080,7 @@ thread_db_get_thread_local_address (stru
thread_db_find_new_threads_1 ();
/* Find the matching thread. */
- thread_info = find_thread_pid (ptid);
+ thread_info = find_thread_ptid (ptid);
if (thread_info != NULL && thread_info->private != NULL)
{
Index: thread.c
===================================================================
RCS file: /cvs/src/src/gdb/thread.c,v
retrieving revision 1.109
diff -u -p -r1.109 thread.c
--- thread.c 31 Mar 2009 15:23:57 -0000 1.109
+++ thread.c 1 May 2009 22:24:07 -0000
@@ -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;
}
@@ -146,7 +146,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.
@@ -302,7 +302,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;
@@ -499,7 +499,7 @@ thread_change_ptid (ptid_t old_ptid, pti
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);
@@ -530,7 +530,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)
@@ -549,7 +549,7 @@ is_thread_state (ptid_t ptid, enum threa
if (!target_has_execution)
return 0;
- tp = find_thread_pid (ptid);
+ tp = find_thread_ptid (ptid);
gdb_assert (tp);
return tp->state_ == state;
}
@@ -607,7 +607,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_;
}
@@ -624,7 +624,7 @@ set_executing (ptid_t ptid, int executin
}
else
{
- tp = find_thread_pid (ptid);
+ tp = find_thread_ptid (ptid);
gdb_assert (tp);
tp->executing_ = executing;
}
@@ -644,7 +644,7 @@ set_stop_requested (ptid_t ptid, int sto
}
else
{
- tp = find_thread_pid (ptid);
+ tp = find_thread_ptid (ptid);
gdb_assert (tp);
tp->stop_requested = stop;
}
@@ -680,7 +680,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)
{
@@ -933,7 +933,7 @@ do_restore_current_thread_cleanup (void
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.),
@@ -962,7 +962,7 @@ restore_current_thread_cleanup_dtor (voi
{
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);
@@ -992,7 +992,7 @@ make_cleanup_restore_current_thread (voi
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++;
}
Index: mi/mi-interp.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-interp.c,v
retrieving revision 1.46
diff -u -p -r1.46 mi-interp.c
--- mi/mi-interp.c 25 Mar 2009 21:53:11 -0000 1.46
+++ mi/mi-interp.c 1 May 2009 22:24:07 -0000
@@ -397,7 +397,7 @@ mi_on_resume (ptid_t ptid)
if (ptid_equal (ptid, minus_one_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)
@@ -428,7 +428,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);
}
Index: gdbserver/inferiors.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/inferiors.c,v
retrieving revision 1.22
diff -u -p -r1.22 inferiors.c
--- gdbserver/inferiors.c 30 Apr 2009 22:21:06 -0000 1.22
+++ gdbserver/inferiors.c 1 May 2009 22:24:07 -0000
@@ -210,7 +210,7 @@ thread_to_gdb_id (struct thread_info *th
}
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;
}
Index: gdbserver/remote-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/remote-utils.c,v
retrieving revision 1.66
diff -u -p -r1.66 remote-utils.c
--- gdbserver/remote-utils.c 3 Apr 2009 14:38:38 -0000 1.66
+++ gdbserver/remote-utils.c 1 May 2009 22:24:07 -0000
@@ -1091,7 +1091,7 @@ prepare_resume_reply (char *buf, ptid_t
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) ())
Index: gdbserver/server.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.c,v
retrieving revision 1.96
diff -u -p -r1.96 server.c
--- gdbserver/server.c 30 Apr 2009 22:21:06 -0000 1.96
+++ gdbserver/server.c 1 May 2009 22:24:07 -0000
@@ -1156,7 +1156,7 @@ handle_query (char *own_buf, int packet_
err = 1;
else
{
- struct thread_info *thread = find_thread_pid (ptid);
+ struct thread_info *thread = find_thread_ptid (ptid);
if (thread == NULL)
err = 2;
Index: gdbserver/server.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.h,v
retrieving revision 1.57
diff -u -p -r1.57 server.h
--- gdbserver/server.h 30 Apr 2009 22:21:06 -0000 1.57
+++ gdbserver/server.h 1 May 2009 22:24:07 -0000
@@ -239,7 +239,7 @@ struct process_info *find_process_pid (i
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 *);
Index: gdbserver/target.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/target.c,v
retrieving revision 1.15
diff -u -p -r1.15 target.c
--- gdbserver/target.c 1 Apr 2009 22:50:24 -0000 1.15
+++ gdbserver/target.c 1 May 2009 22:24:07 -0000
@@ -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)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] rename find_thread_pid to find_thread_ptid
2009-05-01 22:51 [RFA] rename find_thread_pid to find_thread_ptid Doug Evans
@ 2009-05-06 19:02 ` Joel Brobecker
2009-05-06 20:25 ` Doug Evans
2009-05-18 23:21 ` Doug Evans
1 sibling, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2009-05-06 19:02 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
> Anyone mind a global renaming of find_thread_pid to find_thread_ptid?
I don't mind the renaming, but if we're going to rename it, what do
people thing about "find_thread_from_ptid". I always get confused by
the function name because it makes me think that the function returns
the pid/ptid instead of returning the thread from the ptid...
That's just a suggestion and I don't want to start another bikeshed
discussion. The name you suggest is already better than the old name,
so I'm not objecting to your initial suggestion.
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] rename find_thread_pid to find_thread_ptid
2009-05-06 19:02 ` Joel Brobecker
@ 2009-05-06 20:25 ` Doug Evans
0 siblings, 0 replies; 5+ messages in thread
From: Doug Evans @ 2009-05-06 20:25 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On Wed, May 6, 2009 at 12:02 PM, Joel Brobecker <brobecker@adacore.com> wrote:
>> Anyone mind a global renaming of find_thread_pid to find_thread_ptid?
>
> I don't mind the renaming, but if we're going to rename it, what do
> people thing about "find_thread_from_ptid". I always get confused by
> the function name because it makes me think that the function returns
> the pid/ptid instead of returning the thread from the ptid...
>
> That's just a suggestion and I don't want to start another bikeshed
> discussion. The name you suggest is already better than the old name,
> so I'm not objecting to your initial suggestion.
I don't mind that renaming either, I prefer it too.
But if one goes down that path then there's more than just
find_thread_ptid to rename, so I left that for another day.
Perhaps more work, but with the right tools it's rather trivial, so I
went with consistency with what's there today and just fixed the
pid->ptid bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] rename find_thread_pid to find_thread_ptid
2009-05-01 22:51 [RFA] rename find_thread_pid to find_thread_ptid Doug Evans
2009-05-06 19:02 ` Joel Brobecker
@ 2009-05-18 23:21 ` Doug Evans
2009-05-22 15:20 ` Joel Brobecker
1 sibling, 1 reply; 5+ messages in thread
From: Doug Evans @ 2009-05-18 23:21 UTC (permalink / raw)
To: gdb-patches
Ping.
Joel's comment was to rename to find_thread_from_ptid.
I think that's great, but there's a lot more to be renamed along those
lines than what this patch does, so I went with consistency with the
current usage in gdb and just fixed the pid->ptid bug.
Ok to check in?
On Fri, May 1, 2009 at 3:51 PM, Doug Evans <dje@google.com> wrote:
> Hi.
>
> Anyone mind a global renaming of find_thread_pid to find_thread_ptid?
>
> Tested on x86_64-linux only, but the global search-and-replace
> was mechanical, not hand-done.
>
>
> 2009-05-01 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.
> (inferior_thread, add_thread_silent, thread_change_ptid): Update.
> (set_running, is_thread_state, is_executing): Update.
> (set_executing, set_stop_requested, finish_thread_state): Update.
> (do_restore_current_thread_cleanup): Update.
> (restore_current_thread_cleanup_dtor): Update.
> (make_cleanup_restore_current_thread): Update.
> * aix-thread.c (aix_thread_resume): Update.
> (aix_thread_fetch_registers, aix_thread_store_registers): Update.
> * exceptions.c (throw_exception): Update.
> * inf-ptrace.c (inf_ptrace_follow_fork): Update.
> * inf-ttrace.c (inf_ttrace_follow_fork): Update.
> (inf_ttrace_resume, inf_ttrace_wait): Update.
> * infcall.c (run_inferior_call): Update.
> * infcmd.c (continue_command): Update.
> (program_info): Update.
> * infrun.c (proceed): Update.
> (infrun_thread_stop_requested_callback): Update.
> (handle_inferior_event): Update.
> * linux-nat.c (linux_child_follow_fork): Update.
> (linux_nat_switch_fork, get_pending_status): Update.
> (linux_nat_stop_lwp): Update.
> * linux-thread-db.c (thread_get_info_callback): Update.
> (attach_thread, detach_thread, find_new_threads_callback): Update.
> (thread_db_find_new_threads): Update.
> (thread_db_get_thread_local_address): Update.
> * mi/mi-interp.c (mi_on_resume): Update.
>
> In 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.
> (gdb_id_to_thread_id): Update.
> * remote-utils.c (prepare_resume_reply): Update.
> * server.c (handle_query): Update.
> * target.c (set_desired_inferior): Update.
>
> Index: aix-thread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/aix-thread.c,v
> retrieving revision 1.63
> diff -u -p -r1.63 aix-thread.c
> --- aix-thread.c 15 Mar 2009 21:05:41 -0000 1.63
> +++ aix-thread.c 1 May 2009 22:24:06 -0000
> @@ -972,7 +972,7 @@ aix_thread_resume (struct target_ops *op
> }
> else
> {
> - thread = find_thread_pid (ptid);
> + thread = find_thread_ptid (ptid);
> if (!thread)
> error (_("aix-thread resume: unknown pthread %ld"),
> TIDGET (ptid));
> @@ -1288,7 +1288,7 @@ aix_thread_fetch_registers (struct targe
> 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)
> @@ -1629,7 +1629,7 @@ aix_thread_store_registers (struct targe
> 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)
> Index: exceptions.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/exceptions.c,v
> retrieving revision 1.33
> diff -u -p -r1.33 exceptions.c
> --- exceptions.c 13 Mar 2009 17:26:59 -0000 1.33
> +++ exceptions.c 1 May 2009 22:24:06 -0000
> @@ -219,7 +219,7 @@ throw_exception (struct gdb_exception ex
> 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). */
> Index: gdbthread.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbthread.h,v
> retrieving revision 1.47
> diff -u -p -r1.47 gdbthread.h
> --- gdbthread.h 31 Mar 2009 15:23:57 -0000 1.47
> +++ gdbthread.h 1 May 2009 22:24:07 -0000
> @@ -224,7 +224,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);
> Index: inf-ptrace.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/inf-ptrace.c,v
> retrieving revision 1.59
> diff -u -p -r1.59 inf-ptrace.c
> --- inf-ptrace.c 17 Mar 2009 19:28:09 -0000 1.59
> +++ inf-ptrace.c 1 May 2009 22:24:07 -0000
> @@ -57,7 +57,7 @@ inf_ptrace_follow_fork (struct target_op
> gdb_assert (status.kind == TARGET_WAITKIND_FORKED);
>
> pid = ptid_get_pid (ptid);
> - last_tp = find_thread_pid (ptid);
> + last_tp = find_thread_ptid (ptid);
> }
>
> if (ptrace (PT_GET_PROCESS_STATE, pid,
> Index: inf-ttrace.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/inf-ttrace.c,v
> retrieving revision 1.44
> diff -u -p -r1.44 inf-ttrace.c
> --- inf-ttrace.c 17 Mar 2009 19:28:09 -0000 1.44
> +++ inf-ttrace.c 1 May 2009 22:24:07 -0000
> @@ -428,7 +428,7 @@ inf_ttrace_follow_fork (struct target_op
>
> pid = ptid_get_pid (ptid);
> lwpid = ptid_get_lwp (ptid);
> - last_tp = find_thread_pid (ptid);
> + last_tp = find_thread_ptid (ptid);
> }
>
> /* Get all important details that core GDB doesn't (and shouldn't)
> @@ -909,7 +909,7 @@ inf_ttrace_resume (struct target_ops *op
> 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)
> @@ -982,7 +982,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));
> @@ -1083,7 +1083,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--;
> @@ -1100,7 +1100,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--;
> Index: infcall.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infcall.c,v
> retrieving revision 1.111
> diff -u -p -r1.111 infcall.c
> --- infcall.c 22 Mar 2009 17:59:59 -0000 1.111
> +++ infcall.c 1 May 2009 22:24:07 -0000
> @@ -349,7 +349,7 @@ run_inferior_call (struct thread_info *c
>
> /* 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. */
> Index: infcmd.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infcmd.c,v
> retrieving revision 1.238
> diff -u -p -r1.238 infcmd.c
> --- infcmd.c 25 Mar 2009 21:42:34 -0000 1.238
> +++ infcmd.c 1 May 2009 22:24:07 -0000
> @@ -706,14 +706,14 @@ Can't resume all threads and specify pro
> 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;
> @@ -1580,7 +1580,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);
>
> Index: infrun.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infrun.c,v
> retrieving revision 1.370
> diff -u -p -r1.370 infrun.c
> --- infrun.c 30 Apr 2009 03:09:59 -0000 1.370
> +++ infrun.c 1 May 2009 22:24:07 -0000
> @@ -1413,7 +1413,7 @@ proceed (CORE_ADDR addr, enum target_sig
> && !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;
> @@ -1645,7 +1645,7 @@ infrun_thread_stop_requested_callback (s
> 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;
>
> @@ -2227,7 +2227,7 @@ handle_inferior_event (struct execution_
> && 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);
> @@ -2720,7 +2720,7 @@ targets should add new threads to the th
> 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;
> }
> Index: linux-nat.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/linux-nat.c,v
> retrieving revision 1.128
> diff -u -p -r1.128 linux-nat.c
> --- linux-nat.c 1 Apr 2009 19:07:50 -0000 1.128
> +++ linux-nat.c 1 May 2009 22:24:07 -0000
> @@ -809,7 +809,7 @@ linux_child_follow_fork (struct target_o
> }
> else
> {
> - struct thread_info *last_tp = find_thread_pid (last_ptid);
> + struct thread_info *last_tp = find_thread_ptid (last_ptid);
> struct thread_info *tp;
> char child_pid_spelling[40];
> struct inferior *parent_inf, *child_inf;
> @@ -1154,7 +1154,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)
> {
> @@ -1505,7 +1505,7 @@ get_pending_status (struct lwp_info *lp,
> 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;
> }
>
> @@ -1534,7 +1534,7 @@ GPT: lwp %s had signal %s, but it is in
> {
> 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));
> @@ -4694,7 +4694,7 @@ linux_nat_stop_lwp (struct lwp_info *lwp
>
> 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));
> Index: linux-thread-db.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/linux-thread-db.c,v
> retrieving revision 1.55
> diff -u -p -r1.55 linux-thread-db.c
> --- linux-thread-db.c 1 May 2009 22:05:46 -0000 1.55
> +++ linux-thread-db.c 1 May 2009 22:24:07 -0000
> @@ -266,7 +266,7 @@ thread_get_info_callback (const td_thrha
>
> /* Fill the cache. */
> thread_ptid = ptid_build (GET_PID (proc_handle.ptid), ti.ti_lid, 0);
> - thread_info = find_thread_pid (thread_ptid);
> + 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. */
> @@ -284,7 +284,7 @@ thread_get_info_callback (const td_thrha
> thread_db_find_new_threads_1 ();
> else
> attach_thread (thread_ptid, thp, &ti);
> - thread_info = find_thread_pid (thread_ptid);
> + thread_info = find_thread_ptid (thread_ptid);
> gdb_assert (thread_info != NULL);
> }
>
> @@ -696,7 +696,7 @@ attach_thread (ptid_t ptid, const td_thr
> 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
> @@ -765,7 +765,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;
> }
> @@ -981,7 +981,7 @@ find_new_threads_callback (const td_thrh
> return 0;
> }
>
> - tp = find_thread_pid (ptid);
> + tp = find_thread_ptid (ptid);
> if (tp == NULL || tp->private == NULL)
> attach_thread (ptid, th_p, &ti);
>
> @@ -1026,7 +1026,7 @@ thread_db_find_new_threads (struct targe
> 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)
> @@ -1080,7 +1080,7 @@ thread_db_get_thread_local_address (stru
> thread_db_find_new_threads_1 ();
>
> /* Find the matching thread. */
> - thread_info = find_thread_pid (ptid);
> + thread_info = find_thread_ptid (ptid);
>
> if (thread_info != NULL && thread_info->private != NULL)
> {
> Index: thread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/thread.c,v
> retrieving revision 1.109
> diff -u -p -r1.109 thread.c
> --- thread.c 31 Mar 2009 15:23:57 -0000 1.109
> +++ thread.c 1 May 2009 22:24:07 -0000
> @@ -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;
> }
> @@ -146,7 +146,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.
> @@ -302,7 +302,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;
>
> @@ -499,7 +499,7 @@ thread_change_ptid (ptid_t old_ptid, pti
> 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);
> @@ -530,7 +530,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)
> @@ -549,7 +549,7 @@ is_thread_state (ptid_t ptid, enum threa
> if (!target_has_execution)
> return 0;
>
> - tp = find_thread_pid (ptid);
> + tp = find_thread_ptid (ptid);
> gdb_assert (tp);
> return tp->state_ == state;
> }
> @@ -607,7 +607,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_;
> }
> @@ -624,7 +624,7 @@ set_executing (ptid_t ptid, int executin
> }
> else
> {
> - tp = find_thread_pid (ptid);
> + tp = find_thread_ptid (ptid);
> gdb_assert (tp);
> tp->executing_ = executing;
> }
> @@ -644,7 +644,7 @@ set_stop_requested (ptid_t ptid, int sto
> }
> else
> {
> - tp = find_thread_pid (ptid);
> + tp = find_thread_ptid (ptid);
> gdb_assert (tp);
> tp->stop_requested = stop;
> }
> @@ -680,7 +680,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)
> {
> @@ -933,7 +933,7 @@ do_restore_current_thread_cleanup (void
> 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.),
> @@ -962,7 +962,7 @@ restore_current_thread_cleanup_dtor (voi
> {
> 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);
> @@ -992,7 +992,7 @@ make_cleanup_restore_current_thread (voi
> 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++;
> }
> Index: mi/mi-interp.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mi/mi-interp.c,v
> retrieving revision 1.46
> diff -u -p -r1.46 mi-interp.c
> --- mi/mi-interp.c 25 Mar 2009 21:53:11 -0000 1.46
> +++ mi/mi-interp.c 1 May 2009 22:24:07 -0000
> @@ -397,7 +397,7 @@ mi_on_resume (ptid_t ptid)
> if (ptid_equal (ptid, minus_one_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)
> @@ -428,7 +428,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);
> }
> Index: gdbserver/inferiors.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbserver/inferiors.c,v
> retrieving revision 1.22
> diff -u -p -r1.22 inferiors.c
> --- gdbserver/inferiors.c 30 Apr 2009 22:21:06 -0000 1.22
> +++ gdbserver/inferiors.c 1 May 2009 22:24:07 -0000
> @@ -210,7 +210,7 @@ thread_to_gdb_id (struct thread_info *th
> }
>
> 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;
> }
> Index: gdbserver/remote-utils.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbserver/remote-utils.c,v
> retrieving revision 1.66
> diff -u -p -r1.66 remote-utils.c
> --- gdbserver/remote-utils.c 3 Apr 2009 14:38:38 -0000 1.66
> +++ gdbserver/remote-utils.c 1 May 2009 22:24:07 -0000
> @@ -1091,7 +1091,7 @@ prepare_resume_reply (char *buf, ptid_t
>
> 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) ())
> Index: gdbserver/server.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbserver/server.c,v
> retrieving revision 1.96
> diff -u -p -r1.96 server.c
> --- gdbserver/server.c 30 Apr 2009 22:21:06 -0000 1.96
> +++ gdbserver/server.c 1 May 2009 22:24:07 -0000
> @@ -1156,7 +1156,7 @@ handle_query (char *own_buf, int packet_
> err = 1;
> else
> {
> - struct thread_info *thread = find_thread_pid (ptid);
> + struct thread_info *thread = find_thread_ptid (ptid);
>
> if (thread == NULL)
> err = 2;
> Index: gdbserver/server.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbserver/server.h,v
> retrieving revision 1.57
> diff -u -p -r1.57 server.h
> --- gdbserver/server.h 30 Apr 2009 22:21:06 -0000 1.57
> +++ gdbserver/server.h 1 May 2009 22:24:07 -0000
> @@ -239,7 +239,7 @@ struct process_info *find_process_pid (i
> 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 *);
> Index: gdbserver/target.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbserver/target.c,v
> retrieving revision 1.15
> diff -u -p -r1.15 target.c
> --- gdbserver/target.c 1 Apr 2009 22:50:24 -0000 1.15
> +++ gdbserver/target.c 1 May 2009 22:24:07 -0000
> @@ -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)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] rename find_thread_pid to find_thread_ptid
2009-05-18 23:21 ` Doug Evans
@ 2009-05-22 15:20 ` Joel Brobecker
0 siblings, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2009-05-22 15:20 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
> Joel's comment was to rename to find_thread_from_ptid.
> I think that's great, but there's a lot more to be renamed along those
> lines than what this patch does, so I went with consistency with the
> current usage in gdb and just fixed the pid->ptid bug.
>
> Ok to check in?
Go ahead, this is fine.
Thanks,
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-05-22 15:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-01 22:51 [RFA] rename find_thread_pid to find_thread_ptid Doug Evans
2009-05-06 19:02 ` Joel Brobecker
2009-05-06 20:25 ` Doug Evans
2009-05-18 23:21 ` Doug Evans
2009-05-22 15:20 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox