#include "defs.h"
#include "inferior.h"
+#include "infrun.h"
#include "value.h"
#include <string.h>
#include <ctype.h>
static void gdbsim_kill (struct target_ops *);
-static void gdbsim_load (char *prog, int fromtty);
+static void gdbsim_load (struct target_ops *self, const char *prog,
+ int fromtty);
static void gdbsim_open (char *args, int from_tty);
-static void gdbsim_close (void);
+static void gdbsim_close (struct target_ops *self);
static void gdbsim_detach (struct target_ops *ops, const char *args,
int from_tty);
static void gdbsim_mourn_inferior (struct target_ops *target);
-static void gdbsim_stop (ptid_t ptid);
+static void gdbsim_stop (struct target_ops *self, ptid_t ptid);
void simulator_command (char *args, int from_tty);
GDB's symbol tables to match. */
static void
-gdbsim_load (char *args, int fromtty)
+gdbsim_load (struct target_ops *self, const char *args, int fromtty)
{
char **argv;
- char *prog;
+ const char *prog;
struct sim_inferior_data *sim_data
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NEEDED);
/* Close out all files and local state before this target loses control. */
static void
-gdbsim_close (void)
+gdbsim_close (struct target_ops *self)
{
struct sim_inferior_data *sim_data
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
}
static void
-gdbsim_stop (ptid_t ptid)
+gdbsim_stop (struct target_ops *self, ptid_t ptid)
{
struct sim_inferior_data *sim_data;
static void
gdbsim_cntrl_c (int signo)
{
- gdbsim_stop (minus_one_ptid);
+ gdbsim_stop (NULL, minus_one_ptid);
}
static ptid_t
/* Helper for gdbsim_xfer_partial that handles memory transfers.
Arguments are like target_xfer_partial. */
-static LONGEST
+static enum target_xfer_status
gdbsim_xfer_memory (struct target_ops *target,
gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST memaddr, ULONGEST len)
+ ULONGEST memaddr, ULONGEST len, ULONGEST *xfered_len)
{
struct sim_inferior_data *sim_data
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
request to be passed to a lower target, hopefully an exec
file. */
if (!target->to_has_memory (target))
- return 0;
+ return TARGET_XFER_EOF;
if (!sim_data->program_loaded)
error (_("No program loaded."));
if (remote_debug && len > 0)
dump_mem (readbuf, len);
}
- return l;
+ if (l > 0)
+ {
+ *xfered_len = (ULONGEST) l;
+ return TARGET_XFER_OK;
+ }
+ else if (l == 0)
+ return TARGET_XFER_EOF;
+ else
+ return TARGET_XFER_E_IO;
}
/* Target to_xfer_partial implementation. */
-static LONGEST
+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)
+ const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
switch (object)
{
case TARGET_OBJECT_MEMORY:
- return gdbsim_xfer_memory (ops, readbuf, writebuf, offset, len);
+ return gdbsim_xfer_memory (ops, readbuf, writebuf, offset, len,
+ xfered_len);
default:
return TARGET_XFER_E_IO;