GDB (xrefs)
Classes | Macros | Enumerations | Functions | Variables
/tmp/gdb-7.10/gdb/remote-sim.c File Reference
#include "defs.h"
#include "gdb_bfd.h"
#include "inferior.h"
#include "infrun.h"
#include "value.h"
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
#include <setjmp.h>
#include "terminal.h"
#include "target.h"
#include "gdbcore.h"
#include "gdb/callback.h"
#include "gdb/remote-sim.h"
#include "command.h"
#include "regcache.h"
#include "sim-regno.h"
#include "arch-utils.h"
#include "readline/readline.h"
#include "gdbthread.h"

Go to the source code of this file.

Classes

struct  resume_data
 

Macros

#define INITIAL_PID   42000
 

Enumerations

enum  { SIM_INSTANCE_NOT_NEEDED = 0, SIM_INSTANCE_NEEDED = 1 }
 

Functions

void _initialize_remote_sim (void)
 
static void init_callbacks (void)
 
static void end_callbacks (void)
 
static int gdb_os_write_stdout (host_callback *, const char *, int)
 
static void gdb_os_flush_stdout (host_callback *)
 
static int gdb_os_write_stderr (host_callback *, const char *, int)
 
static void gdb_os_flush_stderr (host_callback *)
 
static int gdb_os_poll_quit (host_callback *)
 
static void gdb_os_printf_filtered (host_callback *, const char *,...)
 
static void gdb_os_vprintf_filtered (host_callback *, const char *, va_list)
 
static void gdb_os_evprintf_filtered (host_callback *, const char *, va_list)
 
static void gdb_os_error (host_callback *, const char *,...)
 
static int check_for_duplicate_sim_descriptor (struct inferior *inf, void *arg)
 
static struct sim_inferior_data * get_sim_inferior_data (struct inferior *inf, int sim_instance_needed)
 
static struct sim_inferior_data * get_sim_inferior_data_by_ptid (ptid_t ptid, int sim_instance_needed)
 
static void sim_inferior_data_cleanup (struct inferior *inf, void *data)
 
static void dump_mem (const gdb_byte *buf, int len)
 
int one2one_register_sim_regno (struct gdbarch *gdbarch, int regnum)
 
static void gdbsim_fetch_register (struct target_ops *ops, struct regcache *regcache, int regno)
 
static void gdbsim_store_register (struct target_ops *ops, struct regcache *regcache, int regno)
 
static void gdbsim_kill (struct target_ops *ops)
 
static void gdbsim_load (struct target_ops *self, const char *args, int fromtty)
 
static void gdbsim_create_inferior (struct target_ops *target, char *exec_file, char *args, char **env, int from_tty)
 
static void gdbsim_open (const char *args, int from_tty)
 
static int gdbsim_close_inferior (struct inferior *inf, void *arg)
 
static void gdbsim_close (struct target_ops *self)
 
static void gdbsim_detach (struct target_ops *ops, const char *args, int from_tty)
 
static int gdbsim_resume_inferior (struct inferior *inf, void *arg)
 
static void gdbsim_resume (struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal siggnal)
 
static int gdbsim_stop_inferior (struct inferior *inf, void *arg)
 
static void gdbsim_stop (struct target_ops *self, ptid_t ptid)
 
static void gdbsim_cntrl_c (int signo)
 
static ptid_t gdbsim_wait (struct target_ops *ops, ptid_t ptid, struct target_waitstatus *status, int options)
 
static void gdbsim_prepare_to_store (struct target_ops *self, struct regcache *regcache)
 
static enum target_xfer_status gdbsim_xfer_memory (struct target_ops *target, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST memaddr, ULONGEST len, ULONGEST *xfered_len)
 
static enum target_xfer_status gdbsim_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 gdbsim_files_info (struct target_ops *target)
 
static void gdbsim_mourn_inferior (struct target_ops *target)
 
void simulator_command (char *args, int from_tty)
 
static VEC (char_ptr)
 
static int gdbsim_thread_alive (struct target_ops *ops, ptid_t ptid)
 
static char * gdbsim_pid_to_str (struct target_ops *ops, ptid_t ptid)
 
static int gdbsim_has_all_memory (struct target_ops *ops)
 
static int gdbsim_has_memory (struct target_ops *ops)
 
static void init_gdbsim_ops (void)
 

Variables

static int gdbsim_is_open = 0
 
static int next_pid
 
static char ** sim_argv = NULL
 
