GDB (xrefs)
Macros | Functions | Variables
/tmp/gdb-7.10/gdb/nto-procfs.c File Reference
#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 <dirent.h>
#include <sys/netmgr.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"
#include "inf-child.h"

Go to the source code of this file.

Macros

#define NULL_PID   0
 
#define _DEBUG_FLAG_TRACE
 
#define OSTYPE_NTO   1
 

Functions

static ptid_t do_attach (ptid_t ptid)
 
static int procfs_can_use_hw_breakpoint (struct target_ops *self, int, int, int)
 
static int procfs_insert_hw_watchpoint (struct target_ops *self, CORE_ADDR addr, int len, int type, struct expression *cond)
 
static int procfs_remove_hw_watchpoint (struct target_ops *self, CORE_ADDR addr, int len, int type, struct expression *cond)
 
static int procfs_stopped_by_watchpoint (struct target_ops *ops)
 
static unsigned nto_node (void)
 
static enum gdb_osabi procfs_is_nto_target (bfd *abfd)
 
static void procfs_open_1 (struct target_ops *ops, const char *arg, int from_tty)
 
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_update_thread_list (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, const char *args, int from_tty)
 
static void procfs_post_attach (struct target_ops *self, 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 enum target_xfer_status procfs_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST memaddr, ULONGEST len, ULONGEST *xfered_len)
 
