GDB (xrefs)
|
#include "defs.h"
#include <fcntl.h>
#include <spawn.h>
#include <sys/debug.h>
#include <sys/procfs.h>
#include <sys/neutrino.h>
#include <sys/syspage.h>
#include "gdb_dirent.h"
#include <sys/netmgr.h>
#include "exceptions.h"
#include "gdb_string.h"
#include "gdbcore.h"
#include "inferior.h"
#include "target.h"
#include "objfiles.h"
#include "gdbthread.h"
#include "nto-tdep.h"
#include "command.h"
#include "regcache.h"
#include "solib.h"
Go to the source code of this file.
Defines | |
#define | NULL_PID 0 |
#define | _DEBUG_FLAG_TRACE |
#define | OSTYPE_NTO 1 |
Functions | |
static void | procfs_open (char *, int) |
static int | procfs_can_run (void) |
static int | procfs_xfer_memory (CORE_ADDR, gdb_byte *, int, int, struct mem_attrib *attrib, struct target_ops *) |
static void | init_procfs_ops (void) |
static ptid_t | do_attach (ptid_t ptid) |
static int | procfs_can_use_hw_breakpoint (int, int, int) |
static int | procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type, struct expression *cond) |
static int | procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type, struct expression *cond) |
static int | procfs_stopped_by_watchpoint (void) |
static unsigned | nto_node (void) |
static enum gdb_osabi | procfs_is_nto_target (bfd *abfd) |
static void | procfs_set_thread (ptid_t ptid) |
static int | procfs_thread_alive (struct target_ops *ops, ptid_t ptid) |
static void | update_thread_private_data_name (struct thread_info *new_thread, const char *newname) |
static void | update_thread_private_data (struct thread_info *new_thread, pthread_t tid, int state, int flags) |
static void | procfs_find_new_threads (struct target_ops *ops) |
static void | do_closedir_cleanup (void *dir) |
void | procfs_pidlist (char *args, int from_tty) |
void | procfs_meminfo (char *args, int from_tty) |
static void | procfs_files_info (struct target_ops *ignore) |
static void | procfs_attach (struct target_ops *ops, char *args, int from_tty) |
static void | procfs_post_attach (pid_t pid) |
static void | interrupt_query (void) |
static void | nto_interrupt_twice (int signo) |
static void | nto_interrupt (int signo) |
static ptid_t | procfs_wait (struct target_ops *ops, ptid_t ptid, struct target_waitstatus *ourstatus, int options) |
static void | procfs_fetch_registers (struct target_ops *ops, struct regcache *regcache, int regno) |
static void | procfs_detach (struct target_ops *ops, char *args, int from_tty) |
static int | procfs_breakpoint (CORE_ADDR addr, int type, int size) |
static int | procfs_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) |
static int | procfs_remove_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) |
static int | procfs_insert_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) |
static int | procfs_remove_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) |
static void | procfs_resume (struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal signo) |
static void | procfs_mourn_inferior (struct target_ops *ops) |
static void | breakup_args (char *scratch, char **argv) |
static void | procfs_create_inferior (struct target_ops *ops, char *exec_file, char *allargs, char **env, int from_tty) |
static void | procfs_stop (ptid_t ptid) |
static void | procfs_kill_inferior (struct target_ops *ops) |
static void | procfs_prepare_to_store (struct regcache *regcache) |
static int | get_regset (int regset, char *buf, int bufsize, int *regsize) |
void | procfs_store_registers (struct target_ops *ops, struct regcache *regcache, int regno) |
static void | procfs_pass_signals (int numsigs, unsigned char *pass_signals) |
static struct tidinfo * | procfs_thread_info (pid_t pid, short tid) |
static char * | procfs_pid_to_str (struct target_ops *ops, ptid_t ptid) |
void | _initialize_procfs (void) |
static int | procfs_hw_watchpoint (int addr, int len, int type) |
Variables | |
static struct target_ops | procfs_ops |
int | ctl_fd |
static void(* | ofunc )() |
static procfs_run | run |
static char | nto_procfs_path [PATH_MAX] = { "/proc" } |
static unsigned | nto_procfs_node = ND_LOCAL_NODE |
#define _DEBUG_FLAG_TRACE |
(_DEBUG_FLAG_TRACE_EXEC|_DEBUG_FLAG_TRACE_RD|\ _DEBUG_FLAG_TRACE_WR|_DEBUG_FLAG_TRACE_MODIFY)
Definition at line 47 of file nto-procfs.c.
Referenced by procfs_wait().
#define NULL_PID 0 |
Definition at line 46 of file nto-procfs.c.
#define OSTYPE_NTO 1 |
Definition at line 1430 of file nto-procfs.c.
void _initialize_procfs | ( | void | ) |
Definition at line 1433 of file nto-procfs.c.
References _, add_info(), add_target(), init_procfs_ops(), nto_cpuinfo_flags, nto_cpuinfo_valid, nto_is_nto_target, procfs_is_nto_target(), procfs_meminfo(), procfs_ops, procfs_pidlist(), and run.
static void breakup_args | ( | char * | scratch, |
char ** | argv | ||
) | [static] |
Definition at line 1038 of file nto-procfs.c.
References strchr().
Referenced by procfs_create_inferior().
Definition at line 658 of file nto-procfs.c.
References _, ctl_fd, error(), nto_init_solib_absolute_prefix(), nto_node(), nto_procfs_path, ptid_build(), ptid_get_pid(), safe_strerror(), and exsummary::status.
Referenced by procfs_attach(), and procfs_create_inferior().
static void do_closedir_cleanup | ( | void * | dir | ) | [static] |
Definition at line 353 of file nto-procfs.c.
Referenced by procfs_pidlist().
static int get_regset | ( | int | regset, |
char * | buf, | ||
int | bufsize, | ||
int * | regsize | ||
) | [static] |
Definition at line 1239 of file nto-procfs.c.
References ctl_fd, NTO_REG_ALT, NTO_REG_FLOAT, NTO_REG_GENERAL, and NTO_REG_SYSTEM.
Referenced by procfs_store_registers().
static void init_procfs_ops | ( | void | ) | [static] |
Definition at line 1379 of file nto-procfs.c.
References child_terminal_info(), default_child_has_all_memory(), default_child_has_execution(), default_child_has_memory(), default_child_has_registers(), default_child_has_stack(), target_ops::deprecated_xfer_memory, nto_extra_thread_info(), OPS_MAGIC, process_stratum, procfs_attach(), procfs_can_run(), procfs_can_use_hw_breakpoint(), procfs_create_inferior(), procfs_detach(), procfs_fetch_registers(), procfs_files_info(), procfs_find_new_threads(), procfs_insert_breakpoint(), procfs_insert_hw_breakpoint(), procfs_insert_hw_watchpoint(), procfs_kill_inferior(), procfs_mourn_inferior(), procfs_open(), procfs_ops, procfs_pass_signals(), procfs_pid_to_str(), procfs_post_attach(), procfs_prepare_to_store(), procfs_remove_breakpoint(), procfs_remove_hw_watchpoint(), procfs_resume(), procfs_stop(), procfs_stopped_by_watchpoint(), procfs_store_registers(), procfs_thread_alive(), procfs_wait(), procfs_xfer_memory(), terminal_inferior(), terminal_init_inferior(), terminal_ours(), terminal_ours_for_output(), target_ops::to_attach, target_ops::to_can_run, target_ops::to_can_use_hw_breakpoint, target_ops::to_create_inferior, target_ops::to_detach, target_ops::to_doc, target_ops::to_extra_thread_info, target_ops::to_fetch_registers, target_ops::to_files_info, target_ops::to_find_new_threads, target_ops::to_has_all_memory, target_ops::to_has_execution, target_ops::to_has_memory, target_ops::to_has_registers, target_ops::to_has_stack, target_ops::to_have_continuable_watchpoint, target_ops::to_insert_breakpoint, target_ops::to_insert_hw_breakpoint, target_ops::to_insert_watchpoint, target_ops::to_kill, target_ops::to_longname, target_ops::to_magic, target_ops::to_mourn_inferior, target_ops::to_open, target_ops::to_pass_signals, target_ops::to_pid_to_str, target_ops::to_post_attach, target_ops::to_prepare_to_store, target_ops::to_remove_breakpoint, target_ops::to_remove_hw_breakpoint, target_ops::to_remove_watchpoint, target_ops::to_resume, target_ops::to_shortname, target_ops::to_stop, target_ops::to_stopped_by_watchpoint, target_ops::to_store_registers, target_ops::to_stratum, target_ops::to_terminal_inferior, target_ops::to_terminal_info, target_ops::to_terminal_init, target_ops::to_terminal_ours, target_ops::to_terminal_ours_for_output, target_ops::to_thread_alive, and target_ops::to_wait.
Referenced by _initialize_procfs().
static void interrupt_query | ( | void | ) | [static] |
Definition at line 690 of file nto-procfs.c.
References _, query(), quit(), target_mourn_inferior(), target_terminal_inferior(), and target_terminal_ours.
Referenced by nto_interrupt_twice().
static void nto_interrupt | ( | int | signo | ) | [static] |
Definition at line 714 of file nto-procfs.c.
References inferior_ptid, nto_interrupt_twice(), and target_stop().
Referenced by procfs_wait().
static void nto_interrupt_twice | ( | int | signo | ) | [static] |
Definition at line 706 of file nto-procfs.c.
References interrupt_query(), and ofunc.
Referenced by nto_interrupt().
static unsigned nto_node | ( | void | ) | [static] |
Definition at line 92 of file nto-procfs.c.
References _, error(), nto_procfs_node, and nto_procfs_path.
Referenced by do_attach(), procfs_create_inferior(), procfs_detach(), procfs_mourn_inferior(), and procfs_resume().
static void procfs_attach | ( | struct target_ops * | ops, |
char * | args, | ||
int | from_tty | ||
) | [static] |
Definition at line 616 of file nto-procfs.c.
References _, inferior::attach_flag, current_inferior(), do_attach(), error(), gdb_flush(), gdb_stdout, get_exec_file(), arm-linux::inf, inferior_appeared(), inferior_ptid, parse_pid_to_attach(), inferior::pid, pid_to_ptid(), printf_unfiltered(), procfs_find_new_threads(), push_target(), and target_pid_to_str().
Referenced by init_procfs_ops().
static int procfs_breakpoint | ( | CORE_ADDR | addr, |
int | type, | ||
int | size | ||
) | [static] |
Definition at line 911 of file nto-procfs.c.
References ctl_fd, size, and type.
Referenced by procfs_insert_breakpoint(), procfs_insert_hw_breakpoint(), procfs_remove_breakpoint(), and procfs_remove_hw_breakpoint().
static int procfs_can_run | ( | void | ) | [static] |
Definition at line 609 of file nto-procfs.c.
Referenced by init_procfs_ops().
static int procfs_can_use_hw_breakpoint | ( | int | type, |
int | cnt, | ||
int | othertype | ||
) | [static] |
Definition at line 1491 of file nto-procfs.c.
Referenced by init_procfs_ops().
static void procfs_create_inferior | ( | struct target_ops * | ops, |
char * | exec_file, | ||
char * | allargs, | ||
char ** | env, | ||
int | from_tty | ||
) | [static] |
Definition at line 1090 of file nto-procfs.c.
References _, inferior::attach_flag, breakup_args(), ctl_fd, current_inferior(), do_attach(), error(), exec_bfd, flags, get_exec_file(), get_inferior_io_terminal(), arm-linux::inf, inferior_appeared(), inferior_ptid, memset(), nto_node(), nto_parse_redirection(), nto_procfs_node, pid_to_ptid(), procfs_find_new_threads(), push_target(), safe_strerror(), solib_create_inferior_hook(), symfile_objfile, target_terminal_init, xfree(), and xmalloc().
Referenced by init_procfs_ops().
static void procfs_detach | ( | struct target_ops * | ops, |
char * | args, | ||
int | from_tty | ||
) | [static] |
Definition at line 880 of file nto-procfs.c.
References ctl_fd, detach_inferior(), gdb_flush(), gdb_stdout, get_exec_file(), inferior_ptid, init_thread_list(), nto_node(), null_ptid, printf_unfiltered(), procfs_ops, ptid_get_pid(), target_pid_to_str(), and unpush_target().
Referenced by init_procfs_ops().
static void procfs_fetch_registers | ( | struct target_ops * | ops, |
struct regcache * | regcache, | ||
int | regno | ||
) | [static] |
Definition at line 826 of file nto-procfs.c.
References ctl_fd, inferior_ptid, nto_supply_altregset, nto_supply_fpregset, nto_supply_gregset, and procfs_set_thread().
Referenced by init_procfs_ops().
static void procfs_files_info | ( | struct target_ops * | ignore | ) | [static] |
Definition at line 597 of file nto-procfs.c.
References inferior::attach_flag, current_inferior(), inferior_ptid, nto_procfs_path, printf_unfiltered(), and target_pid_to_str().
Referenced by init_procfs_ops().
static void procfs_find_new_threads | ( | struct target_ops * | ops | ) | [static] |
Definition at line 316 of file nto-procfs.c.
References add_thread(), ctl_fd, find_thread_ptid(), inferior_ptid, new_thread(), ptid_build(), ptid_get_pid(), thread_info::state, exsummary::status, private_thread_info::tid, and update_thread_private_data().
Referenced by init_procfs_ops(), procfs_attach(), and procfs_create_inferior().
static int procfs_hw_watchpoint | ( | int | addr, |
int | len, | ||
int | type | ||
) | [static] |
Definition at line 1461 of file nto-procfs.c.
References _, ctl_fd, and len.
Referenced by procfs_insert_hw_watchpoint(), and procfs_remove_hw_watchpoint().
static int procfs_insert_breakpoint | ( | struct gdbarch * | gdbarch, |
struct bp_target_info * | bp_tgt | ||
) | [static] |
Definition at line 925 of file nto-procfs.c.
References bp_target_info::placed_address, and procfs_breakpoint().
Referenced by init_procfs_ops().
static int procfs_insert_hw_breakpoint | ( | struct gdbarch * | gdbarch, |
struct bp_target_info * | bp_tgt | ||
) | [static] |
Definition at line 939 of file nto-procfs.c.
References bp_target_info::placed_address, and procfs_breakpoint().
Referenced by init_procfs_ops().
static int procfs_insert_hw_watchpoint | ( | CORE_ADDR | addr, |
int | len, | ||
int | type, | ||
struct expression * | cond | ||
) | [static] |
Definition at line 1504 of file nto-procfs.c.
References procfs_hw_watchpoint().
Referenced by init_procfs_ops().
static enum gdb_osabi procfs_is_nto_target | ( | bfd * | abfd | ) | [static] |
Definition at line 107 of file nto-procfs.c.
References GDB_OSABI_QNXNTO.
Referenced by _initialize_procfs(), and procfs_open().
static void procfs_kill_inferior | ( | struct target_ops * | ops | ) | [static] |
Definition at line 1224 of file nto-procfs.c.
References target_mourn_inferior().
Referenced by init_procfs_ops().
void procfs_meminfo | ( | char * | args, |
int | from_tty | ||
) |
Definition at line 451 of file nto-procfs.c.
References ctl_fd, flags, memcpy(), memset(), min, name, offset, phex(), printf_filtered(), safe_strerror(), size, xfree(), and xmalloc().
Referenced by _initialize_procfs().
static void procfs_mourn_inferior | ( | struct target_ops * | ops | ) | [static] |
Definition at line 1016 of file nto-procfs.c.
References ctl_fd, generic_mourn_inferior(), inferior_ptid, init_thread_list(), nto_node(), null_ptid, procfs_ops, ptid_equal(), ptid_get_pid(), and unpush_target().
Referenced by init_procfs_ops().
static void procfs_open | ( | char * | arg, |
int | from_tty | ||
) | [static] |
Definition at line 117 of file nto-procfs.c.
References _, cleanup::arg, do_cleanups(), error(), gdbarch_bfd_arch_info(), init_thread_list(), make_cleanup_close(), nto_is_nto_target, nto_map_arch_to_cputype(), nto_procfs_node, nto_procfs_path, printf_filtered(), procfs_is_nto_target(), safe_strerror(), target_gdbarch(), and xfree().
Referenced by init_procfs_ops().
static void procfs_pass_signals | ( | int | numsigs, |
unsigned char * | pass_signals | ||
) | [static] |
Definition at line 1336 of file nto-procfs.c.
References gdb_signal_from_host(), and run.
Referenced by init_procfs_ops().
static char* procfs_pid_to_str | ( | struct target_ops * | ops, |
ptid_t | ptid | ||
) | [static] |
Definition at line 1358 of file nto-procfs.c.
References procfs_thread_info(), ptid_get_pid(), and ptid_get_tid().
Referenced by init_procfs_ops().
void procfs_pidlist | ( | char * | args, |
int | from_tty | ||
) |
Definition at line 359 of file nto-procfs.c.
References dirent, do_cleanups(), do_closedir_cleanup(), fprintf_unfiltered(), gdb_stderr, make_cleanup(), make_cleanup_close(), name, nto_procfs_path, printf_filtered(), safe_strerror(), and exsummary::status.
Referenced by _initialize_procfs().
static void procfs_post_attach | ( | pid_t | pid | ) | [static] |
Definition at line 651 of file nto-procfs.c.
References exec_bfd, and solib_create_inferior_hook().
Referenced by init_procfs_ops().
static void procfs_prepare_to_store | ( | struct regcache * | regcache | ) | [static] |
Definition at line 1232 of file nto-procfs.c.
Referenced by init_procfs_ops().
static int procfs_remove_breakpoint | ( | struct gdbarch * | gdbarch, |
struct bp_target_info * | bp_tgt | ||
) | [static] |
Definition at line 932 of file nto-procfs.c.
References bp_target_info::placed_address, and procfs_breakpoint().
Referenced by init_procfs_ops().
static int procfs_remove_hw_breakpoint | ( | struct gdbarch * | gdbarch, |
struct bp_target_info * | bp_tgt | ||
) | [static] |
Definition at line 947 of file nto-procfs.c.
References bp_target_info::placed_address, and procfs_breakpoint().
static int procfs_remove_hw_watchpoint | ( | CORE_ADDR | addr, |
int | len, | ||
int | type, | ||
struct expression * | cond | ||
) | [static] |
Definition at line 1497 of file nto-procfs.c.
References procfs_hw_watchpoint().
Referenced by init_procfs_ops().
static void procfs_resume | ( | struct target_ops * | ops, |
ptid_t | ptid, | ||
int | step, | ||
enum gdb_signal | signo | ||
) | [static] |
Definition at line 955 of file nto-procfs.c.
References _, ctl_fd, gdb_signal_to_host(), inferior_ptid, minus_one_ptid, nto_node(), null_ptid, procfs_set_thread(), ptid_equal(), ptid_get_pid(), run, and exsummary::status.
Referenced by init_procfs_ops().
static void procfs_set_thread | ( | ptid_t | ptid | ) | [static] |
Definition at line 210 of file nto-procfs.c.
References ctl_fd, and ptid_get_tid().
Referenced by procfs_fetch_registers(), procfs_resume(), and procfs_store_registers().
static void procfs_stop | ( | ptid_t | ptid | ) | [static] |
static int procfs_stopped_by_watchpoint | ( | void | ) | [static] |
Definition at line 1511 of file nto-procfs.c.
Referenced by init_procfs_ops().
static void procfs_store_registers | ( | struct target_ops * | ops, |
struct regcache * | regcache, | ||
int | regno | ||
) |
Definition at line 1270 of file nto-procfs.c.
References ctl_fd, fprintf_unfiltered(), gdb_stderr, get_regcache_arch(), get_regset(), inferior_ptid, len, NTO_REG_END, NTO_REG_GENERAL, nto_register_area, nto_regset_fill, nto_regset_id, null_ptid, procfs_set_thread(), ptid_equal(), regcache_raw_collect(), and safe_strerror().
Referenced by init_procfs_ops(), and procfs_target().
static int procfs_thread_alive | ( | struct target_ops * | ops, |
ptid_t | ptid | ||
) | [static] |
Definition at line 220 of file nto-procfs.c.
References ctl_fd, ptid_get_pid(), ptid_get_tid(), and exsummary::status.
Referenced by init_procfs_ops().
static struct tidinfo* procfs_thread_info | ( | pid_t | pid, |
short | tid | ||
) | [static, read] |
Definition at line 1351 of file nto-procfs.c.
Referenced by procfs_pid_to_str().
static ptid_t procfs_wait | ( | struct target_ops * | ops, |
ptid_t | ptid, | ||
struct target_waitstatus * | ourstatus, | ||
int | options | ||
) | [static] |
Definition at line 723 of file nto-procfs.c.
References _DEBUG_FLAG_TRACE, ctl_fd, gdb_signal_from_host(), inferior_ptid, target_waitstatus::integer, target_waitstatus::kind, nto_interrupt(), null_ptid, ofunc, ptid_build(), ptid_equal(), ptid_get_pid(), target_waitstatus::sig, exsummary::status, TARGET_WAITKIND_EXITED, TARGET_WAITKIND_SIGNALLED, TARGET_WAITKIND_SPURIOUS, TARGET_WAITKIND_STOPPED, and target_waitstatus::value.
Referenced by init_procfs_ops().
static int procfs_xfer_memory | ( | CORE_ADDR | memaddr, |
gdb_byte * | myaddr, | ||
int | len, | ||
int | dowrite, | ||
struct mem_attrib * | attrib, | ||
struct target_ops * | target | ||
) | [static] |
Definition at line 858 of file nto-procfs.c.
References ctl_fd, and read().
Referenced by init_procfs_ops().
static void update_thread_private_data | ( | struct thread_info * | new_thread, |
pthread_t | tid, | ||
int | state, | ||
int | flags | ||
) | [static] |
Definition at line 278 of file nto-procfs.c.
References ctl_fd, private_thread_info::flags, gdb_assert, memset(), thread_info::private, private_thread_info::state, private_thread_info::tid, and update_thread_private_data_name().
Referenced by procfs_find_new_threads().
static void update_thread_private_data_name | ( | struct thread_info * | new_thread, |
const char * | newname | ||
) | [static] |
Definition at line 247 of file nto-procfs.c.
References gdb_assert, memcpy(), name, private_thread_info::name, thread_info::private, xmalloc(), and xrealloc().
Referenced by update_thread_private_data().
Definition at line 52 of file nto-procfs.c.
Referenced by do_attach(), get_regset(), procfs_breakpoint(), procfs_create_inferior(), procfs_detach(), procfs_fetch_registers(), procfs_find_new_threads(), procfs_hw_watchpoint(), procfs_meminfo(), procfs_mourn_inferior(), procfs_resume(), procfs_set_thread(), procfs_stop(), procfs_store_registers(), procfs_thread_alive(), procfs_wait(), procfs_xfer_memory(), and update_thread_private_data().
unsigned nto_procfs_node = ND_LOCAL_NODE [static] |
Definition at line 85 of file nto-procfs.c.
Referenced by nto_node(), procfs_create_inferior(), and procfs_open().
char nto_procfs_path[PATH_MAX] = { "/proc" } [static] |
Definition at line 84 of file nto-procfs.c.
Referenced by do_attach(), nto_node(), procfs_files_info(), procfs_open(), and procfs_pidlist().
void(* ofunc)() [static] |
Definition at line 54 of file nto-procfs.c.
Referenced by nto_interrupt_twice(), and procfs_wait().
struct target_ops procfs_ops [static] |
Definition at line 50 of file nto-procfs.c.
Referenced by _initialize_procfs(), init_procfs_ops(), procfs_detach(), and procfs_mourn_inferior().
procfs_run run [static] |
Definition at line 56 of file nto-procfs.c.
Referenced by _initialize_procfs(), env_execute_cli_command(), mi_execute_async_cli_command(), mi_execute_cli_command(), procfs_pass_signals(), and procfs_resume().