aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>1998-05-16 19:51:12 +0000
committerDoug Evans <dje@google.com>1998-05-16 19:51:12 +0000
commitebd58f4dde1b5f65e84f61ec05ed5ebf189cb0f3 (patch)
tree2d187807a72fcb07ff7abcfc817bb447105331af /sim
parent882d99e4b63e43ea59973e589a2f4d3dfd7a7f1e (diff)
downloadgdb-ebd58f4dde1b5f65e84f61ec05ed5ebf189cb0f3.zip
gdb-ebd58f4dde1b5f65e84f61ec05ed5ebf189cb0f3.tar.gz
gdb-ebd58f4dde1b5f65e84f61ec05ed5ebf189cb0f3.tar.bz2
* sim-engine.c (sim_engine_set_run_state): New function.
* sim-engine.h (sim_engine_set_run_state): Declare. * genmloop.sh (pending_reason,pending_sigrc): New static locals. (@cpu@_engine_stop): New args reason,sigrc. All callers updated. (engine_resume): Reorganize. Allow synchronous exit from main loop.
Diffstat (limited to 'sim')
-rw-r--r--sim/common/ChangeLog8
-rw-r--r--sim/common/genmloop.sh71
2 files changed, 51 insertions, 28 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index ee51dd9..8298bfe 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,11 @@
+Sat May 16 12:44:52 1998 Doug Evans <devans@seba.cygnus.com>
+
+ * sim-engine.c (sim_engine_set_run_state): New function.
+ * sim-engine.h (sim_engine_set_run_state): Declare.
+ * genmloop.sh (pending_reason,pending_sigrc): New static locals.
+ (@cpu@_engine_stop): New args reason,sigrc. All callers updated.
+ (engine_resume): Reorganize. Allow synchronous exit from main loop.
+
Fri May 15 16:06:05 1998 Doug Evans <devans@seba.cygnus.com>
* cgen-trace.c (trace_insn_init): New arg first_p.
diff --git a/sim/common/genmloop.sh b/sim/common/genmloop.sh
index 591eb66..d3c18d9 100644
--- a/sim/common/genmloop.sh
+++ b/sim/common/genmloop.sh
@@ -142,6 +142,10 @@ ${SHELL} $file support
cat <<EOF
static volatile int keep_running;
+/* FIXME: Should each cpu have its own copy? */
+static volatile enum sim_stop pending_reason;
+static volatile int pending_sigrc;
+
/* Want to measure simulator speed even in fast mode. */
static unsigned long insn_count;
static SIM_ELAPSED_TIME start_time;
@@ -151,10 +155,17 @@ static void engine_resume (SIM_DESC, int, int);
static void engine_resume_full (SIM_DESC);
${scache+static void engine_resume_fast (SIM_DESC);}
+/* Stop the simulation for REASON/SIGRC.
+ CPU is the cpu being stopped [at address PC].
+ If CPU is NULL, all cpu's are stopping for the same reason. */
+
int
-@cpu@_engine_stop (SIM_DESC sd)
+@cpu@_engine_stop (SIM_DESC sd, SIM_CPU *cpu, PCADDR pc,
+ enum sim_stop reason, int sigrc)
{
keep_running = 0;
+ pending_reason = reason;
+ pending_sigrc = sigrc;
return 1;
}
@@ -186,52 +197,56 @@ engine_resume (SIM_DESC sd, int step, int siggnal)
insn_count = 0;
engine->jmpbuf = &buf;
+ sim_engine_set_run_state (sd, sim_running, 0);
+ pending_reason = sim_running;
+ pending_sigrc = 0;
+
+ /* ??? Restart support to be added in time. */
+
if (setjmp (buf))
{
/* Account for the last insn executed. */
++insn_count;
-
- engine->jmpbuf = NULL;
TRACE_INSN_FINI ((sim_cpu *) cpu, 1);
- PROFILE_EXEC_TIME (CPU_PROFILE_DATA (cpu))
- += sim_elapsed_time_since (start_time);
- PROFILE_TOTAL_INSN_COUNT (CPU_PROFILE_DATA (cpu))
- += insn_count;
-
- return;
}
-
- /* ??? Restart support to be added in time. */
-
- /* The computed goto switch can be used, and while the number of blocks
- may swamp the relatively few that this function contains, when running
- with the scache we put the actual semantic code in their own
- functions. */
+ else
+ {
+ /* The computed goto switch can be used, and while the number of blocks
+ may swamp the relatively few that this function contains, when running
+ with the scache we put the actual semantic code in their own
+ functions. */
EOF
if [ x$fast = xyes ] ; then
cat <<EOF
- if (step
- || !RUN_FAST_P (current_cpu))
- engine_resume_full (sd);
- else
- engine_resume_fast (sd);
+ if (step
+ || !RUN_FAST_P (current_cpu))
+ engine_resume_full (sd);
+ else
+ engine_resume_fast (sd);
EOF
else
cat <<EOF
- engine_resume_full (sd);
+ engine_resume_full (sd);
EOF
fi
cat <<EOF
- /* If the loop exits, either we single-stepped or engine_stop was called.
- In either case we need to call engine_halt: to properly exit this
- function we must go through the setjmp executed above. */
- if (step)
- sim_engine_halt (sd, current_cpu, NULL, NULL_CIA, sim_stopped, SIM_SIGTRAP);
- sim_engine_halt (sd, current_cpu, NULL, NULL_CIA, sim_stopped, SIM_SIGINT);
+ /* If the loop exits, either we single-stepped or @cpu@_engine_stop
+ was called. */
+ if (step)
+ sim_engine_set_run_state (sd, sim_stopped, SIM_SIGTRAP);
+ else
+ sim_engine_set_run_state (sd, pending_reason, pending_sigrc);
+ }
+
+ engine->jmpbuf = NULL;
+ PROFILE_EXEC_TIME (CPU_PROFILE_DATA (cpu))
+ += sim_elapsed_time_since (start_time);
+ PROFILE_TOTAL_INSN_COUNT (CPU_PROFILE_DATA (cpu))
+ += insn_count;
}
EOF