static enum target_xfer_status procfs_xfer_partial (struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
 
static void procfs_detach (struct target_ops *ops, const char *args, int from_tty)
 
static int procfs_breakpoint (CORE_ADDR addr, int type, int size)
 
static int procfs_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
 
static int procfs_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
 
static int procfs_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
 
static int procfs_remove_hw_breakpoint (struct target_ops *self, 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 (struct target_ops *self, ptid_t ptid)
 
static void procfs_kill_inferior (struct target_ops *ops)
 
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 (struct target_ops *self, 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)
 
static int procfs_can_run (struct target_ops *self)
 
static void procfs_open (const char *arg, int from_tty)
 
static void procfs_native_open (const char *arg, int from_tty)
 
static void init_procfs_targets (void)
 
void _initialize_procfs (void)
 
static int procfs_hw_watchpoint (int addr, int len, int type)
 

Variables

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
 
static struct target_ops nto_procfs_ops
 
static struct target_opsnto_native_ops
 

Macro Definition Documentation

#define _DEBUG_FLAG_TRACE
Value:
(_DEBUG_FLAG_TRACE_EXEC|_DEBUG_FLAG_TRACE_RD|\
_DEBUG_FLAG_TRACE_WR|_DEBUG_FLAG_TRACE_MODIFY)

Definition at line 45 of file nto-procfs.c.

Referenced by procfs_wait().

#define NULL_PID   0

Definition at line 44 of file nto-procfs.c.

#define OSTYPE_NTO   1

Definition at line 1467 of file nto-procfs.c.

Function Documentation

void _initialize_procfs ( void  )
static void breakup_args ( char *  scratch,
char **  argv 
)
static

Definition at line 1043 of file nto-procfs.c.

Referenced by procfs_create_inferior().

static ptid_t do_attach ( ptid_t  ptid)
static
static void do_closedir_cleanup ( void *  dir)
static

Definition at line 349 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 1238 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_targets ( void  )
static

Definition at line 1415 of file nto-procfs.c.

References add_target(), inf_child_target(), nto_extra_thread_info(), nto_procfs_ops, procfs_attach(), procfs_can_run(), procfs_can_use_hw_breakpoint(), procfs_create_inferior(), procfs_detach(), procfs_fetch_registers(), procfs_files_info(), procfs_insert_breakpoint(), procfs_insert_hw_breakpoint(), procfs_insert_hw_watchpoint(), procfs_kill_inferior(), procfs_mourn_inferior(), procfs_native_open(), procfs_open(), procfs_pass_signals(), procfs_pid_to_str(), procfs_post_attach(), procfs_remove_breakpoint(), procfs_remove_hw_breakpoint(), procfs_remove_hw_watchpoint(), procfs_resume(), procfs_stop(), procfs_stopped_by_watchpoint(), procfs_store_registers(), procfs_thread_alive(), procfs_update_thread_list(), procfs_wait(), procfs_xfer_partial(), 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_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_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_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_thread_alive, target_ops::to_update_thread_list, target_ops::to_wait, and target_ops::to_xfer_partial.

Referenced by _initialize_procfs().

static void interrupt_query ( void  )
static
static void nto_interrupt ( int  signo)
static

Definition at line 703 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 695 of file nto-procfs.c.

References interrupt_query(), and ofunc.

Referenced by nto_interrupt().

static unsigned nto_node ( void  )
static
static void procfs_attach ( struct target_ops ops,
const char *  args,
int  from_tty 
)
static
static int procfs_breakpoint ( CORE_ADDR  addr,
int  type,
int  size 
)
static
static int procfs_can_run ( struct target_ops self)
static

Definition at line 1385 of file nto-procfs.c.

Referenced by init_procfs_targets().

static int procfs_can_use_hw_breakpoint ( struct target_ops self,
int  type,
int  cnt,
int  othertype 
)
static

Definition at line 1527 of file nto-procfs.c.

Referenced by init_procfs_targets().

static void procfs_create_inferior ( struct target_ops ops,
char *  exec_file,
char *  allargs,
char **  env,
int  from_tty 
)
static
static void procfs_detach ( struct target_ops ops,
const char *  args,
int  from_tty 
)
static
static void procfs_fetch_registers ( struct target_ops ops,
struct regcache regcache,
int  regno 
)
static
static void procfs_files_info ( struct target_ops ignore)
static
static int procfs_hw_watchpoint ( int  addr,
int  len,
int  type 
)
static

Definition at line 1497 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 target_ops ops,
struct gdbarch gdbarch,
struct bp_target_info bp_tgt 
)
static
static int procfs_insert_hw_breakpoint ( struct target_ops self,
struct gdbarch gdbarch,
struct bp_target_info bp_tgt 
)
static
static int procfs_insert_hw_watchpoint ( struct target_ops self,
CORE_ADDR  addr,
int  len,
int  type,
struct expression cond 
)
static

Definition at line 1542 of file nto-procfs.c.

References procfs_hw_watchpoint().

Referenced by init_procfs_targets().

static enum gdb_osabi procfs_is_nto_target ( bfd *  abfd)
static

Definition at line 96 of file nto-procfs.c.

References GDB_OSABI_QNXNTO.

Referenced by _initialize_procfs(), and procfs_open_1().

static void procfs_kill_inferior ( struct target_ops ops)
static

Definition at line 1230 of file nto-procfs.c.

References target_mourn_inferior().

Referenced by init_procfs_targets().

void procfs_meminfo ( char *  args,
int  from_tty 
)

Definition at line 447 of file nto-procfs.c.

References ctl_fd, err, flags, 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
static void procfs_native_open ( const char *  arg,
int  from_tty 
)
static

Definition at line 1407 of file nto-procfs.c.

References procfs_open_1().

Referenced by init_procfs_targets().

static void procfs_open ( const char *  arg,
int  from_tty 
)
static

Definition at line 1399 of file nto-procfs.c.

References nto_procfs_ops, and procfs_open_1().

Referenced by init_procfs_targets().

static void procfs_open_1 ( struct target_ops ops,
const char *  arg,
int  from_tty 
)
static
static void procfs_pass_signals ( struct target_ops self,
int  numsigs,
unsigned char *  pass_signals 
)
static

Definition at line 1335 of file nto-procfs.c.

References gdb_signal_from_host(), and run.

Referenced by init_procfs_targets().

static char* procfs_pid_to_str ( struct target_ops ops,
ptid_t  ptid 
)
static

Definition at line 1358 of file nto-procfs.c.

References pid, procfs_thread_info(), ptid_get_pid(), and ptid_get_tid().

Referenced by init_procfs_targets().

void procfs_pidlist ( char *  args,
int  from_tty 
)
static void procfs_post_attach ( struct target_ops self,
pid_t  pid 
)
static

Definition at line 640 of file nto-procfs.c.

References exec_bfd, and solib_create_inferior_hook().

Referenced by init_procfs_targets().

static int procfs_remove_breakpoint ( struct target_ops ops,
struct gdbarch gdbarch,
struct bp_target_info bp_tgt 
)
static

Definition at line 936 of file nto-procfs.c.

References bp_target_info::placed_address, and procfs_breakpoint().

Referenced by init_procfs_targets().

static int procfs_remove_hw_breakpoint ( struct target_ops self,
struct gdbarch gdbarch,
struct bp_target_info bp_tgt 
)
static

Definition at line 952 of file nto-procfs.c.

References bp_target_info::placed_address, and procfs_breakpoint().

Referenced by init_procfs_targets().

static int procfs_remove_hw_watchpoint ( struct target_ops self,
CORE_ADDR  addr,
int  len,
int  type,
struct expression cond 
)
static

Definition at line 1534 of file nto-procfs.c.

References procfs_hw_watchpoint().

Referenced by init_procfs_targets().

static void procfs_resume ( struct target_ops ops,
ptid_t  ptid,
int  step,
enum gdb_signal  signo 
)
static
static void procfs_set_thread ( ptid_t  ptid)
static

Definition at line 204 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 ( struct target_ops self,
ptid_t  ptid 
)
static

Definition at line 1224 of file nto-procfs.c.

References ctl_fd.

Referenced by init_procfs_targets().

static int procfs_stopped_by_watchpoint ( struct target_ops ops)
static

Definition at line 1550 of file nto-procfs.c.

Referenced by init_procfs_targets().

static void procfs_store_registers ( struct target_ops ops,
struct regcache regcache,
int  regno 
)
static int procfs_thread_alive ( struct target_ops ops,
ptid_t  ptid 
)
static

Definition at line 214 of file nto-procfs.c.

References ctl_fd, err, pid, ptid_get_pid(), ptid_get_tid(), and status.

Referenced by init_procfs_targets().

static struct tidinfo* procfs_thread_info ( pid_t  pid,
short  tid 
)
static

Definition at line 1351 of file nto-procfs.c.

Referenced by procfs_pid_to_str().

static void procfs_update_thread_list ( struct target_ops ops)
static
static ptid_t procfs_wait ( struct target_ops ops,
ptid_t  ptid,
struct target_waitstatus ourstatus,
int  options 
)
static
static enum target_xfer_status procfs_xfer_memory ( gdb_byte readbuf,
const gdb_byte writebuf,
ULONGEST  memaddr,
ULONGEST  len,
ULONGEST xfered_len 
)
static

Definition at line 842 of file nto-procfs.c.

References ctl_fd, read(), SEEK_SET, TARGET_XFER_E_IO, and TARGET_XFER_OK.

Referenced by procfs_xfer_partial().

static enum target_xfer_status procfs_xfer_partial ( struct target_ops ops,
enum target_object  object,
const char *  annex,
gdb_byte readbuf,
const gdb_byte writebuf,
ULONGEST  offset,
ULONGEST  len,
ULONGEST xfered_len 
)
static
static void update_thread_private_data ( struct thread_info new_thread,
pthread_t  tid,
int  state,
int  flags 
)
static
static void update_thread_private_data_name ( struct thread_info new_thread,
const char *  newname 
)
static

Variable Documentation

int ctl_fd
struct target_ops* nto_native_ops
static

Definition at line 1394 of file nto-procfs.c.

unsigned nto_procfs_node = ND_LOCAL_NODE
static

Definition at line 74 of file nto-procfs.c.

Referenced by nto_node(), procfs_create_inferior(), and procfs_open_1().

struct target_ops nto_procfs_ops
static

Definition at line 1391 of file nto-procfs.c.

Referenced by init_procfs_targets(), and procfs_open().

char nto_procfs_path[PATH_MAX] = { "/proc" }
static

Definition at line 73 of file nto-procfs.c.

Referenced by do_attach(), nto_node(), procfs_files_info(), procfs_open_1(), and procfs_pidlist().

void(* ofunc) ()
static

Definition at line 50 of file nto-procfs.c.

Referenced by nto_interrupt_twice(), and procfs_wait().

procfs_run run
static