aboutsummaryrefslogtreecommitdiff
path: root/sim/common/run.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2000-02-22 08:52:21 +0000
committerAndrew Cagney <cagney@redhat.com>2000-02-22 08:52:21 +0000
commitbaa7ae6f10462c17d2472868e6b1c08d0ba880ae (patch)
tree65209fc2c67d9206338cce6e704dd9e13a383861 /sim/common/run.c
parent1287d1cc37aca000234065fd0472a3a9846f4017 (diff)
downloadgdb-baa7ae6f10462c17d2472868e6b1c08d0ba880ae.zip
gdb-baa7ae6f10462c17d2472868e6b1c08d0ba880ae.tar.gz
gdb-baa7ae6f10462c17d2472868e6b1c08d0ba880ae.tar.bz2
When SIM_HAVE_ENVIRONMENT: use sim_set_trace() to enable tracing
instead of sim_trace() to run the program; include support for ``-o'' option (operating environment); when a signal occurs, only continue execution when operating environment mode. Update d10v.
Diffstat (limited to 'sim/common/run.c')
-rw-r--r--sim/common/run.c51
1 files changed, 36 insertions, 15 deletions
diff --git a/sim/common/run.c b/sim/common/run.c
index 1a4e969..d23b5a0 100644
--- a/sim/common/run.c
+++ b/sim/common/run.c
@@ -57,9 +57,6 @@ extern host_callback default_callback;
static char *myname;
-/* NOTE: sim_size() and sim_trace() are going away */
-extern int sim_trace PARAMS ((SIM_DESC sd));
-
extern int getopt ();
#ifdef NEED_UI_LOOP_HOOK
@@ -89,6 +86,9 @@ main (ac, av)
int i;
int verbose = 0;
int trace = 0;
+#ifdef SIM_HAVE_ENVIRONMENT
+ int operating_p = 0;
+#endif
char *name;
static char *no_args[4];
char **sim_argv = &no_args[0];
@@ -117,9 +117,9 @@ main (ac, av)
do all argv processing. */
#ifdef SIM_H8300 /* FIXME: quick hack */
- while ((i = getopt (ac, av, "a:c:m:p:s:htv")) != EOF)
+ while ((i = getopt (ac, av, "a:c:m:op:s:htv")) != EOF)
#else
- while ((i = getopt (ac, av, "a:c:m:p:s:tv")) != EOF)
+ while ((i = getopt (ac, av, "a:c:m:op:s:tv")) != EOF)
#endif
switch (i)
{
@@ -147,6 +147,13 @@ main (ac, av)
/* FIXME: Rename to sim_set_mem_size. */
sim_size (atoi (optarg));
break;
+#ifdef SIM_HAVE_ENVIRONMENT
+ case 'o':
+ /* Operating enironment where any signals are delivered to the
+ target. */
+ operating_p = 1;
+ break;
+#endif SIM_HAVE_ENVIRONMENT
#ifdef SIM_HAVE_PROFILE
case 'p':
sim_set_profile (atoi (optarg));
@@ -157,8 +164,6 @@ main (ac, av)
#endif
case 't':
trace = 1;
- /* FIXME: need to allow specification of what to trace. */
- /* sim_set_trace (1); */
break;
case 'v':
/* Things that are printed with -v are the kinds of things that
@@ -231,6 +236,21 @@ main (ac, av)
if (sim_create_inferior (sd, abfd, prog_args, NULL) == SIM_RC_FAIL)
exit (1);
+#ifdef SIM_HAVE_ENVIRONMENT
+ /* NOTE: An old simulator supporting the operating environment MUST
+ provide sim_set_trace() and not sim_trace(). That way
+ sim_stop_reason() can be used to determine any stop reason. */
+ if (trace)
+ sim_set_trace ();
+ do
+ {
+ prev_sigint = signal (SIGINT, cntrl_c);
+ sim_resume (sd, 0, sigrc);
+ signal (SIGINT, prev_sigint);
+ sim_stop_reason (sd, &reason, &sigrc);
+ }
+ while (operating_p && reason == sim_stopped && sigrc != SIGINT);
+#else
if (trace)
{
int done = 0;
@@ -240,18 +260,16 @@ main (ac, av)
done = sim_trace (sd);
}
signal (SIGINT, prev_sigint);
+ sim_stop_reason (sd, &reason, &sigrc);
}
else
{
- do
- {
- prev_sigint = signal (SIGINT, cntrl_c);
- sim_resume (sd, 0, sigrc);
- signal (SIGINT, prev_sigint);
- sim_stop_reason (sd, &reason, &sigrc);
- }
- while (reason == sim_stopped && sigrc != SIGINT);
+ prev_sigint = signal (SIGINT, cntrl_c);
+ sim_resume (sd, 0, sigrc);
+ signal (SIGINT, prev_sigint);
+ sim_stop_reason (sd, &reason, &sigrc);
}
+#endif
if (verbose)
sim_info (sd, 0);
@@ -303,6 +321,9 @@ usage ()
fprintf (stderr, "-h Executable is for h8/300h or h8/300s.\n");
#endif
fprintf (stderr, "-m size Set memory size of simulator, in bytes.\n");
+#ifdef SIM_HAVE_ENVIRONMENT
+ fprintf (stderr, "-o Select operating (kernel) environment.\n");
+#endif
#ifdef SIM_HAVE_PROFILE
fprintf (stderr, "-p freq Set profiling frequency.\n");
fprintf (stderr, "-s size Set profiling size.\n");