Part II of adding callback argument to sim_open(). Update all the

other simulators; remove SIM_DESC from depreciated function
sim_set_callbacks().
This commit is contained in:
Andrew Cagney 1997-05-20 01:57:43 +00:00
parent 24aa2b57af
commit ff82f21409
8 changed files with 59 additions and 64 deletions

View File

@ -162,19 +162,22 @@ int sim_stop PARAMS ((SIM_DESC sd));
void sim_do_command PARAMS ((SIM_DESC sd, char *cmd)); void sim_do_command PARAMS ((SIM_DESC sd, char *cmd));
/* Provide simulator with a standard host_callback_struct. /* NOTE: sim_set_callbacks () is depreciated.
If SD is NULL, the command is to be interpreted as refering to
the global state, however the simulator defines that.
This function is depreciated. Callbacks are set as part of Provide simulator with a default (global) host_callback_struct. */
sim_open. */
void sim_set_callbacks PARAMS ((SIM_DESC sd, struct host_callback_struct *)); void sim_set_callbacks PARAMS ((struct host_callback_struct *));
/* NOTE: sim_size() and sim_trace() are going away */ /* NOTE: sim_size() is depreciated.
void sim_size PARAMS ((SIM_DESC sd, int i)); sim_size() does not take a SIM_DESC argument as this function is
used before sim_open() has been called. */
void sim_size PARAMS ((int i));
/* NOTE: sim_trace() is depreciated. */
int sim_trace PARAMS ((SIM_DESC sd)); int sim_trace PARAMS ((SIM_DESC sd));

View File

@ -1,3 +1,13 @@
Tue May 20 10:22:50 1997 Andrew Cagney <cagney@b1.cygnus.com>
* sim_calls.c (sim_open): Add callback argument.
(sim_set_callbacks): Delete SIM_DESC argument.
Tue Apr 22 22:36:57 1997 Mike Meissner <meissner@cygnus.com>
* sim_callbacks.h (error): Make declaration match gdb's.
* main.c (error): Ditto.
Fri Apr 18 17:03:09 1997 Andrew Cagney <cagney@b1.cygnus.com> Fri Apr 18 17:03:09 1997 Andrew Cagney <cagney@b1.cygnus.com>
* sim_calls.c (sim_stop_reason): Simplify. Was running implies * sim_calls.c (sim_stop_reason): Simplify. Was running implies

View File

@ -57,8 +57,10 @@ static const char *register_names[] = REGISTER_NAMES;
static unsigned_word entry_point; static unsigned_word entry_point;
SIM_DESC SIM_DESC
sim_open (SIM_OPEN_KIND kind, char **argv) sim_open (SIM_OPEN_KIND kind, host_callback *callback, char **argv)
{ {
callbacks = callback;
/* Note: The simulation is not created by sim_open() because /* Note: The simulation is not created by sim_open() because
complete information is not yet available */ complete information is not yet available */
/* trace the call */ /* trace the call */
@ -215,48 +217,31 @@ sim_create_inferior (SIM_DESC sd, char **argv, char **envp)
} }
static volatile int sim_should_run;
void void
sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc) sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc)
{ {
psim_status status = psim_get_status(simulator); psim_status status = psim_get_status(simulator);
switch (CURRENT_ENVIRONMENT) { switch (status.reason) {
case was_continuing:
case USER_ENVIRONMENT: *reason = sim_stopped;
case VIRTUAL_ENVIRONMENT: if (status.signal == 0)
switch (status.reason) {
case was_continuing:
*reason = sim_stopped;
*sigrc = SIGTRAP; *sigrc = SIGTRAP;
if (sim_should_run) { else
error("sim_stop_reason() unknown reason for halt\n");
}
break;
case was_trap:
*reason = sim_stopped;
*sigrc = SIGTRAP;
break;
case was_exited:
*reason = sim_exited;
*sigrc = 0;
break;
case was_signalled:
*reason = sim_signalled;
*sigrc = status.signal; *sigrc = status.signal;
break;
}
break; break;
case was_trap:
case OPERATING_ENVIRONMENT:
*reason = sim_stopped; *reason = sim_stopped;
*sigrc = SIGTRAP; *sigrc = SIGTRAP;
break; break;
case was_exited:
default: *reason = sim_exited;
error("sim_stop_reason() - unknown environment\n"); *sigrc = status.signal;
break;
case was_signalled:
*reason = sim_signalled;
*sigrc = status.signal;
break;
} }
TRACE(trace_gdb, ("sim_stop_reason(reason=0x%lx(%ld), sigrc=0x%lx(%ld))\n", TRACE(trace_gdb, ("sim_stop_reason(reason=0x%lx(%ld), sigrc=0x%lx(%ld))\n",
@ -266,10 +251,12 @@ sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc)
/* Run (or resume) the program. */ /* Run (or resume) the program. */
static RETSIGTYPE
sim_ctrl_c(int sig) int
sim_stop (SIM_DESC sd)
{ {
sim_should_run = 0; psim_stop (simulator);
return 1;
} }
void void
@ -280,19 +267,11 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
if (step) if (step)
{ {
psim_step(simulator); psim_step (simulator);
/* sim_stop_reason has a sanity check for stopping while
was_continuing. We don't want that here so reset sim_should_run. */
sim_should_run = 0;
} }
else else
{ {
RETSIGTYPE (*prev) (); psim_run (simulator);
prev = signal(SIGINT, sim_ctrl_c);
sim_should_run = 1;
psim_run_until_stop(simulator, &sim_should_run);
signal(SIGINT, prev);
} }
} }
@ -406,7 +385,7 @@ sim_io_flush_stdoutput(void)
} }
void void
sim_set_callbacks (SIM_DESC sd, host_callback *callback) sim_set_callbacks (host_callback *callback)
{ {
callbacks = callback; callbacks = callback;
TRACE(trace_gdb, ("sim_set_callbacks called\n")); TRACE(trace_gdb, ("sim_set_callbacks called\n"));

View File

@ -1,8 +1,11 @@
Tue May 20 09:33:31 1997 Andrew Cagney <cagney@b1.cygnus.com> Tue May 20 09:33:31 1997 Andrew Cagney <cagney@b1.cygnus.com>
* sim-main.h: Include <unistd.h>.
* sim-calls.c (sim_set_callback): Delete. * sim-calls.c (sim_set_callback): Delete.
(sim_open): Add/install callback argument. (sim_open): Add/install callback argument.
(sim_size): Delete.
Mon May 19 18:59:33 1997 Mike Meissner <meissner@cygnus.com> Mon May 19 18:59:33 1997 Mike Meissner <meissner@cygnus.com>
* configure.in: Check for getpid, kill functions. * configure.in: Check for getpid, kill functions.

View File

@ -110,14 +110,6 @@ sim_open (SIM_OPEN_KIND kind, struct host_callback_struct *callback, char **argv
} }
/* NOTE: sim_size is going away */
void
sim_size (SIM_DESC sd, int i)
{
sim_io_error (sd, "unexpected call to sim_size()");
}
void void
sim_close (SIM_DESC sd, int quitting) sim_close (SIM_DESC sd, int quitting)
{ {

View File

@ -27,6 +27,9 @@
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
/* These are generated files. */ /* These are generated files. */
#include "itable.h" #include "itable.h"

View File

@ -1,3 +1,7 @@
Tue May 20 10:24:54 1997 Andrew Cagney <cagney@b1.cygnus.com>
* interp.c (sim_open): Add callback argument.
Tue Apr 15 14:55:10 1997 Ian Lance Taylor <ian@cygnus.com> Tue Apr 15 14:55:10 1997 Ian Lance Taylor <ian@cygnus.com>
* Makefile.in (INSTALL): Set to @INSTALL@. * Makefile.in (INSTALL): Set to @INSTALL@.

View File

@ -322,8 +322,9 @@ sim_kill ()
} }
void void
sim_open (kind,argv) sim_open (kind,cb,argv)
SIM_OPEN_KIND kind; SIM_OPEN_KIND kind;
host_callback *cb;
char **argv; char **argv;
{ {
} }