From 0bfdf32fa101021ad0d11dd3ae945c823f4b07ac Mon Sep 17 00:00:00 2001 From: Gary Benson <gbenson@redhat.com> Date: Wed, 10 Sep 2014 10:37:11 +0100 Subject: 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. --- gdb/gdbserver/remote-utils.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gdb/gdbserver/remote-utils.c') diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index 81b9af3..373fc15 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -686,7 +686,7 @@ putpkt_binary_1 (char *buf, int cnt, int is_notif) } /* 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 != '+'); @@ -741,7 +741,7 @@ input_interrupt (int unused) 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); @@ -1106,20 +1106,20 @@ prepare_resume_reply (char *buf, ptid_t ptid, { 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) ()) @@ -1196,7 +1196,7 @@ prepare_resume_reply (char *buf, ptid_t ptid, dlls_changed = 0; } - current_inferior = saved_inferior; + current_thread = saved_thread; } break; case TARGET_WAITKIND_EXITED: -- cgit v1.1