GDB (xrefs)
Classes | Functions | Variables
/tmp/gdb-7.10/gdb/thread.c File Reference
#include "defs.h"
#include "symtab.h"
#include "frame.h"
#include "inferior.h"
#include "environ.h"
#include "value.h"
#include "target.h"
#include "gdbthread.h"
#include "command.h"
#include "gdbcmd.h"
#include "regcache.h"
#include "gdb.h"
#include "btrace.h"
#include <ctype.h>
#include <sys/types.h>
#include <signal.h>
#include "ui-out.h"
#include "observer.h"
#include "annotate.h"
#include "cli/cli-decode.h"
#include "gdb_regex.h"
#include "cli/cli-utils.h"
#include "continuations.h"

Go to the source code of this file.

Classes

struct  thread_array_cleanup
 
struct  current_thread_cleanup
 

Functions

void _initialize_thread (void)
 
static void thread_apply_all_command (char *, int)
 
static int thread_alive (struct thread_info *)
 
static void info_threads_command (char *, int)
 
static void thread_apply_command (char *, int)
 
static void restore_current_thread (ptid_t)
 
struct thread_infoinferior_thread (void)
 
static void delete_thread_breakpoint (struct breakpoint **bp_p)
 
void delete_step_resume_breakpoint (struct thread_info *tp)
 
void delete_exception_resume_breakpoint (struct thread_info *tp)
 
void delete_single_step_breakpoints (struct thread_info *tp)
 
static void delete_at_next_stop (struct breakpoint **bp)
 
int thread_has_single_step_breakpoints_set (struct thread_info *tp)
 
int thread_has_single_step_breakpoint_here (struct thread_info *tp, struct address_space *aspace, CORE_ADDR addr)
 
static void clear_thread_inferior_resources (struct thread_info *tp)
 
static void free_thread (struct thread_info *tp)
 
void init_thread_list (void)
 
static struct thread_infonew_thread (ptid_t ptid)
 
struct thread_infoadd_thread_silent (ptid_t ptid)
 
struct thread_infoadd_thread_with_info (ptid_t ptid, struct private_thread_info *priv)
 
struct thread_infoadd_thread (ptid_t ptid)
 
static void delete_thread_1 (ptid_t ptid, int silent)
 
void delete_thread (ptid_t ptid)
 
void delete_thread_silent (ptid_t ptid)
 
struct thread_infofind_thread_id (int num)
 
struct thread_infofind_thread_ptid (ptid_t ptid)
 
struct thread_infoiterate_over_threads (int(*callback)(struct thread_info *, void *), void *data)
 
int thread_count (void)
 
int valid_thread_id (int num)
 
int pid_to_thread_id (ptid_t ptid)
 
ptid_t thread_id_to_pid (int num)
 
int in_thread_list (ptid_t ptid)
 
struct thread_infofirst_thread_of_process (int pid)
 
struct thread_infoany_thread_of_process (int pid)
 
struct thread_infoany_live_thread_of_process (int pid)
 
static int do_captured_list_thread_ids (struct ui_out *uiout, void *arg)
 
enum gdb_rc gdb_list_thread_ids (struct ui_out *uiout, char **error_message)
 
void prune_threads (void)
 
void delete_exited_threads (void)
 
static void disable_thread_stack_temporaries (void *data)
 
struct cleanupenable_thread_stack_temporaries (ptid_t ptid)
 
int thread_stack_temporaries_enabled_p (ptid_t ptid)
 
void push_thread_stack_temporary (ptid_t ptid, struct value *v)
 
int value_in_thread_stack_temporaries (struct value *val, ptid_t ptid)
 
struct valueget_last_thread_stack_temporary (ptid_t ptid)
 
void thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid)
 
void set_running (ptid_t ptid, int running)
 
static int is_thread_state (ptid_t ptid, enum thread_state state)
 
int is_stopped (ptid_t ptid)
 
int is_exited (ptid_t ptid)
 
int is_running (ptid_t ptid)
 
int is_executing (ptid_t ptid)
 
void set_executing (ptid_t ptid, int executing)
 
int threads_are_executing (void)
 
void set_stop_requested (ptid_t ptid, int stop)
 
void finish_thread_state (ptid_t ptid)
 
void finish_thread_state_cleanup (void *arg)
 
int pc_in_thread_step_range (CORE_ADDR pc, struct thread_info *thread)
 
