0bfdf32fa1
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.
85 lines
2.9 KiB
C
85 lines
2.9 KiB
C
/* Multi-thread control defs for remote server for GDB.
|
|
Copyright (C) 1993-2014 Free Software Foundation, Inc.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#ifndef GDB_THREAD_H
|
|
#define GDB_THREAD_H
|
|
|
|
#include "inferiors.h"
|
|
|
|
struct btrace_target_info;
|
|
|
|
struct thread_info
|
|
{
|
|
/* This must appear first. See inferiors.h.
|
|
The list iterator functions assume it. */
|
|
struct inferior_list_entry entry;
|
|
|
|
void *target_data;
|
|
void *regcache_data;
|
|
|
|
/* The last resume GDB requested on this thread. */
|
|
enum resume_kind last_resume_kind;
|
|
|
|
/* The last wait status reported for this thread. */
|
|
struct target_waitstatus last_status;
|
|
|
|
/* True if LAST_STATUS hasn't been reported to GDB yet. */
|
|
int status_pending_p;
|
|
|
|
/* Given `while-stepping', a thread may be collecting data for more
|
|
than one tracepoint simultaneously. E.g.:
|
|
|
|
ff0001 INSN1 <-- TP1, while-stepping 10 collect $regs
|
|
ff0002 INSN2
|
|
ff0003 INSN3 <-- TP2, collect $regs
|
|
ff0004 INSN4 <-- TP3, while-stepping 10 collect $regs
|
|
ff0005 INSN5
|
|
|
|
Notice that when instruction INSN5 is reached, the while-stepping
|
|
actions of both TP1 and TP3 are still being collected, and that TP2
|
|
had been collected meanwhile. The whole range of ff0001-ff0005
|
|
should be single-stepped, due to at least TP1's while-stepping
|
|
action covering the whole range.
|
|
|
|
On the other hand, the same tracepoint with a while-stepping action
|
|
may be hit by more than one thread simultaneously, hence we can't
|
|
keep the current step count in the tracepoint itself.
|
|
|
|
This is the head of the list of the states of `while-stepping'
|
|
tracepoint actions this thread is now collecting; NULL if empty.
|
|
Each item in the list holds the current step of the while-stepping
|
|
action. */
|
|
struct wstep_state *while_stepping;
|
|
|
|
/* Branch trace target information for this thread. */
|
|
struct btrace_target_info *btrace;
|
|
};
|
|
|
|
extern struct inferior_list all_threads;
|
|
|
|
void remove_thread (struct thread_info *thread);
|
|
struct thread_info *add_thread (ptid_t ptid, void *target_data);
|
|
|
|
struct thread_info *get_first_thread (void);
|
|
|
|
struct thread_info *find_thread_ptid (ptid_t ptid);
|
|
|
|
/* Get current thread ID (Linux task ID). */
|
|
#define current_ptid (current_thread->entry.id)
|
|
|
|
#endif /* GDB_THREAD_H */
|