mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-02 11:01:35 +08:00
Phase 1 of the ptid_t changes.
This commit is contained in:
@ -1064,7 +1064,7 @@ inf_validate_procs (struct inf *inf)
|
||||
(last ? last->next : inf->threads) = thread;
|
||||
last = thread;
|
||||
proc_debug (thread, "new thread: %d", threads[i]);
|
||||
add_thread (thread->tid); /* Tell GDB's generic thread code. */
|
||||
add_thread (pid_to_ptid (thread->tid)); /* Tell GDB's generic thread code. */
|
||||
}
|
||||
}
|
||||
|
||||
@ -1408,8 +1408,8 @@ struct inf *current_inferior = 0;
|
||||
struct inf *waiting_inf;
|
||||
|
||||
/* Wait for something to happen in the inferior, returning what in STATUS. */
|
||||
static int
|
||||
gnu_wait (int tid, struct target_waitstatus *status)
|
||||
static ptid_t
|
||||
gnu_wait (ptid_t tid, struct target_waitstatus *status)
|
||||
{
|
||||
struct msg
|
||||
{
|
||||
@ -1440,7 +1440,7 @@ gnu_wait (int tid, struct target_waitstatus *status)
|
||||
|
||||
waiting_inf = inf;
|
||||
|
||||
inf_debug (inf, "waiting for: %d", tid);
|
||||
inf_debug (inf, "waiting for: %d", PIDGET (tid));
|
||||
|
||||
rewait:
|
||||
if (proc_wait_pid != inf->pid && !inf->no_wait)
|
||||
@ -1576,20 +1576,20 @@ rewait:
|
||||
|
||||
thread = inf->wait.thread;
|
||||
if (thread)
|
||||
tid = thread->tid;
|
||||
tid = pid_to_ptid (thread->tid);
|
||||
else
|
||||
thread = inf_tid_to_thread (inf, tid);
|
||||
thread = inf_tid_to_thread (inf, PIDGET (tid));
|
||||
|
||||
if (!thread || thread->port == MACH_PORT_NULL)
|
||||
{
|
||||
/* TID is dead; try and find a new thread. */
|
||||
if (inf_update_procs (inf) && inf->threads)
|
||||
tid = inf->threads->tid; /* The first available thread. */
|
||||
tid = pid_to_ptid (inf->threads->tid); /* The first available thread. */
|
||||
else
|
||||
tid = inferior_pid; /* let wait_for_inferior handle exit case */
|
||||
tid = inferior_ptid; /* let wait_for_inferior handle exit case */
|
||||
}
|
||||
|
||||
if (thread && tid >= 0 && status->kind != TARGET_WAITKIND_SPURIOUS
|
||||
if (thread && PIDGET (tid) >= 0 && status->kind != TARGET_WAITKIND_SPURIOUS
|
||||
&& inf->pause_sc == 0 && thread->pause_sc == 0)
|
||||
/* If something actually happened to THREAD, make sure we
|
||||
suspend it. */
|
||||
@ -1598,7 +1598,7 @@ rewait:
|
||||
inf_update_suspends (inf);
|
||||
}
|
||||
|
||||
inf_debug (inf, "returning tid = %d, status = %s (%d)", tid,
|
||||
inf_debug (inf, "returning tid = %d, status = %s (%d)", PIDGET (tid),
|
||||
status->kind == TARGET_WAITKIND_EXITED ? "EXITED"
|
||||
: status->kind == TARGET_WAITKIND_STOPPED ? "STOPPED"
|
||||
: status->kind == TARGET_WAITKIND_SIGNALLED ? "SIGNALLED"
|
||||
@ -1925,12 +1925,12 @@ port_msgs_queued (mach_port_t port)
|
||||
in multiple events returned by wait).
|
||||
*/
|
||||
static void
|
||||
gnu_resume (int tid, int step, enum target_signal sig)
|
||||
gnu_resume (ptid_t tid, int step, enum target_signal sig)
|
||||
{
|
||||
struct proc *step_thread = 0;
|
||||
struct inf *inf = current_inferior;
|
||||
|
||||
inf_debug (inf, "tid = %d, step = %d, sig = %d", tid, step, sig);
|
||||
inf_debug (inf, "tid = %d, step = %d, sig = %d", PIDGET (tid), step, sig);
|
||||
|
||||
inf_validate_procinfo (inf);
|
||||
|
||||
@ -1958,17 +1958,17 @@ gnu_resume (int tid, int step, enum target_signal sig)
|
||||
|
||||
inf_update_procs (inf);
|
||||
|
||||
if (tid < 0)
|
||||
if (PIDGET (tid) < 0)
|
||||
/* Allow all threads to run, except perhaps single-stepping one. */
|
||||
{
|
||||
inf_debug (inf, "running all threads; tid = %d", inferior_pid);
|
||||
tid = inferior_pid; /* What to step. */
|
||||
inf_debug (inf, "running all threads; tid = %d", PIDGET (inferior_ptid));
|
||||
tid = inferior_ptid; /* What to step. */
|
||||
inf_set_threads_resume_sc (inf, 0, 1);
|
||||
}
|
||||
else
|
||||
/* Just allow a single thread to run. */
|
||||
{
|
||||
struct proc *thread = inf_tid_to_thread (inf, tid);
|
||||
struct proc *thread = inf_tid_to_thread (inf, PIDGET (tid));
|
||||
if (!thread)
|
||||
error ("Can't run single thread id %d: no such thread!");
|
||||
inf_debug (inf, "running one thread: %d/%d", inf->pid, thread->tid);
|
||||
@ -1977,9 +1977,9 @@ gnu_resume (int tid, int step, enum target_signal sig)
|
||||
|
||||
if (step)
|
||||
{
|
||||
step_thread = inf_tid_to_thread (inf, tid);
|
||||
step_thread = inf_tid_to_thread (inf, PIDGET (tid));
|
||||
if (!step_thread)
|
||||
warning ("Can't step thread id %d: no such thread.", tid);
|
||||
warning ("Can't step thread id %d: no such thread.", PIDGET (tid));
|
||||
else
|
||||
inf_debug (inf, "stepping thread: %d/%d", inf->pid, step_thread->tid);
|
||||
}
|
||||
@ -2066,7 +2066,7 @@ gnu_create_inferior (char *exec_file, char *allargs, char **env)
|
||||
/* Now let the child run again, knowing that it will stop immediately
|
||||
because of the ptrace. */
|
||||
inf_resume (inf);
|
||||
inferior_pid = inf_pick_first_thread ();
|
||||
inferior_ptid = pid_to_ptid (inf_pick_first_thread ());
|
||||
|
||||
startup_inferior (inf->pending_execs);
|
||||
}
|
||||
@ -2137,7 +2137,7 @@ gnu_attach (char *args, int from_tty)
|
||||
inf_attach (inf, pid);
|
||||
inf_update_procs (inf);
|
||||
|
||||
inferior_pid = inf_pick_first_thread ();
|
||||
inferior_ptid = pid_to_ptid (inf_pick_first_thread ());
|
||||
|
||||
attach_flag = 1;
|
||||
push_target (&gnu_ops);
|
||||
@ -2182,7 +2182,7 @@ gnu_detach (char *args, int from_tty)
|
||||
|
||||
inf_detach (current_inferior);
|
||||
|
||||
inferior_pid = 0;
|
||||
inferior_ptid = null_ptid;
|
||||
|
||||
unpush_target (&gnu_ops); /* Pop out of handling an inferior */
|
||||
}
|
||||
@ -2230,10 +2230,10 @@ gnu_pid_to_exec_file (void)
|
||||
|
||||
|
||||
static int
|
||||
gnu_thread_alive (int tid)
|
||||
gnu_thread_alive (ptid_t tid)
|
||||
{
|
||||
inf_update_procs (current_inferior);
|
||||
return !!inf_tid_to_thread (current_inferior, tid);
|
||||
return !!inf_tid_to_thread (current_inferior, PIDGET (tid));
|
||||
}
|
||||
|
||||
|
||||
@ -2481,9 +2481,10 @@ proc_string (struct proc *proc)
|
||||
}
|
||||
|
||||
static char *
|
||||
gnu_pid_to_str (int tid)
|
||||
gnu_pid_to_str (ptid_t ptid)
|
||||
{
|
||||
struct inf *inf = current_inferior;
|
||||
int tid = PIDGET (ptid);
|
||||
struct proc *thread = inf_tid_to_thread (inf, tid);
|
||||
|
||||
if (thread)
|
||||
@ -2653,7 +2654,7 @@ static struct proc *
|
||||
cur_thread (void)
|
||||
{
|
||||
struct inf *inf = cur_inf ();
|
||||
struct proc *thread = inf_tid_to_thread (inf, inferior_pid);
|
||||
struct proc *thread = inf_tid_to_thread (inf, PIDGET (inferior_ptid));
|
||||
if (!thread)
|
||||
error ("No current thread.");
|
||||
return thread;
|
||||
|
Reference in New Issue
Block a user