+2014-09-16 Gary Benson <gbenson@redhat.com>
+
+ * inferiors.h (current_inferior): Renamed as...
+ (current_thread): New variable. All uses updated.
+ * linux-low.c (get_pc): Renamed saved_inferior as saved_thread.
+ (maybe_move_out_of_jump_pad): Likewise.
+ (cancel_breakpoint): Likewise.
+ (linux_low_filter_event): Likewise.
+ (wait_for_sigstop): Likewise.
+ (linux_resume_one_lwp): Likewise.
+ (need_step_over_p): Likewise.
+ (start_step_over): Likewise.
+ (linux_stabilize_threads): Renamed save_inferior as saved_thread.
+ * linux-x86-low.c (x86_linux_update_xmltarget): Likewise.
+ * proc-service.c (ps_lgetregs): Renamed reg_inferior as reg_thread
+ and save_inferior as saved_thread.
+ * regcache.c (get_thread_regcache): Renamed saved_inferior as
+ saved_thread.
+ (regcache_invalidate_thread): Likewise.
+ * remote-utils.c (prepare_resume_reply): Likewise.
+ * thread-db.c (thread_db_get_tls_address): Likewise.
+ (disable_thread_event_reporting): Likewise.
+ (remove_thread_event_breakpoints): Likewise.
+ * tracepoint.c (gdb_agent_about_to_close): Renamed save_inferior
+ as saved_thread.
+ * target.h (set_desired_inferior): Renamed as...
+ (set_desired_thread): New declaration. All uses updated.
+ * server.c (myresume): Updated comment to reference thread instead
+ of inferior.
+ (handle_serial_event): Likewise.
+ (handle_target_event): Likewise.
+
2014-09-12 Tom Tromey <tromey@redhat.com>
Gary Benson <gbenson@redhat.com>
struct thread_info *find_thread_ptid (ptid_t ptid);
/* Get current thread ID (Linux task ID). */
-#define current_ptid (current_inferior->entry.id)
+#define current_ptid (current_thread->entry.id)
#endif /* GDB_THREAD_H */
struct inferior_list all_processes;
struct inferior_list all_threads;
-struct thread_info *current_inferior;
+struct thread_info *current_thread;
#define get_thread(inf) ((struct thread_info *)(inf))
add_inferior_to_list (&all_threads, &new_thread->entry);
- if (current_inferior == NULL)
- current_inferior = new_thread;
+ if (current_thread == NULL)
+ current_thread = new_thread;
new_thread->target_data = target_data;
clear_dlls ();
- current_inferior = NULL;
+ current_thread = NULL;
}
struct process_info *
struct process_info *
current_process (void)
{
- gdb_assert (current_inferior != NULL);
- return get_thread_process (current_inferior);
+ gdb_assert (current_thread != NULL);
+ return get_thread_process (current_thread);
}
#define lwpid_of(inf) ptid_get_lwp ((inf)->entry.id)
/* Return a pointer to the process that corresponds to the current
- thread (current_inferior). It is an error to call this if there is
+ thread (current_thread). It is an error to call this if there is
no current thread selected. */
struct process_info *current_process (void);
#define ALL_PROCESSES(cur, tmp) \
ALL_INFERIORS_TYPE (struct process_info, &all_processes, cur, tmp)
-extern struct thread_info *current_inferior;
+extern struct thread_info *current_thread;
void remove_inferior (struct inferior_list *list,
struct inferior_list_entry *entry);
struct aarch64_dr_update_callback_param param;
/* Only update the threads of this process. */
- param.pid = pid_of (current_inferior);
+ param.pid = pid_of (current_thread);
param.is_watchpoint = is_watchpoint;
param.idx = idx;
int pid, i;
struct aarch64_debug_reg_state *state;
- pid = lwpid_of (current_inferior);
+ pid = lwpid_of (current_thread);
/* Get the siginfo. */
if (ptrace (PTRACE_GETSIGINFO, pid, NULL, &siginfo) != 0)
current_process ()->tdesc = tdesc_aarch64;
- pid = lwpid_of (current_inferior);
+ pid = lwpid_of (current_thread);
iov.iov_base = &dreg_state;
iov.iov_len = sizeof (dreg_state);
static int
arm_breakpoint_at (CORE_ADDR where)
{
- struct regcache *regcache = get_thread_regcache (current_inferior, 1);
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
unsigned long cpsr;
collect_register_by_name (regcache, "cpsr", &cpsr);
static CORE_ADDR
arm_reinsert_addr (void)
{
- struct regcache *regcache = get_thread_regcache (current_inferior, 1);
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
unsigned long pc;
collect_register_by_name (regcache, "lr", &pc);
return pc;
struct update_registers_data *data = (struct update_registers_data *) arg;
/* Only update the threads of the current process. */
- if (pid_of (thread) == pid_of (current_inferior))
+ if (pid_of (thread) == pid_of (current_thread))
{
/* The actual update is done later just before resuming the lwp,
we just mark that the registers need updating. */
static int
arm_stopped_by_watchpoint (void)
{
- struct lwp_info *lwp = get_thread_lwp (current_inferior);
+ struct lwp_info *lwp = get_thread_lwp (current_thread);
siginfo_t siginfo;
/* We must be able to set hardware watchpoints. */
/* Retrieve siginfo. */
errno = 0;
- ptrace (PTRACE_GETSIGINFO, lwpid_of (current_inferior), 0, &siginfo);
+ ptrace (PTRACE_GETSIGINFO, lwpid_of (current_thread), 0, &siginfo);
if (errno != 0)
return 0;
static CORE_ADDR
arm_stopped_data_address (void)
{
- struct lwp_info *lwp = get_thread_lwp (current_inferior);
+ struct lwp_info *lwp = get_thread_lwp (current_thread);
return lwp->arch_private->stopped_data_address;
}
static const struct target_desc *
arm_read_description (void)
{
- int pid = lwpid_of (current_inferior);
+ int pid = lwpid_of (current_thread);
/* Query hardware watchpoint/breakpoint capabilities. */
arm_linux_init_hwbp_cap (pid);
static CORE_ADDR
cris_reinsert_addr (void)
{
- struct regcache *regcache = get_thread_regcache (current_inferior, 1);
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
unsigned long pc;
collect_register_by_name (regcache, "srp", &pc);
return pc;
static CORE_ADDR
cris_reinsert_addr (void)
{
- struct regcache *regcache = get_thread_regcache (current_inferior, 1);
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
unsigned long pc;
collect_register_by_name (regcache, "srp", &pc);
return pc;
unsigned long ccs;
struct regcache *regcache;
- regcache = get_thread_regcache (current_inferior, 1);
+ regcache = get_thread_regcache (current_thread, 1);
/* Read watchpoints are set as access watchpoints, because of GDB's
inability to deal with pure read watchpoints. */
struct regcache *regcache;
unsigned long bp_d_regs[12];
- regcache = get_thread_regcache (current_inferior, 1);
+ regcache = get_thread_regcache (current_thread, 1);
/* Read watchpoints are set as access watchpoints, because of GDB's
inability to deal with pure read watchpoints. */
cris_stopped_by_watchpoint (void)
{
unsigned long exs;
- struct regcache *regcache = get_thread_regcache (current_inferior, 1);
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
collect_register_by_name (regcache, "exs", &exs);
cris_stopped_data_address (void)
{
unsigned long eda;
- struct regcache *regcache = get_thread_regcache (current_inferior, 1);
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
collect_register_by_name (regcache, "eda", &eda);
static CORE_ADDR
get_pc (struct lwp_info *lwp)
{
- struct thread_info *saved_inferior;
+ struct thread_info *saved_thread;
struct regcache *regcache;
CORE_ADDR pc;
if (the_low_target.get_pc == NULL)
return 0;
- saved_inferior = current_inferior;
- current_inferior = get_lwp_thread (lwp);
+ saved_thread = current_thread;
+ current_thread = get_lwp_thread (lwp);
- regcache = get_thread_regcache (current_inferior, 1);
+ regcache = get_thread_regcache (current_thread, 1);
pc = (*the_low_target.get_pc) (regcache);
if (debug_threads)
debug_printf ("pc is 0x%lx\n", (long) pc);
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
return pc;
}
static int
maybe_move_out_of_jump_pad (struct lwp_info *lwp, int *wstat)
{
- struct thread_info *saved_inferior;
+ struct thread_info *saved_thread;
- saved_inferior = current_inferior;
- current_inferior = get_lwp_thread (lwp);
+ saved_thread = current_thread;
+ current_thread = get_lwp_thread (lwp);
if ((wstat == NULL
|| (WIFSTOPPED (*wstat) && WSTOPSIG (*wstat) != SIGTRAP))
if (debug_threads)
debug_printf ("Checking whether LWP %ld needs to move out of the "
"jump pad.\n",
- lwpid_of (current_inferior));
+ lwpid_of (current_thread));
r = linux_fast_tracepoint_collecting (lwp, &status);
if (debug_threads)
debug_printf ("Checking whether LWP %ld needs to move out of "
"the jump pad...it does\n",
- lwpid_of (current_inferior));
- current_inferior = saved_inferior;
+ lwpid_of (current_thread));
+ current_thread = saved_thread;
return 1;
}
|| WSTOPSIG (*wstat) == SIGFPE
|| WSTOPSIG (*wstat) == SIGBUS
|| WSTOPSIG (*wstat) == SIGSEGV)
- && ptrace (PTRACE_GETSIGINFO, lwpid_of (current_inferior),
+ && ptrace (PTRACE_GETSIGINFO, lwpid_of (current_thread),
(PTRACE_TYPE_ARG3) 0, &info) == 0
/* Final check just to make sure we don't clobber
the siginfo of non-kernel-sent signals. */
&& (uintptr_t) info.si_addr == lwp->stop_pc)
{
info.si_addr = (void *) (uintptr_t) status.tpoint_addr;
- ptrace (PTRACE_SETSIGINFO, lwpid_of (current_inferior),
+ ptrace (PTRACE_SETSIGINFO, lwpid_of (current_thread),
(PTRACE_TYPE_ARG3) 0, &info);
}
- regcache = get_thread_regcache (current_inferior, 1);
+ regcache = get_thread_regcache (current_thread, 1);
(*the_low_target.set_pc) (regcache, status.tpoint_addr);
lwp->stop_pc = status.tpoint_addr;
if (debug_threads)
debug_printf ("Checking whether LWP %ld needs to move out of the "
"jump pad...no\n",
- lwpid_of (current_inferior));
+ lwpid_of (current_thread));
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
return 0;
}
static int
cancel_breakpoint (struct lwp_info *lwp)
{
- struct thread_info *saved_inferior;
+ struct thread_info *saved_thread;
/* There's nothing to do if we don't support breakpoints. */
if (!supports_breakpoints ())
return 0;
/* breakpoint_at reads from current inferior. */
- saved_inferior = current_inferior;
- current_inferior = get_lwp_thread (lwp);
+ saved_thread = current_thread;
+ current_thread = get_lwp_thread (lwp);
if ((*the_low_target.breakpoint_at) (lwp->stop_pc))
{
if (debug_threads)
debug_printf ("CB: Push back breakpoint for %s\n",
- target_pid_to_str (ptid_of (current_inferior)));
+ target_pid_to_str (ptid_of (current_thread)));
/* Back up the PC if necessary. */
if (the_low_target.decr_pc_after_break)
{
struct regcache *regcache
- = get_thread_regcache (current_inferior, 1);
+ = get_thread_regcache (current_thread, 1);
(*the_low_target.set_pc) (regcache, lwp->stop_pc);
}
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
return 1;
}
else
if (debug_threads)
debug_printf ("CB: No breakpoint found at %s for [%s]\n",
paddress (lwp->stop_pc),
- target_pid_to_str (ptid_of (current_inferior)));
+ target_pid_to_str (ptid_of (current_thread)));
}
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
return 0;
}
proc = find_process_pid (pid_of (thread));
if (proc->private->new_inferior)
{
- struct thread_info *saved_inferior;
+ struct thread_info *saved_thread;
- saved_inferior = current_inferior;
- current_inferior = thread;
+ saved_thread = current_thread;
+ current_thread = thread;
the_low_target.arch_setup ();
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
proc->private->new_inferior = 0;
}
if (debug_threads
&& the_low_target.get_pc != NULL)
{
- struct thread_info *saved_inferior;
+ struct thread_info *saved_thread;
struct regcache *regcache;
CORE_ADDR pc;
- saved_inferior = current_inferior;
- current_inferior = thread;
- regcache = get_thread_regcache (current_inferior, 1);
+ saved_thread = current_thread;
+ current_thread = thread;
+ regcache = get_thread_regcache (current_thread, 1);
pc = (*the_low_target.get_pc) (regcache);
debug_printf ("linux_low_filter_event: pc is 0x%lx\n", (long) pc);
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
}
child->stop_pc = get_stop_pc (child);
}
else
{
- struct thread_info *saved_inferior;
+ struct thread_info *saved_thread;
- saved_inferior = current_inferior;
- current_inferior = thread;
+ saved_thread = current_thread;
+ current_thread = thread;
child->stopped_by_watchpoint
= the_low_target.stopped_by_watchpoint ();
child->stopped_data_address = 0;
}
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
}
}
*wstatp = event_child->status_pending;
event_child->status_pending_p = 0;
event_child->status_pending = 0;
- current_inferior = event_thread;
+ current_thread = event_thread;
return lwpid_of (event_thread);
}
sigprocmask (SIG_SETMASK, &prev_mask, NULL);
- current_inferior = event_thread;
+ current_thread = event_thread;
/* Check for thread exit. */
if (! WIFSTOPPED (*wstatp))
static void
linux_stabilize_threads (void)
{
- struct thread_info *save_inferior;
+ struct thread_info *saved_thread;
struct thread_info *thread_stuck;
thread_stuck
return;
}
- save_inferior = current_inferior;
+ saved_thread = current_thread;
stabilizing_threads = 1;
if (ourstatus.kind == TARGET_WAITKIND_STOPPED)
{
- lwp = get_thread_lwp (current_inferior);
+ lwp = get_thread_lwp (current_thread);
/* Lock it. */
lwp->suspended++;
if (ourstatus.value.sig != GDB_SIGNAL_0
- || current_inferior->last_resume_kind == resume_stop)
+ || current_thread->last_resume_kind == resume_stop)
{
wstat = W_STOPCODE (gdb_signal_to_host (ourstatus.value.sig));
enqueue_one_deferred_signal (lwp, &wstat);
stabilizing_threads = 0;
- current_inferior = save_inferior;
+ current_thread = saved_thread;
if (debug_threads)
{
return null_ptid;
}
- event_child = get_thread_lwp (current_inferior);
+ event_child = get_thread_lwp (current_thread);
/* linux_wait_for_event only returns an exit status for the last
child of a process. Report it. */
{
debug_printf ("linux_wait_1 ret = %s, exited with "
"retcode %d\n",
- target_pid_to_str (ptid_of (current_inferior)),
+ target_pid_to_str (ptid_of (current_thread)),
WEXITSTATUS (w));
debug_exit ();
}
{
debug_printf ("linux_wait_1 ret = %s, terminated with "
"signal %d\n",
- target_pid_to_str (ptid_of (current_inferior)),
+ target_pid_to_str (ptid_of (current_thread)),
WTERMSIG (w));
debug_exit ();
}
}
- return ptid_of (current_inferior);
+ return ptid_of (current_thread);
}
/* If this event was not handled before, and is not a SIGTRAP, we
if (debug_threads)
debug_printf ("Got signal %d for LWP %ld. Check if we need "
"to defer or adjust it.\n",
- WSTOPSIG (w), lwpid_of (current_inferior));
+ WSTOPSIG (w), lwpid_of (current_thread));
/* Allow debugging the jump pad itself. */
- if (current_inferior->last_resume_kind != resume_step
+ if (current_thread->last_resume_kind != resume_step
&& maybe_move_out_of_jump_pad (event_child, &w))
{
enqueue_one_deferred_signal (event_child, &w);
if (debug_threads)
debug_printf ("Signal %d for LWP %ld deferred (in jump pad)\n",
- WSTOPSIG (w), lwpid_of (current_inferior));
+ WSTOPSIG (w), lwpid_of (current_thread));
linux_resume_one_lwp (event_child, 0, 0, NULL);
goto retry;
if (debug_threads)
debug_printf ("LWP %ld was trying to move out of the jump pad (%d). "
"Check if we're already there.\n",
- lwpid_of (current_inferior),
+ lwpid_of (current_thread),
event_child->collecting_fast_tracepoint);
trace_event = 1;
{
debug_printf ("linux_wait_1 ret = %s, stopped "
"while stabilizing threads\n",
- target_pid_to_str (ptid_of (current_inferior)));
+ target_pid_to_str (ptid_of (current_thread)));
debug_exit ();
}
- return ptid_of (current_inferior);
+ return ptid_of (current_thread);
}
}
}
/* FIXME drow/2002-06-09: Get signal numbers from the inferior's
thread library? */
if (WIFSTOPPED (w)
- && current_inferior->last_resume_kind != resume_step
+ && current_thread->last_resume_kind != resume_step
&& (
#if defined (USE_THREAD_DB) && !defined (__ANDROID__)
(current_process ()->private->thread_db != NULL
#endif
(pass_signals[gdb_signal_from_host (WSTOPSIG (w))]
&& !(WSTOPSIG (w) == SIGSTOP
- && current_inferior->last_resume_kind == resume_stop))))
+ && current_thread->last_resume_kind == resume_stop))))
{
siginfo_t info, *info_p;
if (debug_threads)
debug_printf ("Ignored signal %d for LWP %ld.\n",
- WSTOPSIG (w), lwpid_of (current_inferior));
+ WSTOPSIG (w), lwpid_of (current_thread));
- if (ptrace (PTRACE_GETSIGINFO, lwpid_of (current_inferior),
+ if (ptrace (PTRACE_GETSIGINFO, lwpid_of (current_thread),
(PTRACE_TYPE_ARG3) 0, &info) == 0)
info_p = &info;
else
reporting the event to GDB. If we don't, we're out of luck, GDB
won't see the breakpoint hit. */
report_to_gdb = (!maybe_internal_trap
- || (current_inferior->last_resume_kind == resume_step
+ || (current_thread->last_resume_kind == resume_step
&& !in_step_range)
|| event_child->stopped_by_watchpoint
|| (!step_over_finished && !in_step_range
if (the_low_target.set_pc != NULL)
{
struct regcache *regcache
- = get_thread_regcache (current_inferior, 1);
+ = get_thread_regcache (current_thread, 1);
(*the_low_target.set_pc) (regcache, event_child->stop_pc);
}
if (debug_threads)
{
- if (current_inferior->last_resume_kind == resume_step)
+ if (current_thread->last_resume_kind == resume_step)
{
if (event_child->step_range_start == event_child->step_range_end)
debug_printf ("GDB wanted to single-step, reporting event.\n");
select_event_lwp (&event_child);
- /* current_inferior and event_child must stay in sync. */
- current_inferior = get_lwp_thread (event_child);
+ /* current_thread and event_child must stay in sync. */
+ current_thread = get_lwp_thread (event_child);
event_child->status_pending_p = 0;
w = event_child->status_pending;
ourstatus->kind = TARGET_WAITKIND_STOPPED;
- if (current_inferior->last_resume_kind == resume_stop
+ if (current_thread->last_resume_kind == resume_stop
&& WSTOPSIG (w) == SIGSTOP)
{
/* A thread that has been requested to stop by GDB with vCont;t,
SIGSTOP is an implementation detail. */
ourstatus->value.sig = GDB_SIGNAL_0;
}
- else if (current_inferior->last_resume_kind == resume_stop
+ else if (current_thread->last_resume_kind == resume_stop
&& WSTOPSIG (w) != SIGSTOP)
{
/* A thread that has been requested to stop by GDB with vCont;t,
if (debug_threads)
{
debug_printf ("linux_wait_1 ret = %s, %d, %d\n",
- target_pid_to_str (ptid_of (current_inferior)),
+ target_pid_to_str (ptid_of (current_thread)),
ourstatus->kind, ourstatus->value.sig);
debug_exit ();
}
- return ptid_of (current_inferior);
+ return ptid_of (current_thread);
}
/* Get rid of any pending event in the pipe. */
static void
wait_for_sigstop (void)
{
- struct thread_info *saved_inferior;
+ struct thread_info *saved_thread;
ptid_t saved_tid;
int wstat;
int ret;
- saved_inferior = current_inferior;
- if (saved_inferior != NULL)
- saved_tid = saved_inferior->entry.id;
+ saved_thread = current_thread;
+ if (saved_thread != NULL)
+ saved_tid = saved_thread->entry.id;
else
saved_tid = null_ptid; /* avoid bogus unused warning */
&wstat, __WALL);
gdb_assert (ret == -1);
- if (saved_inferior == NULL || linux_thread_alive (saved_tid))
- current_inferior = saved_inferior;
+ if (saved_thread == NULL || linux_thread_alive (saved_tid))
+ current_thread = saved_thread;
else
{
if (debug_threads)
/* We can't change the current inferior behind GDB's back,
otherwise, a subsequent command may apply to the wrong
process. */
- current_inferior = NULL;
+ current_thread = NULL;
}
else
{
/* Set a valid thread as current. */
- set_desired_inferior (0);
+ set_desired_thread (0);
}
}
}
int step, int signal, siginfo_t *info)
{
struct thread_info *thread = get_lwp_thread (lwp);
- struct thread_info *saved_inferior;
+ struct thread_info *saved_thread;
int fast_tp_collecting;
if (lwp->stopped == 0)
return;
}
- saved_inferior = current_inferior;
- current_inferior = thread;
+ saved_thread = current_thread;
+ current_thread = thread;
if (debug_threads)
debug_printf ("Resuming lwp %ld (%s, signal %d, stop %s)\n",
if (debug_threads && the_low_target.get_pc != NULL)
{
- struct regcache *regcache = get_thread_regcache (current_inferior, 1);
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
CORE_ADDR pc = (*the_low_target.get_pc) (regcache);
debug_printf (" resuming from pc 0x%lx\n", (long) pc);
}
of coercing an 8 byte integer to a 4 byte pointer. */
(PTRACE_TYPE_ARG4) (uintptr_t) signal);
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
if (errno)
{
/* ESRCH from ptrace either means that the thread was already
{
struct thread_info *thread = (struct thread_info *) entry;
struct lwp_info *lwp = get_thread_lwp (thread);
- struct thread_info *saved_inferior;
+ struct thread_info *saved_thread;
CORE_ADDR pc;
/* LWPs which will not be resumed are not interesting, because we
return 0;
}
- saved_inferior = current_inferior;
- current_inferior = thread;
+ saved_thread = current_thread;
+ current_thread = thread;
/* We can only step over breakpoints we know about. */
if (breakpoint_here (pc) || fast_tracepoint_jump_here (pc))
" GDB breakpoint at 0x%s; skipping step over\n",
lwpid_of (thread), paddress (pc));
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
return 0;
}
else
/* We've found an lwp that needs stepping over --- return 1 so
that find_inferior stops looking. */
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
/* If the step over is cancelled, this is set again. */
lwp->need_step_over = 0;
}
}
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
if (debug_threads)
debug_printf ("Need step over [LWP %ld]? No, no breakpoint found"
start_step_over (struct lwp_info *lwp)
{
struct thread_info *thread = get_lwp_thread (lwp);
- struct thread_info *saved_inferior;
+ struct thread_info *saved_thread;
CORE_ADDR pc;
int step;
shouldn't care about. */
pc = get_pc (lwp);
- saved_inferior = current_inferior;
- current_inferior = thread;
+ saved_thread = current_thread;
+ current_thread = thread;
lwp->bp_reinsert = pc;
uninsert_breakpoints_at (pc);
step = 0;
}
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
linux_resume_one_lwp (lwp, step, 0, NULL);
regset = regsets_info->regsets;
- pid = lwpid_of (current_inferior);
+ pid = lwpid_of (current_thread);
while (regset->size >= 0)
{
void *buf, *data;
regset = regsets_info->regsets;
- pid = lwpid_of (current_inferior);
+ pid = lwpid_of (current_thread);
while (regset->size >= 0)
{
void *buf, *data;
& -sizeof (PTRACE_XFER_TYPE));
buf = alloca (size);
- pid = lwpid_of (current_inferior);
+ pid = lwpid_of (current_thread);
for (i = 0; i < size; i += sizeof (PTRACE_XFER_TYPE))
{
errno = 0;
else
collect_register (regcache, regno, buf);
- pid = lwpid_of (current_inferior);
+ pid = lwpid_of (current_thread);
for (i = 0; i < size; i += sizeof (PTRACE_XFER_TYPE))
{
errno = 0;
static int
linux_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
{
- int pid = lwpid_of (current_inferior);
+ int pid = lwpid_of (current_thread);
register PTRACE_XFER_TYPE *buffer;
register CORE_ADDR addr;
register int count;
register PTRACE_XFER_TYPE *buffer = (PTRACE_XFER_TYPE *)
alloca (count * sizeof (PTRACE_XFER_TYPE));
- int pid = lwpid_of (current_inferior);
+ int pid = lwpid_of (current_thread);
if (len == 0)
{
{
int lwpid;
- lwpid = lwpid_of (current_inferior);
+ lwpid = lwpid_of (current_thread);
kill_lwp (lwpid, SIGINT);
}
else
{
char filename[PATH_MAX];
int fd, n;
- int pid = lwpid_of (current_inferior);
+ int pid = lwpid_of (current_thread);
xsnprintf (filename, sizeof filename, "/proc/%d/auxv", pid);
static int
linux_stopped_by_watchpoint (void)
{
- struct lwp_info *lwp = get_thread_lwp (current_inferior);
+ struct lwp_info *lwp = get_thread_lwp (current_thread);
return lwp->stopped_by_watchpoint;
}
static CORE_ADDR
linux_stopped_data_address (void)
{
- struct lwp_info *lwp = get_thread_lwp (current_inferior);
+ struct lwp_info *lwp = get_thread_lwp (current_thread);
return lwp->stopped_data_address;
}
linux_read_offsets (CORE_ADDR *text_p, CORE_ADDR *data_p)
{
unsigned long text, text_end, data;
- int pid = lwpid_of (get_thread_lwp (current_inferior));
+ int pid = lwpid_of (get_thread_lwp (current_thread));
errno = 0;
siginfo_t siginfo;
char inf_siginfo[sizeof (siginfo_t)];
- if (current_inferior == NULL)
+ if (current_thread == NULL)
return -1;
- pid = lwpid_of (current_inferior);
+ pid = lwpid_of (current_thread);
if (debug_threads)
debug_printf ("%s siginfo for lwp %d.\n",
unsigned const char *writebuf,
CORE_ADDR offset, int len)
{
- long pid = lwpid_of (current_inferior);
+ long pid = lwpid_of (current_thread);
char buf[128];
int fd = 0;
int ret = 0;
linux_read_loadmap (const char *annex, CORE_ADDR offset,
unsigned char *myaddr, unsigned int len)
{
- int pid = lwpid_of (current_inferior);
+ int pid = lwpid_of (current_thread);
int addr = -1;
struct target_loadmap *data = NULL;
unsigned int actual_length, copy_length;
if (readbuf == NULL)
return -1;
- pid = lwpid_of (current_inferior);
+ pid = lwpid_of (current_thread);
xsnprintf (filename, sizeof filename, "/proc/%d/exe", pid);
is_elf64 = elf_64_file_p (filename, &machine);
lmo = is_elf64 ? &lmo_64bit_offsets : &lmo_32bit_offsets;
{
if (have_dsp < 0)
{
- int pid = lwpid_of (current_inferior);
+ int pid = lwpid_of (current_thread);
errno = 0;
ptrace (PTRACE_PEEKUSER, pid, DSP_CONTROL, 0);
static CORE_ADDR
mips_reinsert_addr (void)
{
- struct regcache *regcache = get_thread_regcache (current_inferior, 1);
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
union mips_register ra;
collect_register_by_name (regcache, "r31", ra.buf);
return register_size (regcache->tdesc, 0) == 4 ? ra.reg32 : ra.reg64;
enum target_hw_bp_type watch_type;
uint32_t irw;
- lwpid = lwpid_of (current_inferior);
+ lwpid = lwpid_of (current_thread);
if (!mips_linux_read_watch_registers (lwpid,
&private->watch_readback,
&private->watch_readback_valid,
struct arch_process_info *private = proc->private->arch_private;
int n;
int num_valid;
- long lwpid = lwpid_of (current_inferior);
+ long lwpid = lwpid_of (current_thread);
if (!mips_linux_read_watch_registers (lwpid,
&private->watch_readback,
struct arch_process_info *private = proc->private->arch_private;
int n;
int num_valid;
- long lwpid = lwpid_of (current_inferior);
+ long lwpid = lwpid_of (current_thread);
/* On MIPS we don't know the low order 3 bits of the data address.
GDB does not support remote targets that can't report the
nios2_reinsert_addr (void)
{
union nios2_register ra;
- struct regcache *regcache = get_thread_regcache (current_inferior, 1);
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
collect_register_by_name (regcache, "ra", ra.buf);
return ra.reg32;
struct regset_info *regset;
/* Check whether the kernel supports extra register sets. */
- int pid = pid_of (current_inferior);
+ int pid = pid_of (current_thread);
int have_regset_last_break
= s390_check_regset (pid, NT_S390_LAST_BREAK, 8);
int have_regset_system_call
static CORE_ADDR
sparc_reinsert_addr (void)
{
- struct regcache *regcache = get_thread_regcache (current_inferior, 1);
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
CORE_ADDR lr;
/* O7 is the equivalent to the 'lr' of other archs. */
collect_register_by_name (regcache, "o7", &lr);
static void
tile_arch_setup (void)
{
- int pid = pid_of (current_inferior);
+ int pid = pid_of (current_thread);
unsigned int machine;
int is_elf64 = linux_pid_exe_is_elf_64_file (pid, &machine);
static int
is_64bit_tdesc (void)
{
- struct regcache *regcache = get_thread_regcache (current_inferior, 0);
+ struct regcache *regcache = get_thread_regcache (current_thread, 0);
return register_size (regcache->tdesc, 0) == 8;
}
x86_dr_low_set_addr (int regnum, CORE_ADDR addr)
{
/* Only update the threads of this process. */
- int pid = pid_of (current_inferior);
+ int pid = pid_of (current_thread);
gdb_assert (DR_FIRSTADDR <= regnum && regnum <= DR_LASTADDR);
static CORE_ADDR
x86_dr_low_get_addr (int regnum)
{
- ptid_t ptid = ptid_of (current_inferior);
+ ptid_t ptid = ptid_of (current_thread);
gdb_assert (DR_FIRSTADDR <= regnum && regnum <= DR_LASTADDR);
x86_dr_low_set_control (unsigned long control)
{
/* Only update the threads of this process. */
- int pid = pid_of (current_inferior);
+ int pid = pid_of (current_thread);
find_inferior (&all_threads, update_debug_registers_callback, &pid);
}
static unsigned long
x86_dr_low_get_control (void)
{
- ptid_t ptid = ptid_of (current_inferior);
+ ptid_t ptid = ptid_of (current_thread);
return x86_linux_dr_get (ptid, DR_CONTROL);
}
static unsigned long
x86_dr_low_get_status (void)
{
- ptid_t ptid = ptid_of (current_inferior);
+ ptid_t ptid = ptid_of (current_thread);
return x86_linux_dr_get (ptid, DR_STATUS);
}
{
#ifdef __x86_64__
unsigned int machine;
- int tid = lwpid_of (current_inferior);
+ int tid = lwpid_of (current_thread);
int is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine);
/* Is the inferior 32-bit? If so, then fixup the siginfo object. */
static uint64_t xcr0;
struct regset_info *regset;
- tid = lwpid_of (current_inferior);
+ tid = lwpid_of (current_thread);
is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine);
int pid = ptid_get_pid (entry->id);
/* Look up any thread of this processes. */
- current_inferior
+ current_thread
= (struct thread_info *) find_inferior (&all_threads,
same_process_callback, &pid);
static void
x86_linux_update_xmltarget (void)
{
- struct thread_info *save_inferior = current_inferior;
+ struct thread_info *saved_thread = current_thread;
/* Before changing the register cache's internal layout, flush the
contents of the current valid caches back to the threads, and
for_each_inferior (&all_processes, x86_arch_setup_process_callback);
- current_inferior = save_inferior;
+ current_thread = saved_thread;
}
/* Process qSupported query, "xmlRegisters=". Update the buffer size for
/* The ptid might still be minus_one_ptid; this can happen between
the moment we create the inferior or attach to a process, and
the moment we resume its execution for the first time. It is
- fine to use the current_inferior's ptid in those cases. */
+ fine to use the current_thread's ptid in those cases. */
if (ptid_equal (ptid, minus_one_ptid))
- ptid = thread_to_gdb_id (current_inferior);
+ ptid = thread_to_gdb_id (current_thread);
regcache_invalidate ();
ptid_t new_ptid;
if (ptid_equal (ptid, minus_one_ptid))
- pid = lynx_ptid_get_pid (thread_to_gdb_id (current_inferior));
+ pid = lynx_ptid_get_pid (thread_to_gdb_id (current_thread));
else
pid = BUILDPID (lynx_ptid_get_pid (ptid), lynx_ptid_get_tid (ptid));
lynx_fetch_registers (struct regcache *regcache, int regno)
{
struct lynx_regset_info *regset = lynx_target_regsets;
- ptid_t inferior_ptid = thread_to_gdb_id (current_inferior);
+ ptid_t inferior_ptid = thread_to_gdb_id (current_thread);
lynx_debug ("lynx_fetch_registers (regno = %d)", regno);
lynx_store_registers (struct regcache *regcache, int regno)
{
struct lynx_regset_info *regset = lynx_target_regsets;
- ptid_t inferior_ptid = thread_to_gdb_id (current_inferior);
+ ptid_t inferior_ptid = thread_to_gdb_id (current_thread);
lynx_debug ("lynx_store_registers (regno = %d)", regno);
int buf;
const int xfer_size = sizeof (buf);
CORE_ADDR addr = memaddr & -(CORE_ADDR) xfer_size;
- ptid_t inferior_ptid = thread_to_gdb_id (current_inferior);
+ ptid_t inferior_ptid = thread_to_gdb_id (current_thread);
while (addr < memaddr + len)
{
int buf;
const int xfer_size = sizeof (buf);
CORE_ADDR addr = memaddr & -(CORE_ADDR) xfer_size;
- ptid_t inferior_ptid = thread_to_gdb_id (current_inferior);
+ ptid_t inferior_ptid = thread_to_gdb_id (current_thread);
while (addr < memaddr + len)
{
static void
lynx_request_interrupt (void)
{
- ptid_t inferior_ptid = thread_to_gdb_id (current_inferior);
+ ptid_t inferior_ptid = thread_to_gdb_id (current_thread);
kill (lynx_ptid_get_pid (inferior_ptid), SIGINT);
}
*err = 1;
return 0;
}
- else if (current_inferior == NULL)
+ else if (current_thread == NULL)
{
*err = -1;
return 0;
if (bp->cond_list == NULL)
return 1;
- ctx.regcache = get_thread_regcache (current_inferior, 1);
+ ctx.regcache = get_thread_regcache (current_thread, 1);
ctx.tframe = NULL;
ctx.tpoint = NULL;
if (bp == NULL)
return 1;
- ctx.regcache = get_thread_regcache (current_inferior, 1);
+ ctx.regcache = get_thread_regcache (current_thread, 1);
ctx.tframe = NULL;
ctx.tpoint = NULL;
if (regno >= the_low_target.num_regs)
return;
- if (current_inferior == NULL)
+ if (current_thread == NULL)
{
- TRACE ("current_inferior is NULL\n");
+ TRACE ("current_thread is NULL\n");
return;
}
- ptid = thread_to_gdb_id (current_inferior);
+ ptid = thread_to_gdb_id (current_thread);
if (!nto_set_thread (ptid))
return;
TRACE ("%s (regno:%d)\n", __func__, regno);
- if (current_inferior == NULL)
+ if (current_thread == NULL)
{
- TRACE ("current_inferior is NULL\n");
+ TRACE ("current_thread is NULL\n");
return;
}
- ptid = thread_to_gdb_id (current_inferior);
+ ptid = thread_to_gdb_id (current_thread);
if (!nto_set_thread (ptid))
return;
int ret = 0;
TRACE ("%s\n", __func__);
- if (nto_inferior.ctl_fd != -1 && current_inferior != NULL)
+ if (nto_inferior.ctl_fd != -1 && current_thread != NULL)
{
ptid_t ptid;
- ptid = thread_to_gdb_id (current_inferior);
+ ptid = thread_to_gdb_id (current_thread);
if (nto_set_thread (ptid))
{
const int watchmask = _DEBUG_FLAG_TRACE_RD | _DEBUG_FLAG_TRACE_WR
CORE_ADDR ret = (CORE_ADDR)0;
TRACE ("%s\n", __func__);
- if (nto_inferior.ctl_fd != -1 && current_inferior != NULL)
+ if (nto_inferior.ctl_fd != -1 && current_thread != NULL)
{
ptid_t ptid;
- ptid = thread_to_gdb_id (current_inferior);
+ ptid = thread_to_gdb_id (current_thread);
if (nto_set_thread (ptid))
{
{
#ifdef HAVE_REGSETS
struct lwp_info *lwp;
- struct thread_info *reg_inferior, *save_inferior;
+ struct thread_info *reg_thread, *saved_thread;
struct regcache *regcache;
lwp = find_lwp_pid (pid_to_ptid (lwpid));
if (lwp == NULL)
return PS_ERR;
- reg_inferior = get_lwp_thread (lwp);
- save_inferior = current_inferior;
- current_inferior = reg_inferior;
- regcache = get_thread_regcache (current_inferior, 1);
+ reg_thread = get_lwp_thread (lwp);
+ saved_thread = current_thread;
+ current_thread = reg_thread;
+ regcache = get_thread_regcache (current_thread, 1);
gregset_info ()->fill_function (regcache, gregset);
- current_inferior = save_inferior;
+ current_thread = saved_thread;
return PS_OK;
#else
return PS_ERR;
pid_t
ps_getpid (gdb_ps_prochandle_t ph)
{
- return pid_of (current_inferior);
+ return pid_of (current_thread);
}
if (fetch && regcache->registers_valid == 0)
{
- struct thread_info *saved_inferior = current_inferior;
+ struct thread_info *saved_thread = current_thread;
- current_inferior = thread;
+ current_thread = thread;
fetch_inferior_registers (regcache, -1);
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
regcache->registers_valid = 1;
}
if (regcache->registers_valid)
{
- struct thread_info *saved_inferior = current_inferior;
+ struct thread_info *saved_thread = current_thread;
- current_inferior = thread;
+ current_thread = thread;
store_inferior_registers (regcache, -1);
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
}
regcache->registers_valid = 0;
regcache_invalidate (void)
{
/* Only update the threads of the current process. */
- int pid = ptid_get_pid (current_inferior->entry.id);
+ int pid = ptid_get_pid (current_thread->entry.id);
find_inferior (&all_threads, regcache_invalidate_one, &pid);
}
}
/* Check for an input interrupt while we're here. */
- if (cc == '\003' && current_inferior != NULL)
+ if (cc == '\003' && current_thread != NULL)
(*the_target->request_interrupt) ();
}
while (cc != '+');
cc = read_prim (&c, 1);
- if (cc != 1 || c != '\003' || current_inferior == NULL)
+ if (cc != 1 || c != '\003' || current_thread == NULL)
{
fprintf (stderr, "input_interrupt, count = %d c = %d ('%c')\n",
cc, c, c);
{
case TARGET_WAITKIND_STOPPED:
{
- struct thread_info *saved_inferior;
+ struct thread_info *saved_thread;
const char **regp;
struct regcache *regcache;
sprintf (buf, "T%02x", status->value.sig);
buf += strlen (buf);
- saved_inferior = current_inferior;
+ saved_thread = current_thread;
- current_inferior = find_thread_ptid (ptid);
+ current_thread = find_thread_ptid (ptid);
regp = current_target_desc ()->expedite_regs;
- regcache = get_thread_regcache (current_inferior, 1);
+ regcache = get_thread_regcache (current_thread, 1);
if (the_target->stopped_by_watchpoint != NULL
&& (*the_target->stopped_by_watchpoint) ())
dlls_changed = 0;
}
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
}
break;
case TARGET_WAITKIND_EXITED:
if (last_status.kind != TARGET_WAITKIND_STOPPED)
return signal_pid;
- current_inferior->last_resume_kind = resume_stop;
- current_inferior->last_status = last_status;
+ current_thread->last_resume_kind = resume_stop;
+ current_thread->last_status = last_status;
}
while (last_status.value.sig != GDB_SIGNAL_TRAP);
if (last_status.kind != TARGET_WAITKIND_EXITED
&& last_status.kind != TARGET_WAITKIND_SIGNALLED)
{
- current_inferior->last_resume_kind = resume_stop;
- current_inferior->last_status = last_status;
+ current_thread->last_resume_kind = resume_stop;
+ current_thread->last_status = last_status;
}
return signal_pid;
&& last_status.value.sig == GDB_SIGNAL_STOP)
last_status.value.sig = GDB_SIGNAL_TRAP;
- current_inferior->last_resume_kind = resume_stop;
- current_inferior->last_status = last_status;
+ current_thread->last_resume_kind = resume_stop;
+ current_thread->last_status = last_status;
}
return 0;
cont_thread = resume_info[0].thread;
else
cont_thread = minus_one_ptid;
- set_desired_inferior (0);
+ set_desired_thread (0);
resume (resume_info, n);
free (resume_info);
if (last_status.kind != TARGET_WAITKIND_EXITED
&& last_status.kind != TARGET_WAITKIND_SIGNALLED
&& last_status.kind != TARGET_WAITKIND_NO_RESUMED)
- current_inferior->last_status = last_status;
+ current_thread->last_status = last_status;
/* From the client's perspective, all-stop mode always stops all
threads implicitly (and the target backend has already done
return;
}
-/* Resume inferior and wait for another event. In non-stop mode,
+/* Resume thread and wait for another event. In non-stop mode,
don't really wait here, but return immediatelly to the event
loop. */
static void
int n = 0;
int valid_cont_thread;
- set_desired_inferior (0);
+ set_desired_thread (0);
valid_cont_thread = (!ptid_equal (cont_thread, null_ptid)
&& !ptid_equal (cont_thread, minus_one_ptid));
/* GDB assumes the current thread is the thread we're
reporting the status for. */
general_thread = thread->id;
- set_desired_inferior (1);
+ set_desired_thread (1);
gdb_assert (tp->last_status.kind != TARGET_WAITKIND_IGNORE);
prepare_resume_reply (own_buf, tp->entry.id, &tp->last_status);
last_status.value.integer = 0;
last_ptid = pid_to_ptid (pid);
- current_inferior = NULL;
+ current_thread = NULL;
}
else
{
}
general_thread = thread_id;
- set_desired_inferior (1);
+ set_desired_thread (1);
}
else if (own_buf[1] == 'c')
cont_thread = thread_id;
{
struct regcache *regcache;
- set_desired_inferior (1);
- regcache = get_thread_regcache (current_inferior, 1);
+ set_desired_thread (1);
+ regcache = get_thread_regcache (current_thread, 1);
registers_to_string (regcache, own_buf);
}
break;
{
struct regcache *regcache;
- set_desired_inferior (1);
- regcache = get_thread_regcache (current_inferior, 1);
+ set_desired_thread (1);
+ regcache = get_thread_regcache (current_thread, 1);
registers_from_string (regcache, &own_buf[1]);
write_ok (own_buf);
}
if (process_serial_event () < 0)
return -1;
- /* Be sure to not change the selected inferior behind GDB's back.
+ /* Be sure to not change the selected thread behind GDB's back.
Important in the non-stop mode asynchronous protocol. */
- set_desired_inferior (1);
+ set_desired_thread (1);
return 0;
}
/* We're reporting this thread as stopped. Update its
"want-stopped" state to what the client wants, until it
gets a new resume action. */
- current_inferior->last_resume_kind = resume_stop;
- current_inferior->last_status = last_status;
+ current_thread->last_resume_kind = resume_stop;
+ current_thread->last_status = last_status;
}
if (forward_event)
}
}
- /* Be sure to not change the selected inferior behind GDB's back.
+ /* Be sure to not change the selected thread behind GDB's back.
Important in the non-stop mode asynchronous protocol. */
- set_desired_inferior (1);
+ set_desired_thread (1);
return 0;
}
struct target_ops *the_target;
void
-set_desired_inferior (int use_general)
+set_desired_thread (int use_general)
{
struct thread_info *found;
found = find_thread_ptid (cont_thread);
if (found == NULL)
- current_inferior = get_first_thread ();
+ current_thread = get_first_thread ();
else
- current_inferior = found;
+ current_thread = found;
}
int
int write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
int len);
-void set_desired_inferior (int id);
+void set_desired_thread (int id);
const char *target_pid_to_str (ptid_t);
const struct target_desc *
current_target_desc (void)
{
- if (current_inferior == NULL)
+ if (current_thread == NULL)
return &default_description;
return current_process ()->tdesc;
/* If we do not know about the main thread yet, this would be a good time to
find it. We need to do this to pick up the main thread before any newly
created threads. */
- lwp = get_thread_lwp (current_inferior);
+ lwp = get_thread_lwp (current_thread);
if (lwp->thread_known == 0)
- find_one_thread (current_inferior->entry.id);
+ find_one_thread (current_thread->entry.id);
/* msg.event == TD_EVENT_CREATE */
psaddr_t addr;
td_err_e err;
struct lwp_info *lwp;
- struct thread_info *saved_inferior;
+ struct thread_info *saved_thread;
struct process_info *proc;
struct thread_db *thread_db;
if (!lwp->thread_known)
return TD_NOTHR;
- saved_inferior = current_inferior;
- current_inferior = thread;
+ saved_thread = current_thread;
+ current_thread = thread;
if (load_module != 0)
{
addr = (char *) addr + offset;
}
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
if (err == TD_OK)
{
*address = (CORE_ADDR) (uintptr_t) addr;
{
int pid = pid_of (proc);
- current_inferior =
+ current_thread =
(struct thread_info *) find_inferior (&all_threads,
any_thread_of, &pid);
}
if (td_ta_clear_event_p != NULL)
{
- struct thread_info *saved_inferior = current_inferior;
+ struct thread_info *saved_thread = current_thread;
td_thr_events_t events;
switch_to_process (proc);
td_event_fillset (&events);
(*td_ta_clear_event_p) (thread_db->thread_agent, &events);
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
}
}
}
if (thread_db->td_create_bp != NULL)
{
- struct thread_info *saved_inferior = current_inferior;
+ struct thread_info *saved_thread = current_thread;
switch_to_process (proc);
delete_breakpoint (thread_db->td_create_bp);
thread_db->td_create_bp = NULL;
- current_inferior = saved_inferior;
+ current_thread = saved_thread;
}
}
if (!maybe_write_ipa_not_loaded (buf))
{
- struct thread_info *save_inferior;
+ struct thread_info *saved_thread;
- save_inferior = current_inferior;
+ saved_thread = current_thread;
/* Find any thread which belongs to process PID. */
- current_inferior = (struct thread_info *)
+ current_thread = (struct thread_info *)
find_inferior (&all_threads, same_process_p, &pid);
strcpy (buf, "close");
run_inferior_command (buf, strlen (buf) + 1);
- current_inferior = save_inferior;
+ current_thread = saved_thread;
}
}
static void
cmd_qtminftpilen (char *packet)
{
- if (current_inferior == NULL)
+ if (current_thread == NULL)
{
/* Indicate that the minimum length is currently unknown. */
strcpy (packet, "0");
/* Sleep endlessly to wait the whole inferior stops. This
thread can not exit because GDB or GDBserver may still need
- 'current_inferior' (representing this thread) to access
+ 'current_thread' (representing this thread) to access
inferior memory. Otherwise, this thread exits earlier than
- other threads, and 'current_inferior' is set to NULL. */
+ other threads, and 'current_thread' is set to NULL. */
while (1)
sleep (10);
}
/* Get the thread ID from the current selected inferior (the current
thread). */
static ptid_t
-current_inferior_ptid (void)
+current_thread_ptid (void)
{
return current_ptid;
}
child_fetch_inferior_registers (struct regcache *regcache, int r)
{
int regno;
- win32_thread_info *th = thread_rec (current_inferior_ptid (), TRUE);
+ win32_thread_info *th = thread_rec (current_thread_ptid (), TRUE);
if (r == -1 || r > NUM_REGS)
child_fetch_inferior_registers (regcache, NUM_REGS);
else
child_store_inferior_registers (struct regcache *regcache, int r)
{
int regno;
- win32_thread_info *th = thread_rec (current_inferior_ptid (), TRUE);
+ win32_thread_info *th = thread_rec (current_thread_ptid (), TRUE);
if (r == -1 || r == 0 || r > NUM_REGS)
child_store_inferior_registers (regcache, NUM_REGS);
else
child_delete_thread (current_event.dwProcessId,
current_event.dwThreadId);
- current_inferior = (struct thread_info *) all_threads.head;
+ current_thread = (struct thread_info *) all_threads.head;
return 1;
case CREATE_PROCESS_DEBUG_EVENT:
}
ptid = debug_event_ptid (¤t_event);
- current_inferior =
+ current_thread =
(struct thread_info *) find_inferior_id (&all_threads, ptid);
return 1;
}
OUTMSG2 (("Child Stopped with signal = %d \n",
ourstatus->value.sig));
- regcache = get_thread_regcache (current_inferior, 1);
+ regcache = get_thread_regcache (current_thread, 1);
child_fetch_inferior_registers (regcache, -1);
return debug_event_ptid (¤t_event);
default: