/* Generic remote debugging interface for simulators.
- Copyright 1993, 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Steve Chamberlain (sac@cygnus.com).
/* Prototypes */
-extern void _initialize_remote_sim PARAMS ((void));
+extern void _initialize_remote_sim (void);
-extern int (*ui_loop_hook) PARAMS ((int signo));
+extern int (*ui_loop_hook) (int signo);
-static void dump_mem PARAMS ((char *buf, int len));
+static void dump_mem (char *buf, int len);
-static void init_callbacks PARAMS ((void));
+static void init_callbacks (void);
-static void end_callbacks PARAMS ((void));
+static void end_callbacks (void);
-static int gdb_os_write_stdout PARAMS ((host_callback *, const char *, int));
+static int gdb_os_write_stdout (host_callback *, const char *, int);
-static void gdb_os_flush_stdout PARAMS ((host_callback *));
+static void gdb_os_flush_stdout (host_callback *);
-static int gdb_os_write_stderr PARAMS ((host_callback *, const char *, int));
+static int gdb_os_write_stderr (host_callback *, const char *, int);
-static void gdb_os_flush_stderr PARAMS ((host_callback *));
+static void gdb_os_flush_stderr (host_callback *);
-static int gdb_os_poll_quit PARAMS ((host_callback *));
+static int gdb_os_poll_quit (host_callback *);
/* printf_filtered is depreciated */
-static void gdb_os_printf_filtered PARAMS ((host_callback *, const char *,...));
+static void gdb_os_printf_filtered (host_callback *, const char *, ...);
-static void gdb_os_vprintf_filtered PARAMS ((host_callback *, const char *, va_list));
+static void gdb_os_vprintf_filtered (host_callback *, const char *, va_list);
-static void gdb_os_evprintf_filtered PARAMS ((host_callback *, const char *, va_list));
+static void gdb_os_evprintf_filtered (host_callback *, const char *, va_list);
-static void gdb_os_error PARAMS ((host_callback *, const char *,...));
+static void gdb_os_error (host_callback *, const char *, ...);
-static void gdbsim_fetch_register PARAMS ((int regno));
+static void gdbsim_fetch_register (int regno);
-static void gdbsim_store_register PARAMS ((int regno));
+static void gdbsim_store_register (int regno);
-static void gdbsim_kill PARAMS ((void));
+static void gdbsim_kill (void);
-static void gdbsim_load PARAMS ((char *prog, int fromtty));
+static void gdbsim_load (char *prog, int fromtty);
-static void gdbsim_create_inferior PARAMS ((char *exec_file, char *args, char **env));
+static void gdbsim_create_inferior (char *exec_file, char *args, char **env);
-static void gdbsim_open PARAMS ((char *args, int from_tty));
+static void gdbsim_open (char *args, int from_tty);
-static void gdbsim_close PARAMS ((int quitting));
+static void gdbsim_close (int quitting);
-static void gdbsim_detach PARAMS ((char *args, int from_tty));
+static void gdbsim_detach (char *args, int from_tty);
-static void gdbsim_resume PARAMS ((int pid, int step, enum target_signal siggnal));
+static void gdbsim_resume (int pid, int step, enum target_signal siggnal);
-static int gdbsim_wait PARAMS ((int pid, struct target_waitstatus * status));
+static int gdbsim_wait (int pid, struct target_waitstatus *status);
-static void gdbsim_prepare_to_store PARAMS ((void));
+static void gdbsim_prepare_to_store (void);
-static int gdbsim_xfer_inferior_memory PARAMS ((CORE_ADDR memaddr,
- char *myaddr, int len,
- int write,
- struct target_ops * target));
+static int gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr,
+ int len, int write,
+ struct mem_attrib *attrib,
+ struct target_ops *target);
-static void gdbsim_files_info PARAMS ((struct target_ops * target));
+static void gdbsim_files_info (struct target_ops *target);
-static void gdbsim_mourn_inferior PARAMS ((void));
+static void gdbsim_mourn_inferior (void);
-static void gdbsim_stop PARAMS ((void));
+static void gdbsim_stop (void);
-void simulator_command PARAMS ((char *args, int from_tty));
+void simulator_command (char *args, int from_tty);
/* Naming convention:
static SIM_DESC gdbsim_desc = 0;
static void
-dump_mem (buf, len)
- char *buf;
- int len;
+dump_mem (char *buf, int len)
{
if (len <= 8)
{
/* Initialize gdb_callback. */
static void
-init_callbacks ()
+init_callbacks (void)
{
if (!callbacks_initialized)
{
/* Release callbacks (free resources used by them). */
static void
-end_callbacks ()
+end_callbacks (void)
{
if (callbacks_initialized)
{
/* GDB version of os_write_stdout callback. */
static int
-gdb_os_write_stdout (p, buf, len)
- host_callback *p;
- const char *buf;
- int len;
+gdb_os_write_stdout (host_callback *p, const char *buf, int len)
{
int i;
char b[2];
/* GDB version of os_flush_stdout callback. */
static void
-gdb_os_flush_stdout (p)
- host_callback *p;
+gdb_os_flush_stdout (host_callback *p)
{
gdb_flush (gdb_stdtarg);
}
/* GDB version of os_write_stderr callback. */
static int
-gdb_os_write_stderr (p, buf, len)
- host_callback *p;
- const char *buf;
- int len;
+gdb_os_write_stderr (host_callback *p, const char *buf, int len)
{
int i;
char b[2];
/* GDB version of os_flush_stderr callback. */
static void
-gdb_os_flush_stderr (p)
- host_callback *p;
+gdb_os_flush_stderr (host_callback *p)
{
gdb_flush (gdb_stderr);
}
}
}
-#ifndef REGISTER_SIM_REGNO
-#define REGISTER_SIM_REGNO(N) (N)
-#endif
-
static void
-gdbsim_fetch_register (regno)
- int regno;
+gdbsim_fetch_register (int regno)
{
static int warn_user = 1;
if (regno == -1)
static void
-gdbsim_store_register (regno)
- int regno;
+gdbsim_store_register (int regno)
{
if (regno == -1)
{
and releasing other resources acquired by the simulated program. */
static void
-gdbsim_kill ()
+gdbsim_kill (void)
{
if (sr_get_debug ())
printf_filtered ("gdbsim_kill\n");
GDB's symbol tables to match. */
static void
-gdbsim_load (prog, fromtty)
- char *prog;
- int fromtty;
+gdbsim_load (char *prog, int fromtty)
{
if (sr_get_debug ())
printf_filtered ("gdbsim_load: prog \"%s\"\n", prog);
user types "run" after having attached. */
static void
-gdbsim_create_inferior (exec_file, args, env)
- char *exec_file;
- char *args;
- char **env;
+gdbsim_create_inferior (char *exec_file, char *args, char **env)
{
int len;
char *arg_buf, **argv;
/* Called when selecting the simulator. EG: (gdb) target sim name. */
static void
-gdbsim_open (args, from_tty)
- char *args;
- int from_tty;
+gdbsim_open (char *args, int from_tty)
{
int len;
char *arg_buf;
/* Close out all files and local state before this target loses control. */
static void
-gdbsim_close (quitting)
- int quitting;
+gdbsim_close (int quitting)
{
if (sr_get_debug ())
printf_filtered ("gdbsim_close: quitting %d\n", quitting);
}
end_callbacks ();
+ generic_mourn_inferior ();
}
/* Takes a program previously attached to and detaches it.
Use this when you want to detach and do something else with your gdb. */
static void
-gdbsim_detach (args, from_tty)
- char *args;
- int from_tty;
+gdbsim_detach (char *args, int from_tty)
{
if (sr_get_debug ())
printf_filtered ("gdbsim_detach: args \"%s\"\n", args);
static int resume_step;
static void
-gdbsim_resume (pid, step, siggnal)
- int pid, step;
- enum target_signal siggnal;
+gdbsim_resume (int pid, int step, enum target_signal siggnal)
{
if (inferior_pid != 42)
error ("The program is not being run.");
For simulators that do not support this operation, just abort */
static void
-gdbsim_stop ()
+gdbsim_stop (void)
{
if (!sim_stop (gdbsim_desc))
{
Taken from gdb/util.c - should be in a library */
static int
-gdb_os_poll_quit (p)
- host_callback *p;
+gdb_os_poll_quit (host_callback *p)
{
if (ui_loop_hook != NULL)
ui_loop_hook (0);
just as `wait' would. */
static void
-gdbsim_cntrl_c (signo)
- int signo;
+gdbsim_cntrl_c (int signo)
{
gdbsim_stop ();
}
static int
-gdbsim_wait (pid, status)
- int pid;
- struct target_waitstatus *status;
+gdbsim_wait (int pid, struct target_waitstatus *status)
{
static RETSIGTYPE (*prev_sigint) ();
int sigrc = 0;
debugged. */
static void
-gdbsim_prepare_to_store ()
+gdbsim_prepare_to_store (void)
{
/* Do nothing, since we can store individual regs */
}
+/* Transfer LEN bytes between GDB address MYADDR and target address
+ MEMADDR. If WRITE is non-zero, transfer them to the target,
+ otherwise transfer them from the target. TARGET is unused.
+
+ Returns the number of bytes transferred. */
+
static int
-gdbsim_xfer_inferior_memory (memaddr, myaddr, len, write, target)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
- int write;
- struct target_ops *target; /* ignored */
+gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
+ int write,
+ struct mem_attrib *attrib ATTRIBUTE_UNUSED,
+ struct target_ops *target ATTRIBUTE_UNUSED)
{
if (!program_loaded)
error ("No program loaded.");
}
static void
-gdbsim_files_info (target)
- struct target_ops *target;
+gdbsim_files_info (struct target_ops *target)
{
char *file = "nothing";
/* Clear the simulator's notion of what the break points are. */
static void
-gdbsim_mourn_inferior ()
+gdbsim_mourn_inferior (void)
{
if (sr_get_debug ())
printf_filtered ("gdbsim_mourn_inferior:\n");
}
static int
-gdbsim_insert_breakpoint (addr, contents_cache)
- CORE_ADDR addr;
- char *contents_cache;
+gdbsim_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
{
#ifdef SIM_HAS_BREAKPOINTS
SIM_RC retcode;
}
static int
-gdbsim_remove_breakpoint (addr, contents_cache)
- CORE_ADDR addr;
- char *contents_cache;
+gdbsim_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
{
#ifdef SIM_HAS_BREAKPOINTS
SIM_RC retcode;
simulator must do any command interpretation work. */
void
-simulator_command (args, from_tty)
- char *args;
- int from_tty;
+simulator_command (char *args, int from_tty)
{
if (gdbsim_desc == NULL)
{
}
void
-_initialize_remote_sim ()
+_initialize_remote_sim (void)
{
init_gdbsim_ops ();
add_target (&gdbsim_ops);