Rename current_inferior as current_thread in gdbserver

GDB has a function named "current_inferior" and gdbserver has a global
variable named "current_inferior", but the two are not equivalent;
indeed, gdbserver does not have any real equivalent of what GDB calls
an inferior.  What gdbserver's "current_inferior" is actually pointing
to is a structure describing the current thread.  This commit renames
current_inferior as current_thread in gdbserver to clarify this.  It
also renames the function "set_desired_inferior" to "set_desired_thread"
and renames various local variables from foo_inferior to foo_thread.

gdb/gdbserver/ChangeLog:

	* 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.
This commit is contained in:
Gary Benson 2014-09-10 10:37:11 +01:00
parent 635856f584
commit 0bfdf32fa1
28 changed files with 277 additions and 245 deletions

View file

@ -111,7 +111,7 @@ static void win32_add_all_dlls (void);
/* 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;
}
@ -461,7 +461,7 @@ static void
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
@ -475,7 +475,7 @@ static void
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
@ -1461,7 +1461,7 @@ get_child_debug_event (struct target_waitstatus *ourstatus)
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:
@ -1563,7 +1563,7 @@ get_child_debug_event (struct target_waitstatus *ourstatus)
}
ptid = debug_event_ptid (&current_event);
current_inferior =
current_thread =
(struct thread_info *) find_inferior_id (&all_threads, ptid);
return 1;
}
@ -1604,7 +1604,7 @@ win32_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options)
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 (&current_event);
default: