GDB (xrefs)
|
#include "defs.h"
#include "arch-utils.h"
#include "inferior.h"
#include "regcache.h"
#include "gdbcmd.h"
#include "infcall.h"
#include "objfiles.h"
#include "gdb_assert.h"
#include "gdb_string.h"
#include "linux-fork.h"
#include "linux-nat.h"
#include "gdbthread.h"
#include "source.h"
#include <sys/ptrace.h>
#include "gdb_wait.h"
#include "gdb_dirent.h"
#include <ctype.h>
Go to the source code of this file.
Classes | |
struct | fork_info |
Functions | |
void | _initialize_linux_fork (void) |
int | forks_exist_p (void) |
struct fork_info * | add_fork (pid_t pid) |
static void | free_fork (struct fork_info *fp) |
static void | delete_fork (ptid_t ptid) |
static struct fork_info * | find_fork_ptid (ptid_t ptid) |
static struct fork_info * | find_fork_id (int num) |
struct fork_info * | find_fork_pid (pid_t pid) |
static ptid_t | fork_id_to_ptid (int num) |
static void | init_fork_list (void) |
static off_t | call_lseek (int fd, off_t offset, int whence) |
static void | fork_load_infrun_state (struct fork_info *fp) |
static void | fork_save_infrun_state (struct fork_info *fp, int clobber_regs) |
void | linux_fork_killall (void) |
void | linux_fork_mourn_inferior (void) |
void | linux_fork_detach (char *args, int from_tty) |
static void | inferior_call_waitpid_cleanup (void *fp) |
static int | inferior_call_waitpid (ptid_t pptid, int pid) |
static void | delete_checkpoint_command (char *args, int from_tty) |
static void | detach_checkpoint_command (char *args, int from_tty) |
static void | info_checkpoints_command (char *arg, int from_tty) |
int | linux_fork_checkpointing_p (int pid) |
static int | inf_has_multiple_thread_cb (struct thread_info *tp, void *data) |
static int | inf_has_multiple_threads (void) |
static void | checkpoint_command (char *args, int from_tty) |
static void | linux_fork_context (struct fork_info *newfp, int from_tty) |
static void | restart_command (char *args, int from_tty) |
Variables | |
struct fork_info * | fork_list |
static int | highest_fork_num |
static int | checkpointing_pid = 0 |
void _initialize_linux_fork | ( | void | ) |
Definition at line 70 of file linux-fork.c.
References add_fork(), fork_list, highest_fork_num, inferior_ptid, fork_info::next, fork_info::num, fork_info::ptid, ptid_build(), ptid_get_pid(), and XZALLOC.
Referenced by add_fork(), and linux_handle_extended_wait().
static off_t call_lseek | ( | int | fd, |
off_t | offset, | ||
int | whence | ||
) | [static] |
Definition at line 225 of file linux-fork.c.
References parse_and_eval_long().
Referenced by fork_load_infrun_state(), and fork_save_infrun_state().
static void checkpoint_command | ( | char * | args, |
int | from_tty | ||
) | [static] |
Definition at line 650 of file linux-fork.c.
References _, call_function_by_hand(), checkpointing_pid, do_cleanups(), error(), find_fork_pid(), find_function_in_inferior(), fork_save_infrun_state(), get_last_target_status(), get_objfile_arch(), inf_has_multiple_threads(), inferior_ptid, info_verbose, lookup_minimal_symbol(), make_cleanup_restore_integer(), fork_info::parent_ptid, printf_filtered(), ptid_get_lwp(), ptid_get_pid(), target_has_execution, update_thread_list(), value_as_long(), and value_from_longest().
static void delete_checkpoint_command | ( | char * | args, |
int | from_tty | ||
) | [static] |
Definition at line 485 of file linux-fork.c.
References _, delete_fork(), error(), find_fork_ptid(), find_thread_ptid(), fork_id_to_ptid(), gdb_assert, inferior_call_waitpid(), inferior_ptid, is_stopped(), minus_one_ptid, fork_info::parent_ptid, parse_and_eval_long(), printf_filtered(), ptid_equal(), ptid_get_pid(), ptrace(), target_pid_to_str(), and warning().
static void delete_fork | ( | ptid_t | ptid | ) | [static] |
Definition at line 118 of file linux-fork.c.
References free_fork(), inferior_ptid, linux_nat_forget_process(), fork_info::next, fork_info::ptid, ptid_equal(), and ptid_get_pid().
Referenced by delete_checkpoint_command(), detach_checkpoint_command(), linux_fork_detach(), and linux_fork_mourn_inferior().
static void detach_checkpoint_command | ( | char * | args, |
int | from_tty | ||
) | [static] |
Definition at line 526 of file linux-fork.c.
References _, delete_fork(), error(), fork_id_to_ptid(), inferior_ptid, minus_one_ptid, parse_and_eval_long(), printf_filtered(), fork_info::ptid, ptid_equal(), ptid_get_pid(), ptrace(), and target_pid_to_str().
static struct fork_info* find_fork_id | ( | int | num | ) | [static, read] |
Definition at line 168 of file linux-fork.c.
References fork_info::next, and fork_info::num.
Referenced by fork_id_to_ptid(), and restart_command().
struct fork_info* find_fork_pid | ( | pid_t | pid | ) | [read] |
Definition at line 181 of file linux-fork.c.
References fork_info::next, fork_info::ptid, and ptid_get_pid().
Referenced by checkpoint_command(), and linux_handle_extended_wait().
static struct fork_info* find_fork_ptid | ( | ptid_t | ptid | ) | [static, read] |
Definition at line 155 of file linux-fork.c.
References fork_info::next, fork_info::ptid, and ptid_equal().
Referenced by delete_checkpoint_command(), inferior_call_waitpid(), and linux_fork_context().
static ptid_t fork_id_to_ptid | ( | int | num | ) | [static] |
Definition at line 193 of file linux-fork.c.
References find_fork_id(), pid_to_ptid(), and fork_info::ptid.
Referenced by delete_checkpoint_command(), and detach_checkpoint_command().
static void fork_load_infrun_state | ( | struct fork_info * | fp | ) | [static] |
Definition at line 237 of file linux-fork.c.
References call_lseek(), fork_info::clobber_regs, fork_info::filepos, get_current_regcache(), linux_nat_switch_fork(), fork_info::maxfd, nullify_last_target_wait_ptid(), fork_info::ptid, regcache_cpy(), regcache_read_pc(), registers_changed(), reinit_frame_cache(), fork_info::savedregs, and stop_pc.
Referenced by inferior_call_waitpid(), inferior_call_waitpid_cleanup(), linux_fork_context(), linux_fork_detach(), and linux_fork_mourn_inferior().
static void fork_save_infrun_state | ( | struct fork_info * | fp, |
int | clobber_regs | ||
) | [static] |
Definition at line 269 of file linux-fork.c.
References call_lseek(), fork_info::clobber_regs, dirent, fork_info::filepos, get_current_regcache(), fork_info::maxfd, fork_info::ptid, ptid_get_pid(), regcache_dup(), regcache_xfree(), fork_info::savedregs, and xrealloc().
Referenced by checkpoint_command(), inferior_call_waitpid(), and linux_fork_context().
int forks_exist_p | ( | void | ) |
Definition at line 62 of file linux-fork.c.
Referenced by linux_nat_detach(), linux_nat_kill(), and linux_nat_mourn_inferior().
Definition at line 93 of file linux-fork.c.
References fork_info::filepos, regcache_xfree(), fork_info::savedregs, and xfree().
Referenced by delete_fork(), and init_fork_list().
static int inf_has_multiple_thread_cb | ( | struct thread_info * | tp, |
void * | data | ||
) | [static] |
Definition at line 627 of file linux-fork.c.
References current_inferior(), inferior::pid, thread_info::ptid, and ptid_get_pid().
Referenced by inf_has_multiple_threads().
static int inf_has_multiple_threads | ( | void | ) | [static] |
Definition at line 641 of file linux-fork.c.
References inf_has_multiple_thread_cb(), and iterate_over_threads().
Referenced by checkpoint_command().
static int inferior_call_waitpid | ( | ptid_t | pptid, |
int | pid | ||
) | [static] |
Definition at line 432 of file linux-fork.c.
References call_function_by_hand(), do_cleanups(), find_fork_ptid(), find_function_in_inferior(), fork_load_infrun_state(), fork_save_infrun_state(), gdb_assert, get_current_arch(), inferior_call_waitpid_cleanup(), inferior_ptid, insert_breakpoints(), lookup_minimal_symbol(), make_cleanup(), ptid_equal(), remove_breakpoints(), value_as_long(), value_from_longest(), and value_from_pointer().
Referenced by delete_checkpoint_command().
static void inferior_call_waitpid_cleanup | ( | void * | fp | ) | [static] |
Definition at line 418 of file linux-fork.c.
References fork_load_infrun_state(), insert_breakpoints(), and remove_breakpoints().
Referenced by inferior_call_waitpid().
static void info_checkpoints_command | ( | char * | arg, |
int | from_tty | ||
) | [static] |
Definition at line 553 of file linux-fork.c.
References _, find_pc_line(), fputs_filtered(), gdb_stdout, get_current_arch(), get_current_regcache(), inferior_ptid, int, symtab_and_line::line, lookup_minimal_symbol_by_pc(), fork_info::next, fork_info::num, paddress(), parse_and_eval_long(), printf_filtered(), fork_info::ptid, ptid_equal(), putchar_filtered(), regcache_read_pc(), fork_info::savedregs, SYMBOL_LINKAGE_NAME, symtab_and_line::symtab, symtab_to_filename_for_display(), target_pid_to_str(), and ULONGEST.
static void init_fork_list | ( | void | ) | [static] |
Definition at line 203 of file linux-fork.c.
References free_fork(), and fork_info::next.
Referenced by linux_fork_killall().
int linux_fork_checkpointing_p | ( | int | pid | ) |
Definition at line 617 of file linux-fork.c.
References checkpointing_pid.
Referenced by linux_handle_extended_wait().
static void linux_fork_context | ( | struct fork_info * | newfp, |
int | from_tty | ||
) | [static] |
Definition at line 717 of file linux-fork.c.
References _, find_fork_ptid(), fork_load_infrun_state(), fork_save_infrun_state(), gdb_assert, get_selected_frame(), inferior_ptid, insert_breakpoints(), print_stack_frame(), printf_filtered(), remove_breakpoints(), SRC_AND_LOC, and target_pid_to_str().
Referenced by restart_command().
void linux_fork_detach | ( | char * | args, |
int | from_tty | ||
) |
Definition at line 390 of file linux-fork.c.
References _, delete_fork(), error(), fork_load_infrun_state(), gdb_assert, inferior_ptid, fork_info::next, printf_filtered(), ptid_get_pid(), ptrace(), and target_pid_to_str().
Referenced by linux_nat_detach().
void linux_fork_killall | ( | void | ) |
Definition at line 324 of file linux-fork.c.
References init_fork_list(), fork_info::next, fork_info::ptid, ptid_get_pid(), and exsummary::status.
Referenced by linux_nat_kill().
void linux_fork_mourn_inferior | ( | void | ) |
Definition at line 356 of file linux-fork.c.
References _, delete_fork(), fork_load_infrun_state(), gdb_assert, inferior_ptid, fork_info::next, printf_filtered(), ptid_get_pid(), exsummary::status, and target_pid_to_str().
Referenced by linux_nat_mourn_inferior().
static void restart_command | ( | char * | args, |
int | from_tty | ||
) | [static] |
Definition at line 740 of file linux-fork.c.
References _, error(), find_fork_id(), linux_fork_context(), and parse_and_eval_long().
int checkpointing_pid = 0 [static] |
Definition at line 614 of file linux-fork.c.
Referenced by checkpoint_command(), and linux_fork_checkpointing_p().
Definition at line 39 of file linux-fork.c.
Referenced by add_fork().
int highest_fork_num [static] |
Definition at line 40 of file linux-fork.c.
Referenced by add_fork().