GDBserver
Classes | Macros | Enumerations | Functions | Variables
linux-low.c File Reference
#include "server.h"
#include "linux-low.h"
#include "nat/linux-osdata.h"
#include "agent.h"
#include "tdesc.h"
#include "rsp-low.h"
#include "signals-state-save-restore.h"
#include "nat/linux-nat.h"
#include "nat/linux-waitpid.h"
#include "gdb_wait.h"
#include "nat/gdb_ptrace.h"
#include "nat/linux-ptrace.h"
#include "nat/linux-procfs.h"
#include "nat/linux-personality.h"
#include <signal.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sched.h>
#include <ctype.h>
#include <pwd.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/vfs.h>
#include <sys/uio.h>
#include "filestuff.h"
#include "tracepoint.h"
#include "hostio.h"
#include <inttypes.h>
#include "common-inferior.h"
#include "nat/fork-inferior.h"
#include "environ.h"
#include <elf.h>
#include "nat/linux-namespaces.h"

Go to the source code of this file.

Classes

struct  Elf32_auxv_t
 
struct  Elf64_auxv_t
 
struct  simple_pid_list
 
struct  pending_signals
 
struct  link_map_offsets
 

Macros

#define SPUFS_MAGIC   0x23c9b64e
 
#define O_LARGEFILE   0
 
#define target_is_async_p()   (linux_event_pipe[0] != -1)
 
#define use_linux_regsets   0
 
#define regsets_fetch_inferior_registers(regsets_info, regcache)   1
 
#define regsets_store_inferior_registers(regsets_info, regcache)   1
 
#define usr_fetch_inferior_registers(regs_info, regcache, regno, all)   do {} while (0)
 
#define usr_store_inferior_registers(regs_info, regcache, regno, all)   do {} while (0)
 
#define linux_read_loadmap   NULL
 

Enumerations

enum  stopping_threads_kind { NOT_STOPPING_THREADS, STOPPING_THREADS, STOPPING_AND_SUSPENDING_THREADS }
 

Functions

ptid_t ptid_of_lwp (struct lwp_info *lwp)
 
void lwp_set_arch_private_info (struct lwp_info *lwp, struct arch_lwp_info *info)
 
struct arch_lwp_infolwp_arch_private_info (struct lwp_info *lwp)
 
int lwp_is_stopped (struct lwp_info *lwp)
 
enum target_stop_reason lwp_stop_reason (struct lwp_info *lwp)
 
int lwp_is_stepping (struct lwp_info *lwp)
 
static void add_to_pid_list (struct simple_pid_list **listp, int pid, int status)
 
static int pull_pid_from_list (struct simple_pid_list **listp, int pid, int *statusp)
 
static void linux_resume_one_lwp (struct lwp_info *lwp, int step, int signal, siginfo_t *info)
 
static void linux_resume (struct thread_resume *resume_info, size_t n)
 
static void stop_all_lwps (int suspend, struct lwp_info *except)
 
static void unstop_all_lwps (int unsuspend, struct lwp_info *except)
 
static void unsuspend_all_lwps (struct lwp_info *except)
 
static int linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid, int *wstat, int options)
 
static int linux_wait_for_event (ptid_t ptid, int *wstat, int options)
 
static struct lwp_infoadd_lwp (ptid_t ptid)
 
static void linux_mourn (struct process_info *process)
 
static int linux_stopped_by_watchpoint (void)
 
static void mark_lwp_dead (struct lwp_info *lwp, int wstat)
 
static int lwp_is_marked_dead (struct lwp_info *lwp)
 
static void proceed_all_lwps (void)
 
static int finish_step_over (struct lwp_info *lwp)
 
static int kill_lwp (unsigned long lwpid, int signo)
 
static void enqueue_pending_signal (struct lwp_info *lwp, int signal, siginfo_t *info)
 
static void complete_ongoing_step_over (void)
 
static int linux_low_ptrace_options (int attached)
 
static int check_ptrace_stopped_lwp_gone (struct lwp_info *lp)
 
static void proceed_one_lwp (thread_info *thread, lwp_info *except)
 
static int can_hardware_single_step (void)
 
static int can_software_single_step (void)
 
static int supports_breakpoints (void)
 
static int supports_fast_tracepoints (void)
 
static int lwp_in_step_range (struct lwp_info *lwp)
 
static void send_sigstop (struct lwp_info *lwp)
 
static void wait_for_sigstop (void)
 
static int elf_64_header_p (const Elf64_Ehdr *header, unsigned int *machine)
 
static int elf_64_file_p (const char *file, unsigned int *machine)
 
int linux_pid_exe_is_elf_64_file (int pid, unsigned int *machine)
 
static void delete_lwp (struct lwp_info *lwp)
 
static struct process_infolinux_add_process (int pid, int attached)
 
static CORE_ADDR get_pc (struct lwp_info *lwp)
 
static void linux_arch_setup (void)
 
static void linux_arch_setup_thread (struct thread_info *thread)
 
static int handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat)
 
static void get_syscall_trapinfo (struct lwp_info *lwp, int *sysno)
 
static int check_stopped_by_watchpoint (struct lwp_info *child)
 
static int save_stop_reason (struct lwp_info *lwp)
 
static void linux_ptrace_fun ()
 
static int linux_create_inferior (const char *program, const std::vector< char *> &program_args)
 
static void linux_post_create_inferior (void)
 
int linux_attach_lwp (ptid_t ptid)
 
static int attach_proc_task_lwp_callback (ptid_t ptid)
 
static void async_file_mark (void)
 
static int linux_attach (unsigned long pid)
 
static int last_thread_of_process_p (int pid)
 
static void linux_kill_one_lwp (struct lwp_info *lwp)
 
static void kill_wait_lwp (struct lwp_info *lwp)
 
static void kill_one_lwp_callback (thread_info *thread, int pid)
 
static int linux_kill (int pid)
 
static int get_detach_signal (struct thread_info *thread)
 
static void linux_detach_one_lwp (struct lwp_info *lwp)
 
static void linux_detach_lwp_callback (thread_info *thread)
 
static int linux_detach (int pid)
 
static void linux_join (int pid)
 
static int linux_thread_alive (ptid_t ptid)
 
static int thread_still_has_status_pending_p (struct thread_info *thread)
 
static int lwp_resumed (struct lwp_info *lwp)
 
static bool status_pending_p_callback (thread_info *thread, ptid_t ptid)
 
struct lwp_infofind_lwp_pid (ptid_t ptid)
 
static int num_lwps (int pid)
 
struct lwp_infoiterate_over_lwps (ptid_t filter, iterate_over_lwps_ftype callback, void *data)
 
static void check_zombie_leaders (void)
 
static bool not_stopped_callback (thread_info *thread, ptid_t filter)
 
static void lwp_suspended_inc (struct lwp_info *lwp)
 
static void lwp_suspended_decr (struct lwp_info *lwp)
 
static int handle_tracepoints (struct lwp_info *lwp)
 
static fast_tpoint_collect_result linux_fast_tracepoint_collecting (struct lwp_info *lwp, struct fast_tpoint_collect_status *status)
 
static int maybe_move_out_of_jump_pad (struct lwp_info *lwp, int *wstat)
 
static void enqueue_one_deferred_signal (struct lwp_info *lwp, int *wstat)
 
static int dequeue_one_deferred_signal (struct lwp_info *lwp, int *wstat)
 
static struct lwp_infolinux_low_filter_event (int lwpid, int wstat)
 
static int maybe_hw_step (struct thread_info *thread)
 
static void resume_stopped_resumed_lwps (thread_info *thread)
 
static void select_event_lwp (struct lwp_info **orig_lp)
 
static void move_out_of_jump_pad_callback (thread_info *thread)
 
static bool stuck_in_jump_pad_callback (thread_info *thread)
 
static bool lwp_running (thread_info *thread)
 
static ptid_t linux_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus, int target_options)
 
static void linux_stabilize_threads (void)
 
static ptid_t ignore_event (struct target_waitstatus *ourstatus)
 
static ptid_t filter_exit_event (struct lwp_info *event_child, struct target_waitstatus *ourstatus)
 
static int gdb_catching_syscalls_p (struct lwp_info *event_child)
 
static int gdb_catch_this_syscall_p (struct lwp_info *event_child)
 
static void async_file_flush (void)
 
static ptid_t linux_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int target_options)
 
void linux_stop_lwp (struct lwp_info *lwp)
 
static void send_sigstop (thread_info *thread, lwp_info *except)
 
static void suspend_and_send_sigstop (thread_info *thread, lwp_info *except)
 
static void install_software_single_step_breakpoints (struct lwp_info *lwp)
 
static int single_step (struct lwp_info *lwp)
 
static int lwp_signal_can_be_delivered (struct lwp_info *lwp)
 
static void linux_resume_one_lwp_throw (struct lwp_info *lwp, int step, int signal, siginfo_t *info)
 
static void linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n)
 
static bool resume_status_pending_p (thread_info *thread)
 
static bool need_step_over_p (thread_info *thread)
 
static int start_step_over (struct lwp_info *lwp)
 
static void linux_resume_one_thread (thread_info *thread, bool leave_all_stopped)
 
static void unsuspend_and_proceed_one_lwp (thread_info *thread, lwp_info *except)
 
static int linux_register_in_regsets (const struct regs_info *regs_info, int regno)
 
static void linux_fetch_registers (struct regcache *regcache, int regno)
 
static void linux_store_registers (struct regcache *regcache, int regno)
 
static int linux_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 
static int linux_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len)
 
static void linux_look_up_symbols (void)
 
static void linux_request_interrupt (void)
 
static int linux_read_auxv (CORE_ADDR offset, unsigned char *myaddr, unsigned int len)
 
static int linux_supports_z_point_type (char z_type)
 
static int linux_insert_point (enum raw_bkpt_type type, CORE_ADDR addr, int size, struct raw_breakpoint *bp)
 
static int linux_remove_point (enum raw_bkpt_type type, CORE_ADDR addr, int size, struct raw_breakpoint *bp)
 
static int linux_stopped_by_sw_breakpoint (void)
 
static int linux_supports_stopped_by_sw_breakpoint (void)
 
static int linux_stopped_by_hw_breakpoint (void)
 
static int linux_supports_stopped_by_hw_breakpoint (void)
 
static int linux_supports_hardware_single_step (void)
 
static int linux_supports_software_single_step (void)
 
static CORE_ADDR linux_stopped_data_address (void)
 
static int linux_qxfer_osdata (const char *annex, unsigned char *readbuf, unsigned const char *writebuf, CORE_ADDR offset, int len)
 
static void siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo, int direction)
 
static int linux_xfer_siginfo (const char *annex, unsigned char *readbuf, unsigned const char *writebuf, CORE_ADDR offset, int len)
 
static void sigchld_handler (int signo)
 
static int linux_supports_non_stop (void)
 
static int linux_async (int enable)
 
static int linux_start_non_stop (int nonstop)
 
static int linux_supports_multi_process (void)
 
static int linux_supports_fork_events (void)
 
static int linux_supports_vfork_events (void)
 
static int linux_supports_exec_events (void)
 
static void linux_handle_new_gdb_connection (void)
 
static int linux_supports_disable_randomization (void)
 
static int linux_supports_agent (void)
 
static int linux_supports_range_stepping (void)
 
static int spu_enumerate_spu_ids (long pid, unsigned char *buf, CORE_ADDR offset, int len)
 
static int linux_qxfer_spu (const char *annex, unsigned char *readbuf, unsigned const char *writebuf, CORE_ADDR offset, int len)
 
static void linux_process_qsupported (char **features, int count)
 
static int linux_supports_catch_syscall (void)
 
static int linux_get_ipa_tdesc_idx (void)
 
static int linux_supports_tracepoints (void)
 
static CORE_ADDR linux_read_pc (struct regcache *regcache)
 
static void linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
 
static int linux_thread_stopped (struct thread_info *thread)
 
static void linux_pause_all (int freeze)
 
static void linux_unpause_all (int unfreeze)
 
static int linux_prepare_to_access_memory (void)
 
static void linux_done_accessing_memory (void)
 
static int linux_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector, CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry, CORE_ADDR *trampoline, ULONGEST *trampoline_size, unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size, CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end, char *err)
 
static struct emit_opslinux_emit_ops (void)
 
static int linux_get_min_fast_tracepoint_insn_len (void)
 
static int get_phdr_phnum_from_proc_auxv (const int pid, const int is_elf64, CORE_ADDR *phdr_memaddr, int *num_phdr)
 
static CORE_ADDR get_dynamic (const int pid, const int is_elf64)
 
static CORE_ADDR get_r_debug (const int pid, const int is_elf64)
 
static int read_one_ptr (CORE_ADDR memaddr, CORE_ADDR *ptr, int ptr_size)
 
static int linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf, unsigned const char *writebuf, CORE_ADDR offset, int len)
 
ptid_t current_lwp_ptid (void)
 
static int linux_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
 
static const gdb_bytelinux_sw_breakpoint_from_kind (int kind, int *size)
 
static int linux_breakpoint_kind_from_current_state (CORE_ADDR *pcptr)
 
void linux_set_pc_32bit (struct regcache *regcache, CORE_ADDR pc)
 
CORE_ADDR linux_get_pc_32bit (struct regcache *regcache)
 
void linux_set_pc_64bit (struct regcache *regcache, CORE_ADDR pc)
 
CORE_ADDR linux_get_pc_64bit (struct regcache *regcache)
 
void initialize_low (void)
 

Variables

int have_ptrace_getregset = -1
 
struct simple_pid_liststopped_pids
 
enum stopping_threads_kind stopping_threads = NOT_STOPPING_THREADS
 
int using_threads = 1
 
static int stabilizing_threads
 
ptid_t step_over_bkpt
 
static int linux_event_pipe [2] = { -1, -1 }
 
static struct target_ops linux_target_ops
 

Macro Definition Documentation

◆ linux_read_loadmap

#define linux_read_loadmap   NULL

Definition at line 6546 of file linux-low.c.

◆ O_LARGEFILE

#define O_LARGEFILE   0

Definition at line 74 of file linux-low.c.

Referenced by linux_read_memory().

◆ regsets_fetch_inferior_registers

#define regsets_fetch_inferior_registers (   regsets_info,
  regcache 
)    1

Definition at line 5489 of file linux-low.c.

Referenced by linux_fetch_registers().

◆ regsets_store_inferior_registers

#define regsets_store_inferior_registers (   regsets_info,
  regcache 
)    1

Definition at line 5490 of file linux-low.c.

Referenced by linux_store_registers().

◆ SPUFS_MAGIC

#define SPUFS_MAGIC   0x23c9b64e

Definition at line 63 of file linux-low.c.

Referenced by spu_enumerate_spu_ids().

◆ target_is_async_p

#define target_is_async_p ( )    (linux_event_pipe[0] != -1)

◆ use_linux_regsets

#define use_linux_regsets   0

Definition at line 5488 of file linux-low.c.

Referenced by linux_register_in_regsets().

◆ usr_fetch_inferior_registers

#define usr_fetch_inferior_registers (   regs_info,
  regcache,
  regno,
  all 
)    do {} while (0)

Definition at line 5666 of file linux-low.c.

Referenced by linux_fetch_registers().

◆ usr_store_inferior_registers

#define usr_store_inferior_registers (   regs_info,
  regcache,
  regno,
  all 
)    do {} while (0)

Definition at line 5667 of file linux-low.c.

Referenced by linux_store_registers().

Enumeration Type Documentation

◆ stopping_threads_kind

Enumerator
NOT_STOPPING_THREADS 
STOPPING_THREADS 
STOPPING_AND_SUSPENDING_THREADS 

Definition at line 239 of file linux-low.c.

Function Documentation

◆ add_lwp()

static struct lwp_info * add_lwp ( ptid_t  ptid)
static

◆ add_to_pid_list()

static void add_to_pid_list ( struct simple_pid_list **  listp,
int  pid,
int  status 
)
static

◆ async_file_flush()

static void async_file_flush ( void  )
static

Definition at line 3834 of file linux-low.c.

References errno, and linux_event_pipe.

Referenced by async_file_mark(), and linux_wait().

◆ async_file_mark()

static void async_file_mark ( void  )
static

◆ attach_proc_task_lwp_callback()

static int attach_proc_task_lwp_callback ( ptid_t  ptid)
static

◆ can_hardware_single_step()

static int can_hardware_single_step ( void  )
static

◆ can_software_single_step()

static int can_software_single_step ( void  )
static

◆ check_ptrace_stopped_lwp_gone()

static int check_ptrace_stopped_lwp_gone ( struct lwp_info lp)
static

◆ check_stopped_by_watchpoint()

static int check_stopped_by_watchpoint ( struct lwp_info child)
static

◆ check_zombie_leaders()

static void check_zombie_leaders ( void  )
static

◆ complete_ongoing_step_over()

static void complete_ongoing_step_over ( void  )
static

◆ current_lwp_ptid()

ptid_t current_lwp_ptid ( void  )

◆ delete_lwp()

static void delete_lwp ( struct lwp_info lwp)
static

◆ dequeue_one_deferred_signal()

static int dequeue_one_deferred_signal ( struct lwp_info lwp,
int *  wstat 
)
static

◆ elf_64_file_p()

static int elf_64_file_p ( const char *  file,
unsigned int *  machine 
)
static

Definition at line 377 of file linux-low.c.

References elf_64_header_p().

Referenced by linux_pid_exe_is_elf_64_file(), and linux_qxfer_libraries_svr4().

◆ elf_64_header_p()

static int elf_64_header_p ( const Elf64_Ehdr *  header,
unsigned int *  machine 
)
static

Definition at line 357 of file linux-low.c.

Referenced by elf_64_file_p().

◆ enqueue_one_deferred_signal()

static void enqueue_one_deferred_signal ( struct lwp_info lwp,
int *  wstat 
)
static

◆ enqueue_pending_signal()

static void enqueue_pending_signal ( struct lwp_info lwp,
int  signal,
siginfo_t *  info 
)
static

◆ filter_exit_event()

static ptid_t filter_exit_event ( struct lwp_info event_child,
struct target_waitstatus *  ourstatus 
)
static

◆ find_lwp_pid()

struct lwp_info* find_lwp_pid ( ptid_t  ptid)

◆ finish_step_over()