static host_callback gdb_callback
 
static int callbacks_initialized = 0
 
struct target_ops gdbsim_ops
 

Macro Definition Documentation

#define INITIAL_PID   42000

Definition at line 135 of file remote-sim.c.

Referenced by gdbsim_open().

Enumeration Type Documentation

anonymous enum
Enumerator
SIM_INSTANCE_NOT_NEEDED 
SIM_INSTANCE_NEEDED 

Definition at line 165 of file remote-sim.c.

Function Documentation

void _initialize_remote_sim ( void  )
static int check_for_duplicate_sim_descriptor ( struct inferior inf,
void *  arg 
)
static

Definition at line 152 of file remote-sim.c.

Referenced by get_sim_inferior_data().

static void dump_mem ( const gdb_byte buf,
int  len 
)
static
static void end_callbacks ( void  )
static

Definition at line 324 of file remote-sim.c.

References callbacks_initialized, and gdb_callback.

Referenced by gdbsim_close().

static void gdb_os_error ( host_callback *  p,
const char *  format,
  ... 
)
static

Definition at line 69 of file remote-sim.c.

References resume_step.

Referenced by init_callbacks().

static void gdb_os_evprintf_filtered ( host_callback *  p,
const char *  format,
va_list  ap 
)
static

Definition at line 401 of file remote-sim.c.

References gdb_stderr, and vfprintf_filtered().

Referenced by init_callbacks().

static void gdb_os_flush_stderr ( host_callback *  p)
static

Definition at line 373 of file remote-sim.c.

References gdb_flush(), and gdb_stdtargerr.

Referenced by init_callbacks().

static void gdb_os_flush_stdout ( host_callback *  p)
static

Definition at line 348 of file remote-sim.c.

References gdb_flush(), and gdb_stdtarg.

Referenced by init_callbacks().

static int gdb_os_poll_quit ( host_callback *  p)
static

Definition at line 951 of file remote-sim.c.

References check_quit_flag(), clear_quit_flag(), and deprecated_ui_loop_hook.

Referenced by init_callbacks().

static void gdb_os_printf_filtered ( host_callback *  p,
const char *  format,
  ... 
)
static

Definition at line 381 of file remote-sim.c.

References gdb_stdout, and vfprintf_filtered().

Referenced by init_callbacks().

static void gdb_os_vprintf_filtered ( host_callback *  p,
const char *  format,
va_list  ap 
)
static

Definition at line 393 of file remote-sim.c.

References gdb_stdout, and vfprintf_filtered().

Referenced by init_callbacks().

static int gdb_os_write_stderr ( host_callback *  p,
const char *  buf,
int  len 
)
static

Definition at line 356 of file remote-sim.c.

References fputs_unfiltered(), gdb_stdtargerr, and len.

Referenced by init_callbacks().

static int gdb_os_write_stdout ( host_callback *  p,
const char *  buf,
int  len 
)
static

Definition at line 336 of file remote-sim.c.

References gdb_stdtarg, len, and ui_file_write().

Referenced by init_callbacks().

static void gdbsim_close ( struct target_ops self)
static
static int gdbsim_close_inferior ( struct inferior inf,
void *  arg 
)
static
static void gdbsim_cntrl_c ( int  signo)
static

Definition at line 969 of file remote-sim.c.

References gdbsim_stop(), and minus_one_ptid.

Referenced by gdbsim_wait().

static void gdbsim_create_inferior ( struct target_ops target,
char *  exec_file,
char *  args,
char **  env,
int  from_tty 
)
static
static void gdbsim_detach ( struct target_ops ops,
const char *  args,
int  from_tty 
)
static
static void gdbsim_fetch_register ( struct target_ops ops,
struct regcache regcache,
int  regno 
)
static
static void gdbsim_files_info ( struct target_ops target)
static
static int gdbsim_has_all_memory ( struct target_ops ops)
static

Definition at line 1280 of file remote-sim.c.

References current_inferior(), get_sim_inferior_data(), and SIM_INSTANCE_NOT_NEEDED.

Referenced by init_gdbsim_ops().

static int gdbsim_has_memory ( struct target_ops ops)
static

Definition at line 1292 of file remote-sim.c.

References current_inferior(), get_sim_inferior_data(), and SIM_INSTANCE_NOT_NEEDED.

Referenced by init_gdbsim_ops().

static void gdbsim_kill ( struct target_ops ops)
static
static void gdbsim_load ( struct target_ops self,
const char *  args,
int  fromtty 
)
static
static void gdbsim_mourn_inferior ( struct target_ops target)
static
static void gdbsim_open ( const char *  args,
int  from_tty 
)
static
static char* gdbsim_pid_to_str ( struct target_ops ops,
ptid_t  ptid 
)
static

Definition at line 1272 of file remote-sim.c.

References normal_pid_to_str().

Referenced by init_gdbsim_ops().

static void gdbsim_prepare_to_store ( struct target_ops self,
struct regcache regcache 
)
static

Definition at line 1061 of file remote-sim.c.

Referenced by init_gdbsim_ops().

static void gdbsim_resume ( struct target_ops ops,
ptid_t  ptid,
int  step,
enum gdb_signal  siggnal 
)
static
static int gdbsim_resume_inferior ( struct inferior inf,
void *  arg 
)
static
static void gdbsim_stop ( struct target_ops self,
ptid_t  ptid 
)
static
static int gdbsim_stop_inferior ( struct inferior inf,
void *  arg 
)
static

Definition at line 907 of file remote-sim.c.

References get_sim_inferior_data(), quit(), and SIM_INSTANCE_NEEDED.

Referenced by gdbsim_stop().

static void gdbsim_store_register ( struct target_ops ops,
struct regcache regcache,
int  regno 
)
static
static int gdbsim_thread_alive ( struct target_ops ops,
ptid_t  ptid 
)
static

Definition at line 1253 of file remote-sim.c.

References get_sim_inferior_data_by_ptid(), ptid_equal(), and SIM_INSTANCE_NOT_NEEDED.

Referenced by init_gdbsim_ops().

static ptid_t gdbsim_wait ( struct target_ops ops,
ptid_t  ptid,
struct target_waitstatus status,
int  options 
)
static
static enum target_xfer_status gdbsim_xfer_memory ( struct target_ops target,
gdb_byte readbuf,
const gdb_byte writebuf,
ULONGEST  memaddr,
ULONGEST  len,
ULONGEST xfered_len 
)
static
static enum target_xfer_status gdbsim_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

Definition at line 1130 of file remote-sim.c.

References gdbsim_xfer_memory(), TARGET_OBJECT_MEMORY, and TARGET_XFER_E_IO.

Referenced by init_gdbsim_ops().

static struct sim_inferior_data* get_sim_inferior_data ( struct inferior inf,
int  sim_instance_needed 
)
static
static struct sim_inferior_data* get_sim_inferior_data_by_ptid ( ptid_t  ptid,
int  sim_instance_needed 
)
static
static void init_callbacks ( void  )
static
static void init_gdbsim_ops ( void  )
static
int one2one_register_sim_regno ( struct gdbarch gdbarch,
int  regnum 
)

Definition at line 419 of file remote-sim.c.

References gdb_assert, gdbarch_num_regs(), and regnum.

static void sim_inferior_data_cleanup ( struct inferior inf,
void *  data 
)
static

Definition at line 258 of file remote-sim.c.

References xfree().

Referenced by _initialize_remote_sim(), and gdbsim_close_inferior().

void simulator_command ( char *  args,
int  from_tty 
)

Definition at line 1187 of file remote-sim.c.

References _, current_inferior(), error(), and registers_changed().

Referenced by _initialize_remote_sim().

static VEC ( char_ptr  )
static

Definition at line 1225 of file remote-sim.c.

References current_inferior(), VEC_safe_push, and xfree().

Variable Documentation

int callbacks_initialized = 0
static

Definition at line 145 of file remote-sim.c.

Referenced by end_callbacks(), and init_callbacks().

host_callback gdb_callback
static

Definition at line 144 of file remote-sim.c.

Referenced by end_callbacks(), gdbsim_open(), get_sim_inferior_data(), and init_callbacks().

int gdbsim_is_open = 0
static

Definition at line 129 of file remote-sim.c.

Referenced by gdbsim_close(), and gdbsim_open().

struct target_ops gdbsim_ops

Definition at line 1305 of file remote-sim.c.

Referenced by _initialize_remote_sim(), gdbsim_open(), and init_gdbsim_ops().

int next_pid
static

Definition at line 134 of file remote-sim.c.

Referenced by gdbsim_open(), and get_sim_inferior_data().

char** sim_argv = NULL
static

Definition at line 141 of file remote-sim.c.

Referenced by gdbsim_close(), gdbsim_open(), and get_sim_inferior_data().