void print_thread_info (struct ui_out *uiout, char *requested_threads, int pid)
 
void switch_to_thread (ptid_t ptid)
 
static void restore_selected_frame (struct frame_id a_frame_id, int frame_level)
 
static void do_restore_current_thread_cleanup (void *arg)
 
static void restore_current_thread_cleanup_dtor (void *arg)
 
static void set_thread_refcount (void *data)
 
struct cleanupmake_cleanup_restore_current_thread (void)
 
static int tp_array_compar (const void *ap_voidp, const void *bp_voidp)
 
void thread_command (char *tidstr, int from_tty)
 
static void thread_name_command (char *arg, int from_tty)
 
static void thread_find_command (char *arg, int from_tty)
 
static void show_print_thread_events (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static int do_captured_thread_select (struct ui_out *uiout, void *tidstr)
 
enum gdb_rc gdb_thread_select (struct ui_out *uiout, char *tidstr, char **error_message)
 
static void update_threads_executing (void)
 
void update_thread_list (void)
 
static struct valuethread_id_make_value (struct gdbarch *gdbarch, struct internalvar *var, void *ignore)
 

Variables

struct thread_infothread_list = NULL
 
static int highest_thread_num
 
static int threads_executing
 
static int tp_array_compar_ascending
 
int print_thread_events = 1
 
struct cmd_list_elementthread_cmd_list = NULL
 
static const struct internalvar_funcs thread_funcs
 

Function Documentation

void _initialize_thread ( void  )
struct thread_info* add_thread ( ptid_t  ptid)
struct thread_info* add_thread_silent ( ptid_t  ptid)
struct thread_info* add_thread_with_info ( ptid_t  ptid,
struct private_thread_info priv 
)
struct thread_info* any_live_thread_of_process ( int  pid)
struct thread_info* any_thread_of_process ( int  pid)
static void clear_thread_inferior_resources ( struct thread_info tp)
static
static void delete_at_next_stop ( struct breakpoint **  bp)
static

Definition at line 131 of file thread.c.

References disp_del_at_next_stop.

Referenced by clear_thread_inferior_resources().

void delete_exception_resume_breakpoint ( struct thread_info tp)
void delete_exited_threads ( void  )
void delete_single_step_breakpoints ( struct thread_info tp)
void delete_step_resume_breakpoint ( struct thread_info tp)
void delete_thread ( ptid_t  ptid)
static void delete_thread_1 ( ptid_t  ptid,
int  silent 
)
static
static void delete_thread_breakpoint ( struct breakpoint **  bp_p)
static
void delete_thread_silent ( ptid_t  ptid)
static void disable_thread_stack_temporaries ( void *  data)
static
static int do_captured_list_thread_ids ( struct ui_out uiout,
void *  arg 
)
static
static int do_captured_thread_select ( struct ui_out uiout,
void *  tidstr 
)
static
static void do_restore_current_thread_cleanup ( void *  arg)
static
struct cleanup* enable_thread_stack_temporaries ( ptid_t  ptid)
struct thread_info* find_thread_id ( int  num)
struct thread_info* find_thread_ptid ( ptid_t  ptid)

Definition at line 393 of file thread.c.

References thread_info::next, thread_info::ptid, and ptid_equal().

Referenced by add_thread_silent(), aix_thread_fetch_registers(), aix_thread_resume(), aix_thread_store_registers(), append_resumption(), attach_thread(), bpstat_clear_actions(), continue_command(), darwin_check_new_threads(), delete_checkpoint_command(), demand_private_info(), detach_thread(), disable_thread_stack_temporaries(), displaced_step_prepare(), do_restore_current_thread_cleanup(), enable_thread_stack_temporaries(), exit_lwp(), find_new_threads_callback(), finish_thread_state(), follow_fork(), get_last_thread_stack_temporary(), get_pending_status(), handle_inferior_event_1(), inferior_thread(), infrun_thread_stop_requested_callback(), is_executing(), is_thread_state(), linux_nat_resume_callback(), linux_nat_stop_lwp(), maint_btrace_clear_cmd(), maint_btrace_clear_packet_history_cmd(), maint_btrace_packet_history_cmd(), maint_info_btrace_cmd(), make_cleanup_restore_current_thread(), mi_on_resume(), procfs_update_thread_list(), program_info(), push_thread_stack_temporary(), python_on_normal_stop(), ravenscar_add_thread(), ravenscar_update_inferior_ptid(), record_btrace_fetch_registers(), record_btrace_find_resume_thread(), record_btrace_find_thread_to_move(), record_btrace_frame_sniffer(), record_btrace_info(), record_btrace_tailcall_frame_sniffer(), record_btrace_thread_alive(), remote_core_of_thread(), remote_detach_1(), remote_threads_extra_info(), require_btrace_thread(), restore_current_thread_cleanup_dtor(), run_inferior_call(), set_executing(), set_running(), set_stop_requested(), task_command_1(), thread_change_ptid(), thread_db_get_thread_local_address(), thread_db_pid_to_str(), thread_from_lwp(), thread_id_make_value(), thread_stack_temporaries_enabled_p(), and value_in_thread_stack_temporaries().

void finish_thread_state ( ptid_t  ptid)
void finish_thread_state_cleanup ( void *  arg)
struct thread_info* first_thread_of_process ( int  pid)

Definition at line 497 of file thread.c.

References thread_info::next, thread_info::num, thread_info::ptid, and ptid_get_pid().

Referenced by core_open(), and extended_remote_attach().

static void free_thread ( struct thread_info tp)
static

Definition at line 183 of file thread.c.

References thread_info::name, thread_info::priv, thread_info::private_dtor, and xfree().

Referenced by delete_thread_1(), and init_thread_list().

enum gdb_rc gdb_list_thread_ids ( struct ui_out uiout,
char **  error_message 
)
enum gdb_rc gdb_thread_select ( struct ui_out uiout,
char *  tidstr,
char **  error_message 
)
struct value* get_last_thread_stack_temporary ( ptid_t  ptid)
int in_thread_list ( ptid_t  ptid)
struct thread_info* inferior_thread ( void  )

Definition at line 85 of file thread.c.

References find_thread_ptid(), gdb_assert, and inferior_ptid.

Referenced by any_live_thread_of_process(), any_thread_of_process(), arm_linux_copy_svc(), attach_command_post_wait(), bpstat_do_actions(), breakpoint_about_to_proceed(), call_function_by_hand_dummy(), clear_proceed_status(), displaced_step_fixup(), do_initial_windows_stuff(), do_target_resume(), find_thread_needs_step_over(), finish_backward(), finish_command(), finish_command_continuation(), finish_forward(), follow_exec(), follow_fork(), follow_fork_inferior(), follow_inferior_reset_breakpoints(), for_each_just_stopped_thread(), handle_inferior_event_1(), inferior_event_handler(), infrun_thread_stop_requested_callback(), insert_exception_resume_breakpoint(), insert_exception_resume_from_probe(), insert_longjmp_resume_breakpoint(), insert_single_step_breakpoint(), insert_step_resume_breakpoint_at_sal_1(), linux_child_follow_fork(), mi_about_to_proceed(), mi_execute_command(), mi_on_normal_stop(), mi_on_resume(), normal_stop(), print_signal_received_reason(), print_stop_event(), proceed(), python_on_normal_stop(), queue_signal_command(), record_btrace_stopped_by_hw_breakpoint(), record_btrace_stopped_by_sw_breakpoint(), record_full_resume(), remote_follow_fork(), restore_infcall_control_state(), restore_infcall_suspend_state(), resume(), resume_cleanups(), save_infcall_control_state(), save_infcall_suspend_state(), set_step_frame(), set_step_info(), signal_command(), spu_skip_standalone_loader(), step_1(), step_1_continuation(), step_once(), thread_name_command(), until_break_command(), and until_next_command().

static void info_threads_command ( char *  arg,
int  from_tty 
)
static

Definition at line 1177 of file thread.c.

References current_uiout, and print_thread_info().

Referenced by _initialize_thread().

void init_thread_list ( void  )
int is_executing ( ptid_t  ptid)
int is_exited ( ptid_t  ptid)
int is_running ( ptid_t  ptid)
int is_stopped ( ptid_t  ptid)
static int is_thread_state ( ptid_t  ptid,
enum thread_state  state 
)
static

Definition at line 812 of file thread.c.

References find_thread_ptid(), gdb_assert, and thread_info::state.

Referenced by is_exited(), is_running(), and is_stopped().

struct thread_info* iterate_over_threads ( int(*)(struct thread_info *, void *)  callback,
void *  data 
)
struct cleanup* make_cleanup_restore_current_thread ( void  )
static struct thread_info* new_thread ( ptid_t  ptid)
static
int pc_in_thread_step_range ( CORE_ADDR  pc,
struct thread_info thread 
)
int pid_to_thread_id ( ptid_t  ptid)
void print_thread_info ( struct ui_out uiout,
char *  requested_threads,
int  pid 
)
void prune_threads ( void  )
void push_thread_stack_temporary ( ptid_t  ptid,
struct value v 
)
static void restore_current_thread ( ptid_t  ptid)
static

Definition at line 1218 of file thread.c.

References switch_to_thread().

Referenced by do_restore_current_thread_cleanup().

static void restore_current_thread_cleanup_dtor ( void *  arg)
static
static void restore_selected_frame ( struct frame_id  a_frame_id,
int  frame_level 
)
static
void set_executing ( ptid_t  ptid,
int  executing 
)
void set_running ( ptid_t  ptid,
int  running 
)
void set_stop_requested ( ptid_t  ptid,
int  stop 
)
static void set_thread_refcount ( void *  data)
static
static void show_print_thread_events ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 1655 of file thread.c.

References _, and fprintf_filtered().

Referenced by _initialize_thread().

void switch_to_thread ( ptid_t  ptid)
static int thread_alive ( struct thread_info tp)
static
static void thread_apply_all_command ( char *  cmd,
int  from_tty 
)
static
static void thread_apply_command ( char *  tidlist,
int  from_tty 
)
static
void thread_change_ptid ( ptid_t  old_ptid,
ptid_t  new_ptid 
)
void thread_command ( char *  tidstr,
int  from_tty 
)
int thread_count ( void  )
static void thread_find_command ( char *  arg,
int  from_tty 
)
static
int thread_has_single_step_breakpoint_here ( struct thread_info tp,
struct address_space aspace,
CORE_ADDR  addr 
)
int thread_has_single_step_breakpoints_set ( struct thread_info tp)
static struct value* thread_id_make_value ( struct gdbarch gdbarch,
struct internalvar var,
void *  ignore 
)
static

Definition at line 1745 of file thread.c.

References find_thread_ptid(), inferior_ptid, thread_info::num, and value_from_longest().

ptid_t thread_id_to_pid ( int  num)

Definition at line 471 of file thread.c.

References find_thread_id(), pid_to_ptid(), and thread_info::ptid.

Referenced by set_sig_thread_cmd(), and value_of_root_1().

static void thread_name_command ( char *  arg,
int  from_tty 
)
static
int thread_stack_temporaries_enabled_p ( ptid_t  ptid)
int threads_are_executing ( void  )

Definition at line 880 of file thread.c.

References threads_executing.

Referenced by breakpoints_should_be_inserted_now().

static int tp_array_compar ( const void *  ap_voidp,
const void *  bp_voidp 
)
static

Definition at line 1406 of file thread.c.

Referenced by thread_apply_all_command().

void update_thread_list ( void  )
static void update_threads_executing ( void  )
static

Definition at line 1719 of file thread.c.

References ALL_NON_EXITED_THREADS, thread_info::executing, and threads_executing.

Referenced by update_thread_list().

int valid_thread_id ( int  num)
int value_in_thread_stack_temporaries ( struct value val,
ptid_t  ptid 
)

Variable Documentation

int highest_thread_num
static

Definition at line 56 of file thread.c.

Referenced by init_thread_list(), and new_thread().

int print_thread_events = 1

Definition at line 1653 of file thread.c.

Referenced by add_thread_with_info(), exit_lwp(), procfs_wait(), and windows_delete_thread().

struct cmd_list_element* thread_cmd_list = NULL

Definition at line 1755 of file thread.c.

const struct internalvar_funcs thread_funcs
static
Initial value:
=
{
NULL,
NULL
}
static struct value * thread_id_make_value(struct gdbarch *gdbarch, struct internalvar *var, void *ignore)
Definition: thread.c:1745

Definition at line 1759 of file thread.c.

struct thread_info* thread_list = NULL

Definition at line 55 of file thread.c.

Referenced by darwin_check_new_threads(), new_thread(), and remote_start_remote().

int threads_executing
static
int tp_array_compar_ascending
static

Definition at line 1400 of file thread.c.