static int finish_step_over ( struct lwp_info lwp)
static

◆ gdb_catch_this_syscall_p()

static int gdb_catch_this_syscall_p ( struct lwp_info event_child)
static

◆ gdb_catching_syscalls_p()

static int gdb_catching_syscalls_p ( struct lwp_info event_child)
static

◆ get_detach_signal()

static int get_detach_signal ( struct thread_info thread)
static

◆ get_dynamic()

static CORE_ADDR get_dynamic ( const int  pid,
const int  is_elf64 
)
static

Definition at line 6746 of file linux-low.c.

References alloca(), gdb_assert, get_phdr_phnum_from_proc_auxv(), and linux_read_memory().

Referenced by get_r_debug().

◆ get_pc()

static CORE_ADDR get_pc ( struct lwp_info lwp)
static

◆ get_phdr_phnum_from_proc_auxv()

static int get_phdr_phnum_from_proc_auxv ( const int  pid,
const int  is_elf64,
CORE_ADDR phdr_memaddr,
int *  num_phdr 
)
static

◆ get_r_debug()

static CORE_ADDR get_r_debug ( const int  pid,
const int  is_elf64 
)
static

Definition at line 6823 of file linux-low.c.

References get_dynamic(), and linux_read_memory().

Referenced by linux_qxfer_libraries_svr4().

◆ get_syscall_trapinfo()

static void get_syscall_trapinfo ( struct lwp_info lwp,
int *  sysno 
)
static

◆ handle_extended_wait()

static int handle_extended_wait ( struct lwp_info **  orig_event_lwp,
int  wstat 
)
static

Definition at line 475 of file linux-low.c.

References _, __WALL, add_lwp(), allocate_target_description(), process_info::attached, lwp_info::bp_reinsert, can_software_single_step(), clone_all_breakpoints(), copy_target_description(), current_thread, debug_printf(), debug_threads, delete_single_step_breakpoints(), lwp_info::fork_relative, gdb_assert, get_lwp_thread, get_thread_process(), has_single_step_breakpoints(), internal_error(), thread_info::last_resume_kind, thread_info::last_status, linux_add_process(), linux_arch_setup_thread(), linux_mourn(), linux_proc_pid_to_exec_file(), linux_ptrace_get_extended_event(), lwpid_of(), lwp_info::must_set_ptrace_flags, my_waitpid(), linux_target_ops::new_fork, perror_with_name(), pid_of(), ptid_build(), ptid_get_lwp(), ptid_get_pid(), ptid_of(), ptrace(), PTRACE_EVENT_CLONE, PTRACE_EVENT_EXEC, PTRACE_EVENT_FORK, PTRACE_EVENT_VFORK, PTRACE_EVENT_VFORK_DONE, PTRACE_GETEVENTMSG, PTRACE_TYPE_ARG3, pull_pid_from_list(), reinsert_single_step_breakpoints(), report_exec_events, report_thread_events, lwp_info::status_pending, lwp_info::status_pending_p, lwp_info::stop_expected, lwp_info::stopped, stopped_pids, STOPPING_AND_SUSPENDING_THREADS, stopping_threads, lwp_info::suspended, lwp_info::syscall_state, process_info::syscalls_to_catch, process_info::tdesc, the_low_target, thread_db_notice_clone(), uninsert_single_step_breakpoints(), lwp_info::waitstatus, warning(), WIFSTOPPED, WSTOPSIG, and xstrdup().

Referenced by linux_low_filter_event().

◆ handle_tracepoints()

static int handle_tracepoints ( struct lwp_info lwp)
static

◆ ignore_event()

static ptid_t ignore_event ( struct target_waitstatus *  ourstatus)
static

Definition at line 3025 of file linux-low.c.

References async_file_mark(), and null_ptid.

Referenced by linux_wait_1().

◆ initialize_low()

void initialize_low ( void  )

Definition at line 7567 of file linux-low.c.

Referenced by captured_main().

◆ install_software_single_step_breakpoints()

static void install_software_single_step_breakpoints ( struct lwp_info lwp)
static

◆ iterate_over_lwps()

struct lwp_info* iterate_over_lwps ( ptid_t  filter,
iterate_over_lwps_ftype  callback,
void *  data 
)

◆ kill_lwp()

static int kill_lwp ( unsigned long  lwpid,
int  signo 
)
static

Definition at line 3891 of file linux-low.c.

References errno, and perror_with_name().

Referenced by linux_attach_lwp(), linux_detach_one_lwp(), linux_kill_one_lwp(), and send_sigstop().

◆ kill_one_lwp_callback()

static void kill_one_lwp_callback ( thread_info thread,
int  pid 
)
static

◆ kill_wait_lwp()

static void kill_wait_lwp ( struct lwp_info lwp)
static

◆ last_thread_of_process_p()

static int last_thread_of_process_p ( int  pid)
static

Definition at line 1245 of file linux-low.c.

References find_thread(), and lwp_info::thread.

Referenced by check_zombie_leaders(), filter_exit_event(), and linux_low_filter_event().

◆ linux_add_process()

static struct process_info* linux_add_process ( int  pid,
int  attached 
)
static

◆ linux_arch_setup()

static void linux_arch_setup ( void  )
static

◆ linux_arch_setup_thread()

static void linux_arch_setup_thread ( struct thread_info thread)
static

Definition at line 456 of file linux-low.c.

References current_thread, and linux_arch_setup().

Referenced by handle_extended_wait(), and linux_low_filter_event().

◆ linux_async()

static int linux_async ( int  enable)
static

◆ linux_attach()

static int linux_attach ( unsigned long  pid)
static

◆ linux_attach_lwp()

int linux_attach_lwp ( ptid_t  ptid)

◆ linux_breakpoint_kind_from_current_state()

static int linux_breakpoint_kind_from_current_state ( CORE_ADDR pcptr)
static

◆ linux_breakpoint_kind_from_pc()

static int linux_breakpoint_kind_from_pc ( CORE_ADDR pcptr)
static

◆ linux_create_inferior()

static int linux_create_inferior ( const char *  program,
const std::vector< char *> &  program_args 
)
static

◆ linux_detach()

static int linux_detach ( int  pid)
static

◆ linux_detach_lwp_callback()

