GDB (xrefs)
Classes | Defines | Enumerations | Functions | Variables
/home/stan/gdb/src/gdb/remote-sim.c File Reference
#include "defs.h"
#include "inferior.h"
#include "value.h"
#include "gdb_string.h"
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
#include <setjmp.h>
#include <errno.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 "gdb_assert.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

Defines

#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 (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 (char *args, int from_tty)
static int gdbsim_close_inferior (struct inferior *inf, void *arg)
static void gdbsim_close (void)
static void gdbsim_detach (struct target_ops *ops, 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 (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 regcache *regcache)
static LONGEST gdbsim_xfer_memory (struct target_ops *target, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST memaddr, LONGEST len)
static LONGEST gdbsim_xfer_partial (struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST 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

Define Documentation

#define INITIAL_PID   42000

Definition at line 133 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 163 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 150 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 322 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 70 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 399 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 371 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 346 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 944 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 379 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 391 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 354 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 334 of file remote-sim.c.

References gdb_stdtarg, len, and ui_file_write().

Referenced by init_callbacks().

static void gdbsim_close ( void  ) [static]
static int gdbsim_close_inferior ( struct inferior inf,
void *  arg 
) [static]
static void gdbsim_cntrl_c ( int  signo) [static]

Definition at line 962 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,
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 1262 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 1274 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 ( char *  args,
int  fromtty 
) [static]
static void gdbsim_mourn_inferior ( struct target_ops target) [static]
static void gdbsim_open ( char *  args,
int  from_tty 
) [static]
static char* gdbsim_pid_to_str ( struct target_ops ops,
ptid_t  ptid 
) [static]

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

References normal_pid_to_str().

Referenced by init_gdbsim_ops().

static void gdbsim_prepare_to_store ( struct regcache regcache) [static]

Definition at line 1054 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 ( ptid_t  ptid) [static]
static int gdbsim_stop_inferior ( struct inferior inf,
void *  arg 
) [static]

Definition at line 900 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 1235 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 LONGEST gdbsim_xfer_memory ( struct target_ops target,
gdb_byte readbuf,
const gdb_byte writebuf,
ULONGEST  memaddr,
LONGEST  len 
) [static]
static LONGEST gdbsim_xfer_partial ( struct target_ops ops,
enum target_object  object,
const char *  annex,
gdb_byte readbuf,
const gdb_byte writebuf,
ULONGEST  offset,
LONGEST  len 
) [static]

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

References gdbsim_xfer_memory(), and TARGET_OBJECT_MEMORY.

Referenced by init_gdbsim_ops().

static struct sim_inferior_data* get_sim_inferior_data ( struct inferior inf,
int  sim_instance_needed 
) [static, read]
static struct sim_inferior_data* get_sim_inferior_data_by_ptid ( ptid_t  ptid,
int  sim_instance_needed 
) [static, read]
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 417 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 256 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 1169 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 1207 of file remote-sim.c.

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


Variable Documentation

int callbacks_initialized = 0 [static]

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

Referenced by end_callbacks(), and init_callbacks().

host_callback gdb_callback [static]

Definition at line 142 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 127 of file remote-sim.c.

Referenced by gdbsim_close(), and gdbsim_open().

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

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

int next_pid [static]

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

Referenced by gdbsim_open(), and get_sim_inferior_data().

char** sim_argv = NULL [static]

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

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

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines