during sim_open().
gdb_callback.error = gdb_os_error;
gdb_callback.poll_quit = gdb_os_poll_quit;
gdb_callback.magic = HOST_CALLBACK_MAGIC;
- sim_set_callbacks (gdbsim_desc, &gdb_callback);
-
callbacks_initialized = 1;
}
}
if (gdbsim_desc != NULL)
unpush_target (&gdbsim_ops);
- init_callbacks ();
-
len = 7 + 1 + (args ? strlen (args) : 0) + 50;
arg_buf = (char *) alloca (len);
sprintf (arg_buf, "gdbsim%s%s",
error ("Insufficient memory available to allocate simulator arg list.");
make_cleanup (freeargv, (char *) argv);
- gdbsim_desc = sim_open (SIM_OPEN_DEBUG, argv);
+ init_callbacks ();
+ gdbsim_desc = sim_open (SIM_OPEN_DEBUG, &gdb_callback, argv);
+
if (gdbsim_desc == 0)
error ("unable to create simulator instance");
+Tue May 20 09:32:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * remote-sim.h (sim_open): Add callback struct.
+
Mon May 19 19:14:44 1997 Andrew Cagney <cagney@b1.cygnus.com>
* remote-sim.h: Pass SD into sim_size.
is selected from the gdb command line.
KIND specifies how the simulator will be used. Currently there are only
two kinds: standalone and debug.
+ CALLBACK provides a standard host callback.
ARGV is passed from the command line and can be used to select whatever
run time options the simulator provides. It is the standard NULL
terminated array of pointers, with argv[0] being the program name.
The result is a descriptor that must be passed back to the other sim_foo
functions. */
-SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, char **argv));
+SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, struct host_callback_struct *callback, char **argv));
/* Terminate usage of the simulator. This may involve freeing target memory
/* Provide simulator with a standard host_callback_struct.
If SD is NULL, the command is to be interpreted as refering to
- the global state, however the simulator defines that. */
+ the global state, however the simulator defines that.
+
+ This function is depreciated. Callbacks are set as part of
+ sim_open. */
void sim_set_callbacks PARAMS ((SIM_DESC sd, struct host_callback_struct *));
static char *myname;
-/* bfd descriptor of the executable. Same name as gdb uses. */
-bfd *exec_bfd;
-
/* NOTE: sim_size() and sim_trace() are going away */
extern void sim_size PARAMS ((int i));
/* The first element of sim_open's argv is the program name. */
no_args[0] = av[0];
+#ifdef SIM_HAVE_BIENDIAN
no_args[1] = "-E";
no_args[2] = "set-later";
+#endif
/* FIXME: This is currently being rewritten to have each simulator
do all argv processing. */
{
int len = strlen (av[0]) + strlen (optarg);
char *argbuf = (char *) alloca (len + 2 + 50);
+ sprintf (argbuf, "%s %s", av[0], optarg);
+#ifdef SIM_HAVE_BIENDIAN
/* The desired endianness must be passed to sim_open.
The value for "set-later" is set when we know what it is.
- -e support isn't yet part of the published interface. */
- sprintf (argbuf, "%s %s -E set-later", av[0], optarg);
+ -E support isn't yet part of the published interface. */
+ strcat (argbuf, " -E set-later");
+#endif
sim_argv = buildargv (argbuf);
}
break;
printf ("%s %s\n", myname, name);
}
- sim_set_callbacks (NULL, &default_callback);
- default_callback.init (&default_callback);
-
- exec_bfd = abfd = bfd_openr (name, 0);
+ abfd = bfd_openr (name, 0);
if (!abfd)
{
fprintf (stderr, "%s: can't open %s: %s\n",
exit (1);
}
+#ifdef SIM_HAVE_BIENDIAN
/* The endianness must be passed to sim_open because one may wish to
examine/set registers before calling sim_load [which is the other
place where one can determine endianness]. We previously passed the
sim_argv[i] = "big";
else
sim_argv[i] = "little";
+#endif
/* Ensure that any run-time initialisation that needs to be
performed by the simulator can occur. */
- sd = sim_open (SIM_OPEN_STANDALONE, sim_argv);
+ default_callback.init (&default_callback);
+ sd = sim_open (SIM_OPEN_STANDALONE, &default_callback, sim_argv);
if (sd == 0)
exit (1);
+Tue May 20 09:33:31 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-calls.c (sim_set_callback): Delete.
+ (sim_open): Add/install callback argument.
+
Mon May 19 18:59:33 1997 Mike Meissner <meissner@cygnus.com>
* configure.in: Check for getpid, kill functions.
SIM_DESC
-sim_open (SIM_OPEN_KIND kind, char **argv)
+sim_open (SIM_OPEN_KIND kind, struct host_callback_struct *callback, char **argv)
{
SIM_DESC sd = &simulation;
STATE_OPEN_KIND (sd) = kind;
STATE_MAGIC (sd) = SIM_MAGIC_NUMBER;
+ STATE_CALLBACK (&simulation) = callback;
if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK)
return 0;
if (sim_args_command (sd, cmd) != SIM_RC_OK)
sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
}
-
-
-void
-sim_set_callbacks (SIM_DESC sd, host_callback *callback)
-{
- STATE_CALLBACK (sd) = callback;
-}