static void linux_detach_lwp_callback ( thread_info thread)
static

Definition at line 1588 of file linux-low.c.

References get_thread_lwp, thread_info::id, linux_detach_one_lwp(), ptid_t::lwp(), and ptid_t::pid().

Referenced by linux_detach().

◆ linux_detach_one_lwp()

static void linux_detach_one_lwp ( struct lwp_info lwp)
static

◆ linux_done_accessing_memory()

static void linux_done_accessing_memory ( void  )
static

Definition at line 6632 of file linux-low.c.

References linux_unpause_all(), and non_stop.

◆ linux_emit_ops()

static struct emit_ops* linux_emit_ops ( void  )
static

Definition at line 6663 of file linux-low.c.

References linux_target_ops::emit_ops, and the_low_target.

◆ linux_fast_tracepoint_collecting()

static fast_tpoint_collect_result linux_fast_tracepoint_collecting ( struct lwp_info lwp,
struct fast_tpoint_collect_status status 
)
static

◆ linux_fetch_registers()

static void linux_fetch_registers ( struct regcache regcache,
int  regno 
)
static

◆ linux_get_ipa_tdesc_idx()

static int linux_get_ipa_tdesc_idx ( void  )
static

Definition at line 6564 of file linux-low.c.

References linux_target_ops::get_ipa_tdesc_idx, and the_low_target.

◆ linux_get_min_fast_tracepoint_insn_len()

static int linux_get_min_fast_tracepoint_insn_len ( void  )
static

◆ linux_get_pc_32bit()

CORE_ADDR linux_get_pc_32bit ( struct regcache regcache)

Definition at line 7411 of file linux-low.c.

References collect_register_by_name(), debug_printf(), and debug_threads.

Referenced by aarch64_get_pc().

◆ linux_get_pc_64bit()

CORE_ADDR linux_get_pc_64bit ( struct regcache regcache)

Definition at line 7436 of file linux-low.c.

References collect_register_by_name(), debug_printf(), and debug_threads.

Referenced by aarch64_get_pc().

◆ linux_handle_new_gdb_connection()

static void linux_handle_new_gdb_connection ( void  )
static

◆ linux_insert_point()

static int linux_insert_point ( enum raw_bkpt_type  type,
CORE_ADDR  addr,
int  size,
struct raw_breakpoint bp 
)
static

◆ linux_install_fast_tracepoint_jump_pad()

static int linux_install_fast_tracepoint_jump_pad ( CORE_ADDR  tpoint,
CORE_ADDR  tpaddr,
CORE_ADDR  collector,
CORE_ADDR  lockaddr,
ULONGEST  orig_size,
CORE_ADDR jump_entry,
CORE_ADDR trampoline,
ULONGEST trampoline_size,
unsigned char *  jjump_pad_insn,
ULONGEST jjump_pad_insn_size,
CORE_ADDR adjusted_insn_addr,
CORE_ADDR adjusted_insn_addr_end,
char *  err 
)
static

◆ linux_join()

static void linux_join ( int  pid)
static

Definition at line 1673 of file linux-low.c.

References errno, my_waitpid(), WIFEXITED, and WIFSIGNALED.

◆ linux_kill()

static int linux_kill ( int  pid)
static

◆ linux_kill_one_lwp()

static void linux_kill_one_lwp ( struct lwp_info lwp)
static

◆ linux_look_up_symbols()

static void linux_look_up_symbols ( void  )
static

◆ linux_low_filter_event()

static struct lwp_info* linux_low_filter_event ( int  lwpid,
int  wstat 
)
static

◆ linux_low_ptrace_options()

static int linux_low_ptrace_options ( int  attached)
static

◆ linux_mourn()

static void linux_mourn ( struct process_info process)
static

◆ linux_pause_all()

static void linux_pause_all ( int  freeze)
static

Definition at line 6607 of file linux-low.c.

References stop_all_lwps().

Referenced by linux_prepare_to_access_memory().

◆ linux_pid_exe_is_elf_64_file()

int linux_pid_exe_is_elf_64_file ( int  pid,
unsigned int *  machine 
)

◆ linux_post_create_inferior()

static void linux_post_create_inferior ( void  )
static

◆ linux_prepare_to_access_memory()

static int linux_prepare_to_access_memory ( void  )
static

Definition at line 6622 of file linux-low.c.

References linux_pause_all(), and non_stop.

◆ linux_process_qsupported()

static void linux_process_qsupported ( char **  features,
int  count 
)
static

Definition at line 6550 of file linux-low.c.

References linux_target_ops::process_qsupported, and the_low_target.

◆ linux_ptrace_fun()

static void linux_ptrace_fun ( )
static

◆ linux_qxfer_libraries_svr4()

static int linux_qxfer_libraries_svr4 ( const char *  annex,
unsigned char *  readbuf,
unsigned const char *  writebuf,
CORE_ADDR  offset,
int  len 
)
static

◆ linux_qxfer_osdata()

static int linux_qxfer_osdata ( const char *  annex,
unsigned char *  readbuf,
unsigned const char *  writebuf,
CORE_ADDR  offset,
int  len 
)
static

Definition at line 6113 of file linux-low.c.

References linux_common_xfer_osdata(), and offset.

◆ linux_qxfer_spu()

static int linux_qxfer_spu ( const char *  annex,
unsigned char *  readbuf,
unsigned const char *  writebuf,
CORE_ADDR  offset,
int  len 
)
static

Definition at line 6430 of file linux-low.c.

References current_thread, lwpid_of(), offset, and spu_enumerate_spu_ids().

◆ linux_read_auxv()

static int linux_read_auxv ( CORE_ADDR  offset,
unsigned char *  myaddr,
unsigned int  len 
)
static

Definition at line 5935 of file linux-low.c.

References current_thread, lwpid_of(), offset, process_info::pid, and xsnprintf().

◆ linux_read_memory()

static int linux_read_memory ( CORE_ADDR  memaddr,
unsigned char *  myaddr,
int  len 
)
static

◆ linux_read_pc()

static CORE_ADDR linux_read_pc ( struct regcache regcache)
static

Definition at line 6582 of file linux-low.c.

References linux_target_ops::get_pc, and the_low_target.

◆ linux_register_in_regsets()

