GDB (xrefs)
|
#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 |
#define INITIAL_PID 42000 |
Definition at line 135 of file remote-sim.c.
Referenced by gdbsim_open().
anonymous enum |
Enumerator | |
---|---|
SIM_INSTANCE_NOT_NEEDED | |
SIM_INSTANCE_NEEDED |
Definition at line 165 of file remote-sim.c.
void _initialize_remote_sim | ( | void | ) |
Definition at line 1342 of file remote-sim.c.
References _, add_com(), add_target(), class_obscure, gdbsim_ops, init_gdbsim_ops(), set_cmd_completer(), sim_inferior_data_cleanup(), and simulator_command().
Definition at line 152 of file remote-sim.c.
Referenced by get_sim_inferior_data().
Definition at line 274 of file remote-sim.c.
References fprintf_unfiltered(), fputs_unfiltered(), gdb_stdlog, and len.
Referenced by gdbsim_fetch_register(), gdbsim_store_register(), and gdbsim_xfer_memory().
|
static |
Definition at line 324 of file remote-sim.c.
References callbacks_initialized, and gdb_callback.
Referenced by gdbsim_close().
|
static |
|
static |
Definition at line 401 of file remote-sim.c.
References gdb_stderr, and vfprintf_filtered().
Referenced by init_callbacks().
|
static |
Definition at line 373 of file remote-sim.c.
References gdb_flush(), and gdb_stdtargerr.
Referenced by init_callbacks().
|
static |
Definition at line 348 of file remote-sim.c.
References gdb_flush(), and gdb_stdtarg.
Referenced by init_callbacks().
|
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 |
Definition at line 381 of file remote-sim.c.
References gdb_stdout, and vfprintf_filtered().
Referenced by init_callbacks().
|
static |
Definition at line 393 of file remote-sim.c.
References gdb_stdout, and vfprintf_filtered().
Referenced by init_callbacks().
Definition at line 356 of file remote-sim.c.
References fputs_unfiltered(), gdb_stdtargerr, and len.
Referenced by init_callbacks().
Definition at line 336 of file remote-sim.c.
References gdb_stdtarg, len, and ui_file_write().
Referenced by init_callbacks().
|
static |
Definition at line 796 of file remote-sim.c.
References current_inferior(), end_callbacks(), fprintf_unfiltered(), gdb_stdlog, gdbsim_close_inferior(), gdbsim_is_open, get_sim_inferior_data(), iterate_over_inferiors(), remote_debug, sim_argv, and SIM_INSTANCE_NOT_NEEDED.
Referenced by init_gdbsim_ops().
Definition at line 767 of file remote-sim.c.
References find_inferior_ptid(), generic_mourn_inferior(), sim_inferior_data_cleanup(), and switch_to_thread().
Referenced by gdbsim_close().
|
static |
Definition at line 969 of file remote-sim.c.
References gdbsim_stop(), and minus_one_ptid.
Referenced by gdbsim_wait().
|
static |
Definition at line 607 of file remote-sim.c.
References _, add_thread_silent(), clear_proceed_status(), current_inferior(), error(), exec_bfd, fprintf_unfiltered(), gdb_buildargv(), gdb_stdlog, gdbsim_kill(), get_sim_inferior_data(), have_inferiors(), inferior_appeared(), inferior_ptid, init_thread_list(), init_wait_for_inferior(), insert_breakpoints(), len, make_cleanup_freeargv(), ptid_equal(), ptid_get_pid(), remote_debug, remove_breakpoints(), SIM_INSTANCE_NEEDED, and warning().
Referenced by init_gdbsim_ops().
|
static |
Definition at line 827 of file remote-sim.c.
References fprintf_unfiltered(), gdb_stdlog, printf_filtered(), remote_debug, target_shortname, and unpush_target().
Referenced by init_gdbsim_ops().
|
static |
Definition at line 427 of file remote-sim.c.
References current_inferior(), dump_mem(), fprintf_unfiltered(), gdb_assert, gdb_stderr, gdb_stdlog, gdbarch_num_regs(), gdbarch_register_name(), gdbarch_register_sim_regno(), get_regcache_arch(), get_sim_inferior_data(), LEGACY_SIM_REGNO_IGNORE, MAX_REGISTER_SIZE, regcache_raw_supply(), register_size(), remote_debug, SIM_INSTANCE_NEEDED, and SIM_REGNO_DOES_NOT_EXIST.
Referenced by init_gdbsim_ops().
|
static |
Definition at line 1147 of file remote-sim.c.
References current_inferior(), exec_bfd, fprintf_unfiltered(), gdb_stdlog, get_sim_inferior_data(), remote_debug, SIM_INSTANCE_NEEDED, and target_shortname.
Referenced by init_gdbsim_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 |
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 |
Definition at line 549 of file remote-sim.c.
References fprintf_unfiltered(), gdb_stdlog, remote_debug, and target_mourn_inferior().
Referenced by gdbsim_create_inferior(), and init_gdbsim_ops().
|
static |
Definition at line 564 of file remote-sim.c.
References _, current_inferior(), error(), error_no_arg(), fprintf_unfiltered(), gdb_buildargv(), gdb_stdlog, get_sim_inferior_data(), make_cleanup_freeargv(), remote_debug, and SIM_INSTANCE_NEEDED.
Referenced by init_gdbsim_ops().
|
static |
Definition at line 1170 of file remote-sim.c.
References current_inferior(), delete_thread_silent(), fprintf_unfiltered(), gdb_stdlog, generic_mourn_inferior(), get_sim_inferior_data(), remote_debug, remove_breakpoints(), and SIM_INSTANCE_NOT_NEEDED.
Referenced by init_gdbsim_ops().
Definition at line 668 of file remote-sim.c.
References _, current_inferior(), error(), exec_bfd, fprintf_unfiltered(), gdb_buildargv(), gdb_callback, gdb_stdlog, gdb_sysroot, gdbsim_is_open, gdbsim_ops, get_sim_inferior_data(), inferior_ptid, init_callbacks(), INITIAL_PID, is_target_filename(), len, next_pid, null_ptid, printf_filtered(), push_target(), remote_debug, selected_architecture_name(), selected_byte_order(), sim_argv, SIM_INSTANCE_NOT_NEEDED, TARGET_SYSROOT_PREFIX, and unpush_target().
Referenced by init_gdbsim_ops().
|
static |
Definition at line 1272 of file remote-sim.c.
References normal_pid_to_str().
Referenced by init_gdbsim_ops().
|
static |
Definition at line 1061 of file remote-sim.c.
Referenced by init_gdbsim_ops().
|
static |
Definition at line 872 of file remote-sim.c.
References _, error(), find_inferior_ptid(), gdbsim_resume_inferior(), get_sim_inferior_data_by_ptid(), iterate_over_inferiors(), minus_one_ptid, ptid_equal(), resume_data::siggnal, SIM_INSTANCE_NOT_NEEDED, and resume_data::step.
Referenced by init_gdbsim_ops().
Definition at line 848 of file remote-sim.c.
References _, fprintf_unfiltered(), gdb_stdlog, get_sim_inferior_data(), inferior::pid, remote_debug, resume_data::siggnal, SIM_INSTANCE_NOT_NEEDED, and resume_data::step.
Referenced by gdbsim_resume().
|
static |
Definition at line 927 of file remote-sim.c.
References _, error(), find_inferior_ptid(), gdbsim_stop_inferior(), iterate_over_inferiors(), minus_one_ptid, ptid_equal(), and ptid_get_pid().
Referenced by gdbsim_cntrl_c(), and init_gdbsim_ops().
Definition at line 907 of file remote-sim.c.
References get_sim_inferior_data(), quit(), and SIM_INSTANCE_NEEDED.
Referenced by gdbsim_stop().
|
static |
Definition at line 503 of file remote-sim.c.
References _, current_inferior(), dump_mem(), fprintf_unfiltered(), gdb_stdlog, gdbarch_num_regs(), gdbarch_register_name(), gdbarch_register_sim_regno(), get_regcache_arch(), get_sim_inferior_data(), internal_error(), MAX_REGISTER_SIZE, regcache_cooked_read(), register_size(), remote_debug, SIM_INSTANCE_NEEDED, and warning().
Referenced by init_gdbsim_ops().
|
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 |
Definition at line 975 of file remote-sim.c.
References _, current_inferior(), error(), fprintf_unfiltered(), gdb_stdlog, gdbsim_cntrl_c(), get_sim_inferior_data(), get_sim_inferior_data_by_ptid(), inferior_ptid, target_waitstatus::integer, target_waitstatus::kind, minus_one_ptid, ptid_equal(), ptid_get_pid(), quit(), remote_debug, RETSIGTYPE, target_waitstatus::sig, SIM_INSTANCE_NEEDED, TARGET_WAITKIND_EXITED, TARGET_WAITKIND_SIGNALLED, TARGET_WAITKIND_STOPPED, and target_waitstatus::value.
Referenced by init_gdbsim_ops().
|
static |
Definition at line 1070 of file remote-sim.c.
References _, current_inferior(), dump_mem(), error(), fprintf_unfiltered(), gdb_assert, gdb_stdlog, get_sim_inferior_data(), host_address_to_string(), paddress(), pulongest(), remote_debug, SIM_INSTANCE_NOT_NEEDED, target_gdbarch(), TARGET_XFER_E_IO, TARGET_XFER_EOF, TARGET_XFER_OK, and target_ops::to_has_memory.
Referenced by gdbsim_xfer_partial().
|
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 |
Definition at line 171 of file remote-sim.c.
References _, check_for_duplicate_sim_descriptor(), error(), exec_bfd, gdb_callback, iterate_over_inferiors(), next_pid, inferior::num, ptid_build(), sim_argv, and SIM_INSTANCE_NEEDED.
Referenced by gdbsim_close(), gdbsim_create_inferior(), gdbsim_fetch_register(), gdbsim_files_info(), gdbsim_has_all_memory(), gdbsim_has_memory(), gdbsim_load(), gdbsim_mourn_inferior(), gdbsim_open(), gdbsim_resume_inferior(), gdbsim_stop_inferior(), gdbsim_store_register(), gdbsim_wait(), gdbsim_xfer_memory(), and get_sim_inferior_data_by_ptid().
|
static |
Definition at line 239 of file remote-sim.c.
References find_inferior_pid(), get_sim_inferior_data(), arm-linux::inf, pid, and ptid_get_pid().
Referenced by gdbsim_resume(), gdbsim_thread_alive(), and gdbsim_wait().
|
static |
Definition at line 301 of file remote-sim.c.
References callbacks_initialized, gdb_callback, gdb_os_error(), gdb_os_evprintf_filtered(), gdb_os_flush_stderr(), gdb_os_flush_stdout(), gdb_os_poll_quit(), gdb_os_printf_filtered(), gdb_os_vprintf_filtered(), gdb_os_write_stderr(), and gdb_os_write_stdout().
Referenced by gdbsim_open().
|
static |
Definition at line 1308 of file remote-sim.c.
References default_child_has_execution(), default_child_has_registers(), default_child_has_stack(), gdbsim_close(), gdbsim_create_inferior(), gdbsim_detach(), gdbsim_fetch_register(), gdbsim_files_info(), gdbsim_has_all_memory(), gdbsim_has_memory(), gdbsim_kill(), gdbsim_load(), gdbsim_mourn_inferior(), gdbsim_open(), gdbsim_ops, gdbsim_pid_to_str(), gdbsim_prepare_to_store(), gdbsim_resume(), gdbsim_stop(), gdbsim_store_register(), gdbsim_thread_alive(), gdbsim_wait(), gdbsim_xfer_partial(), memory_insert_breakpoint(), memory_remove_breakpoint(), OPS_MAGIC, process_stratum, target_ops::to_close, target_ops::to_create_inferior, target_ops::to_detach, target_ops::to_doc, target_ops::to_fetch_registers, target_ops::to_files_info, 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_insert_breakpoint, target_ops::to_kill, target_ops::to_load, target_ops::to_longname, target_ops::to_magic, target_ops::to_mourn_inferior, target_ops::to_open, target_ops::to_pid_to_str, target_ops::to_prepare_to_store, target_ops::to_remove_breakpoint, target_ops::to_resume, target_ops::to_shortname, target_ops::to_stop, target_ops::to_store_registers, target_ops::to_stratum, target_ops::to_thread_alive, target_ops::to_wait, and target_ops::to_xfer_partial.
Referenced by _initialize_remote_sim().
Definition at line 419 of file remote-sim.c.
References gdb_assert, gdbarch_num_regs(), and regnum.
|
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 |
Definition at line 1225 of file remote-sim.c.
References current_inferior(), VEC_safe_push, and xfree().
|
static |
Definition at line 145 of file remote-sim.c.
Referenced by end_callbacks(), and init_callbacks().
|
static |
Definition at line 144 of file remote-sim.c.
Referenced by end_callbacks(), gdbsim_open(), get_sim_inferior_data(), and init_callbacks().
|
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().
|
static |
Definition at line 134 of file remote-sim.c.
Referenced by gdbsim_open(), and get_sim_inferior_data().
|
static |
Definition at line 141 of file remote-sim.c.
Referenced by gdbsim_close(), gdbsim_open(), and get_sim_inferior_data().