static int linux_register_in_regsets ( const struct regs_info regs_info,
int  regno 
)
static

Definition at line 5498 of file linux-low.c.

References regs_info::regset_bitmap, and use_linux_regsets.

Referenced by linux_fetch_registers(), and linux_store_registers().

◆ linux_remove_point()

static int linux_remove_point ( enum raw_bkpt_type  type,
CORE_ADDR  addr,
int  size,
struct raw_breakpoint bp 
)
static

◆ linux_request_interrupt()

static void linux_request_interrupt ( void  )
static

Definition at line 5924 of file linux-low.c.

References signal_pid.

◆ linux_resume()

static void linux_resume ( struct thread_resume resume_info,
size_t  n 
)
static

◆ linux_resume_one_lwp()

static void linux_resume_one_lwp ( struct lwp_info lwp,
int  step,
int  signal,
siginfo_t *  info 
)
static

◆ linux_resume_one_lwp_throw()

static void linux_resume_one_lwp_throw ( struct lwp_info lwp,
int  step,
int  signal,
siginfo_t *  info 
)
static

◆ linux_resume_one_thread()

static void linux_resume_one_thread ( thread_info thread,
bool  leave_all_stopped 
)
static

◆ linux_set_pc_32bit()

void linux_set_pc_32bit ( struct regcache regcache,
CORE_ADDR  pc 
)

Definition at line 7400 of file linux-low.c.

References supply_register_by_name().

Referenced by aarch64_set_pc().

◆ linux_set_pc_64bit()

void linux_set_pc_64bit ( struct regcache regcache,
CORE_ADDR  pc 
)

Definition at line 7425 of file linux-low.c.

References supply_register_by_name().

Referenced by aarch64_set_pc().

◆ linux_set_resume_request()

static void linux_set_resume_request ( thread_info thread,
thread_resume resume,
size_t  n 
)
static

◆ linux_stabilize_threads()

static void linux_stabilize_threads ( void  )
static

◆ linux_start_non_stop()

static int linux_start_non_stop ( int  nonstop)
static

Definition at line 6280 of file linux-low.c.

References linux_async(), and target_is_async_p.

◆ linux_stop_lwp()

void linux_stop_lwp ( struct lwp_info lwp)

◆ linux_stopped_by_hw_breakpoint()

static int linux_stopped_by_hw_breakpoint ( void  )
static

Definition at line 6019 of file linux-low.c.

References current_thread, get_thread_lwp, and lwp_info::stop_reason.

◆ linux_stopped_by_sw_breakpoint()

static int linux_stopped_by_sw_breakpoint ( void  )
static

Definition at line 5999 of file linux-low.c.

References current_thread, get_thread_lwp, and lwp_info::stop_reason.

◆ linux_stopped_by_watchpoint()

static int linux_stopped_by_watchpoint ( void  )
static

Definition at line 6050 of file linux-low.c.

References current_thread, get_thread_lwp, and lwp_info::stop_reason.

◆ linux_stopped_data_address()

static CORE_ADDR linux_stopped_data_address ( void  )
static

Definition at line 6058 of file linux-low.c.

References current_thread, get_thread_lwp, and lwp_info::stopped_data_address.

◆ linux_store_registers()

static void linux_store_registers ( struct regcache regcache,
int  regno 
)
static

◆ linux_supports_agent()

static int linux_supports_agent ( void  )
static

Definition at line 6362 of file linux-low.c.

◆ linux_supports_catch_syscall()

static int linux_supports_catch_syscall ( void  )
static

◆ linux_supports_disable_randomization()

static int linux_supports_disable_randomization ( void  )
static

Definition at line 6352 of file linux-low.c.

◆ linux_supports_exec_events()

static int linux_supports_exec_events ( void  )
static

Definition at line 6316 of file linux-low.c.

References linux_supports_traceexec().

◆ linux_supports_fork_events()

static int linux_supports_fork_events ( void  )
static

Definition at line 6300 of file linux-low.c.

References linux_supports_tracefork().

◆ linux_supports_hardware_single_step()

static int linux_supports_hardware_single_step ( void  )
static

Definition at line 6038 of file linux-low.c.

References can_hardware_single_step().

◆ linux_supports_multi_process()

static int linux_supports_multi_process ( void  )
static

Definition at line 6292 of file linux-low.c.

◆ linux_supports_non_stop()

static int linux_supports_non_stop ( void  )
static

Definition at line 6219 of file linux-low.c.

◆ linux_supports_range_stepping()

static int linux_supports_range_stepping ( void  )
static

◆ linux_supports_software_single_step()

static int linux_supports_software_single_step ( void  )
static

Definition at line 6044 of file linux-low.c.

References can_software_single_step().

◆ linux_supports_stopped_by_hw_breakpoint()

static int linux_supports_stopped_by_hw_breakpoint ( void  )
static

Definition at line 6030 of file linux-low.c.

References USE_SIGTRAP_SIGINFO.

◆ linux_supports_stopped_by_sw_breakpoint()

static int linux_supports_stopped_by_sw_breakpoint ( void  )
static

Definition at line 6010 of file linux-low.c.

References USE_SIGTRAP_SIGINFO.

◆ linux_supports_tracepoints()

static int linux_supports_tracepoints ( void  )
static

Definition at line 6573 of file linux-low.c.

References linux_target_ops::supports_tracepoints, and the_low_target.

◆ linux_supports_vfork_events()

static int linux_supports_vfork_events ( void  )
static

Definition at line 6308 of file linux-low.c.

References linux_supports_tracefork().

◆ linux_supports_z_point_type()

static int linux_supports_z_point_type ( char  z_type)
static

Definition at line 5963 of file linux-low.c.

References linux_target_ops::supports_z_point_type, and the_low_target.

◆ linux_sw_breakpoint_from_kind()

static const gdb_byte* linux_sw_breakpoint_from_kind ( int  kind,
int *  size 
)
static

◆ linux_thread_alive()

static int linux_thread_alive ( ptid_t  ptid)
static

Definition at line 1686 of file linux-low.c.

References find_lwp_pid(), and lwp_is_marked_dead().

Referenced by wait_for_sigstop().

◆ linux_thread_stopped()

static int linux_thread_stopped ( struct thread_info thread)
static

Definition at line 6599 of file linux-low.c.

References get_thread_lwp.

◆ linux_unpause_all()

static void linux_unpause_all ( int  unfreeze)
static

Definition at line 6616 of file linux-low.c.

References unstop_all_lwps().

Referenced by linux_done_accessing_memory().

◆ linux_wait()

static ptid_t linux_wait ( ptid_t  ptid,
struct target_waitstatus *  ourstatus,
int  target_options 
)
static

◆ linux_wait_1()

static ptid_t linux_wait_1 ( ptid_t  ptid,
struct target_waitstatus *  ourstatus,
int  target_options 
)
static

Definition at line 3099 of file linux-low.c.

References __SIGRTMIN, __WALL, agent_loaded_p(), before_insn, linux_target_ops::breakpoint_at, breakpoint_inserted_here(), target_ops::breakpoint_kind_from_current_state, can_software_single_step(), check_breakpoints(), lwp_info::collecting_fast_tracepoint, current_process(), current_thread, debug_enter, debug_exit, debug_printf(), debug_threads, linux_target_ops::decr_pc_after_break, delete_breakpoint(), delete_single_step_breakpoints(), dequeue_one_deferred_signal(), enqueue_one_deferred_signal(), enqueue_pending_signal(), lwp_info::exit_jump_pad_bkpt, filter_exit_event(), find_thread(), finish_step_over(), for_each_thread(), lwp_info::fork_relative, gdb_assert, gdb_breakpoint_here(), gdb_catch_this_syscall_p(), gdb_condition_true_at_breakpoint(), gdb_no_commands_at_breakpoint(), gdb_signal_from_host(), get_lwp_thread, get_syscall_trapinfo(), get_thread_lwp, get_thread_regcache(), handle_tracepoints(), has_single_step_breakpoints(), ignore_event(), thread_info::last_resume_kind, linux_fast_tracepoint_collecting(), linux_resume_one_lwp(), linux_wait_for_event(), linux_wstatus_maybe_breakpoint(), lwp_in_step_range(), lwpid_of(), maybe_move_out_of_jump_pad(), minus_one_ptid, non_stop, not_collecting, not_stopped_callback(), null_ptid, paddress(), pass_signals, proceed_all_lwps(), ptid_equal(), ptid_of(), ptrace(), PTRACE_GETSIGINFO, PTRACE_TYPE_ARG3, run_breakpoint_commands(), select_event_lwp(), linux_target_ops::set_pc, single_step_breakpoint_inserted_here(), stabilize_threads, stabilizing_threads, lwp_info::status_pending, lwp_info::status_pending_p, status_pending_p_callback(), step_over_bkpt, lwp_info::step_range_end, lwp_info::step_range_start, lwp_info::stepping, stop_all_lwps(), lwp_info::stop_pc, lwp_info::stop_reason, string, supports_breakpoints(), supports_fast_tracepoints(), lwp_info::suspended, target_ops::sw_breakpoint_from_kind, swbreak_feature, SYSCALL_SIGTRAP, lwp_info::syscall_state, target_pid_to_str(), the_low_target, the_target, lwp_info::thread, unstop_all_lwps(), unsuspend_all_lwps(), USE_THREAD_DB, lwp_info::waitstatus, WEXITSTATUS, WIFEXITED, WIFSIGNALED, WIFSTOPPED, WNOHANG, WSTOPSIG, and WTERMSIG.

Referenced by linux_stabilize_threads(), and linux_wait().

◆ linux_wait_for_event()

static int linux_wait_for_event ( ptid_t  ptid,
int *  wstat,
int  options 
)
static

Definition at line 2816 of file linux-low.c.

References linux_wait_for_event_filtered().

Referenced by linux_wait_1().

◆ linux_wait_for_event_filtered()

static int linux_wait_for_event_filtered ( ptid_t  wait_ptid,
ptid_t  filter_ptid,
int *  wstat,
int  options 
)
static

◆ linux_write_memory()

static int linux_write_memory ( CORE_ADDR  memaddr,
const unsigned char *  myaddr,
int  len 
)
static

◆ linux_write_pc()

static void linux_write_pc ( struct regcache regcache,
CORE_ADDR  pc 
)
static

Definition at line 6591 of file linux-low.c.

References gdb_assert, linux_target_ops::set_pc, and the_low_target.

◆ linux_xfer_siginfo()

static int linux_xfer_siginfo ( const char *  annex,
unsigned char *  readbuf,
unsigned const char *  writebuf,
CORE_ADDR  offset,
int  len 
)
static

◆ lwp_arch_private_info()

struct arch_lwp_info* lwp_arch_private_info ( struct lwp_info lwp)

◆ lwp_in_step_range()

static int lwp_in_step_range ( struct lwp_info lwp)
static

Definition at line 330 of file linux-low.c.

References lwp_info::step_range_end, lwp_info::step_range_start, and lwp_info::stop_pc.

Referenced by linux_wait_1().

◆ lwp_is_marked_dead()

static int lwp_is_marked_dead ( struct lwp_info lwp)
static

◆ lwp_is_stepping()

int lwp_is_stepping ( struct lwp_info lwp)

Definition at line 185 of file linux-low.c.

References lwp_info::stepping.

◆ lwp_is_stopped()

int lwp_is_stopped ( struct lwp_info lwp)

◆ lwp_resumed()

static int lwp_resumed ( struct lwp_info lwp)
static

◆ lwp_running()

static bool lwp_running ( thread_info thread)
static

◆ lwp_set_arch_private_info()

void lwp_set_arch_private_info ( struct lwp_info lwp,
struct arch_lwp_info info 
)

◆ lwp_signal_can_be_delivered()

static int lwp_signal_can_be_delivered ( struct lwp_info lwp)
static

◆ lwp_stop_reason()

enum target_stop_reason lwp_stop_reason ( struct lwp_info lwp)

Definition at line 177 of file linux-low.c.

References lwp_info::stop_reason.

Referenced by x86_linux_update_debug_registers().

◆ lwp_suspended_decr()

static void lwp_suspended_decr ( struct lwp_info lwp)
static

◆ lwp_suspended_inc()

static void lwp_suspended_inc ( struct lwp_info lwp)
static

◆ mark_lwp_dead()

static void mark_lwp_dead ( struct lwp_info lwp,
int  wstat 
)
static

◆ maybe_hw_step()

static int maybe_hw_step ( struct thread_info thread)
static

◆ maybe_move_out_of_jump_pad()

static int maybe_move_out_of_jump_pad ( struct lwp_info lwp,
int *  wstat 
)
static

◆ move_out_of_jump_pad_callback()

static void move_out_of_jump_pad_callback ( thread_info thread)
static

◆ need_step_over_p()

static bool need_step_over_p ( thread_info thread)
static

◆ not_stopped_callback()

static bool not_stopped_callback ( thread_info thread,
ptid_t  filter 
)
static

◆ num_lwps()

static int num_lwps ( int  pid)
static

Definition at line 1829 of file linux-low.c.

References for_each_thread(), and lwp_info::thread.

Referenced by check_zombie_leaders().

◆ proceed_all_lwps()

static void proceed_all_lwps ( void  )
static

◆ proceed_one_lwp()

static void proceed_one_lwp ( thread_info thread,
lwp_info except 
)
static

◆ ptid_of_lwp()

ptid_t ptid_of_lwp ( struct lwp_info lwp)

◆ pull_pid_from_list()

static int pull_pid_from_list ( struct simple_pid_list **  listp,
int  pid,
int *  statusp 
)
static

◆ read_one_ptr()

static int read_one_ptr ( CORE_ADDR  memaddr,
CORE_ADDR ptr,
int  ptr_size 
)
static

Definition at line 6922 of file linux-low.c.

References gdb_assert_not_reached, and linux_read_memory().

Referenced by linux_qxfer_libraries_svr4().

◆ resume_status_pending_p()

static bool resume_status_pending_p ( thread_info thread)
static

◆ resume_stopped_resumed_lwps()

static void resume_stopped_resumed_lwps ( thread_info thread)
static

◆ save_stop_reason()

static int save_stop_reason ( struct lwp_info lwp)
static

◆ select_event_lwp()

static void select_event_lwp ( struct lwp_info **  orig_lp)
static

◆ send_sigstop() [1/2]

static void send_sigstop ( struct lwp_info lwp)
static

◆ send_sigstop() [2/2]

static void send_sigstop ( thread_info thread,
lwp_info except 
)
static

Definition at line 3937 of file linux-low.c.

References get_thread_lwp, send_sigstop(), lwp_info::stopped, and lwp_info::thread.

◆ sigchld_handler()

static void sigchld_handler ( int  signo)
static

Definition at line 6196 of file linux-low.c.

References async_file_mark(), debug_threads, errno, and target_is_async_p.

Referenced by initialize_low().

◆ siginfo_fixup()

static void siginfo_fixup ( siginfo_t *  siginfo,
gdb_byte inf_siginfo,
int  direction 
)
static

Definition at line 6124 of file linux-low.c.

References linux_target_ops::siginfo_fixup, and the_low_target.

Referenced by linux_xfer_siginfo().

◆ single_step()

static int single_step ( struct lwp_info lwp)
static

◆ spu_enumerate_spu_ids()

static int spu_enumerate_spu_ids ( long  pid,
unsigned char *  buf,
CORE_ADDR  offset,
int  len 
)
static

Definition at line 6380 of file linux-low.c.

References offset, S_ISDIR, and SPUFS_MAGIC.

Referenced by linux_qxfer_spu().

◆ start_step_over()

static int start_step_over ( struct lwp_info lwp)
static

◆ status_pending_p_callback()

static bool status_pending_p_callback ( thread_info thread,
ptid_t  ptid 
)
static

◆ stop_all_lwps()

static void stop_all_lwps ( int  suspend,
struct lwp_info except 
)
static

◆ stuck_in_jump_pad_callback()

static bool stuck_in_jump_pad_callback ( thread_info thread)
static

◆ supports_breakpoints()

static int supports_breakpoints ( void  )
static

Definition at line 312 of file linux-low.c.

References linux_target_ops::get_pc, and the_low_target.

Referenced by linux_resume(), linux_wait_1(), and proceed_all_lwps().

◆ supports_fast_tracepoints()

static int supports_fast_tracepoints ( void  )
static

◆ suspend_and_send_sigstop()

static void suspend_and_send_sigstop ( thread_info thread,
lwp_info except 
)
static

Definition at line 3954 of file linux-low.c.

References get_thread_lwp, lwp_suspended_inc(), send_sigstop(), and lwp_info::thread.

Referenced by stop_all_lwps().

◆ thread_still_has_status_pending_p()

static int thread_still_has_status_pending_p ( struct thread_info thread)
static

◆ unstop_all_lwps()

static void unstop_all_lwps ( int  unsuspend,
struct lwp_info except 
)
static

◆ unsuspend_all_lwps()

static void unsuspend_all_lwps ( struct lwp_info except)
static

◆ unsuspend_and_proceed_one_lwp()

static void unsuspend_and_proceed_one_lwp ( thread_info thread,
lwp_info except 
)
static

Definition at line 5207 of file linux-low.c.

References get_thread_lwp, lwp_suspended_decr(), proceed_one_lwp(), and lwp_info::thread.

Referenced by unstop_all_lwps().

◆ wait_for_sigstop()

static void wait_for_sigstop ( void  )
static

Variable Documentation

◆ have_ptrace_getregset

int have_ptrace_getregset = -1

Definition at line 137 of file linux-low.c.

Referenced by arm_arch_setup(), arm_regs_info(), and x86_linux_read_description().

◆ linux_event_pipe

int linux_event_pipe[2] = { -1, -1 }
static

Definition at line 346 of file linux-low.c.

Referenced by async_file_flush(), async_file_mark(), and linux_async().

◆ linux_target_ops

Definition at line 7447 of file linux-low.c.

◆ stabilizing_threads

int stabilizing_threads
static

◆ step_over_bkpt

ptid_t step_over_bkpt

◆ stopped_pids

struct simple_pid_list* stopped_pids

Definition at line 205 of file linux-low.c.

Referenced by handle_extended_wait(), and linux_low_filter_event().

◆ stopping_threads

◆ using_threads

int using_threads = 1

Definition at line 255 of file linux-low.c.