aboutsummaryrefslogtreecommitdiff
path: root/sim/common/nrun.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-07-12 11:15:22 +0000
committerJason Molenda <jmolenda@apple.com>1999-07-12 11:15:22 +0000
commit43e526b9b4c9868d3cd90772a54f767f8d45cadd (patch)
tree4d68a4a2d3a6c7e4f6237bc04015fc182a8ced0c /sim/common/nrun.c
parentedac9bffc154855d959fcbc32e2fe0b073a9ec71 (diff)
downloadgdb-43e526b9b4c9868d3cd90772a54f767f8d45cadd.zip
gdb-43e526b9b4c9868d3cd90772a54f767f8d45cadd.tar.gz
gdb-43e526b9b4c9868d3cd90772a54f767f8d45cadd.tar.bz2
import gdb-1999-07-12 snapshot
Diffstat (limited to 'sim/common/nrun.c')
-rw-r--r--sim/common/nrun.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index 2f13b1f..c5b43a2 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -137,41 +137,44 @@ main (int argc, char **argv)
((reason == sim_stopped) &&
(STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT)));
}
- else do
+ else
{
+ do
+ {
#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
- struct sigaction sa, osa;
- sa.sa_handler = cntrl_c;
- sigemptyset (&sa.sa_mask);
- sa.sa_flags = 0;
- sigaction (SIGINT, &sa, &osa);
- prev_sigint = osa.sa_handler;
+ struct sigaction sa, osa;
+ sa.sa_handler = cntrl_c;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = 0;
+ sigaction (SIGINT, &sa, &osa);
+ prev_sigint = osa.sa_handler;
#else
- prev_sigint = signal (SIGINT, cntrl_c);
+ prev_sigint = signal (SIGINT, cntrl_c);
#endif
- sim_resume (sd, 0, sigrc);
- signal (SIGINT, prev_sigint);
- sim_stop_reason (sd, &reason, &sigrc);
-
- if ((reason == sim_stopped) &&
- (sigrc == sim_signal_to_host (sd, SIM_SIGINT)))
- break; /* exit on control-C */
-
- /* remain on signals in oe mode */
- } while ((reason == sim_stopped) &&
- (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT));
-
+ sim_resume (sd, 0, sigrc);
+ signal (SIGINT, prev_sigint);
+ sim_stop_reason (sd, &reason, &sigrc);
+
+ if ((reason == sim_stopped) &&
+ (sigrc == sim_signal_to_host (sd, SIM_SIGINT)))
+ break; /* exit on control-C */
+
+ /* remain on signals in oe mode */
+ } while ((reason == sim_stopped) &&
+ (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT));
+
+ }
/* Print any stats the simulator collected. */
sim_info (sd, 0);
-
+
/* Shutdown the simulator. */
sim_close (sd, 0);
-
+
/* If reason is sim_exited, then sigrc holds the exit code which we want
to return. If reason is sim_stopped or sim_signalled, then sigrc holds
the signal that the simulator received; we want to return that to
indicate failure. */
-
+
#ifdef SIM_H8300 /* FIXME: Ugh. grep for SLEEP in compile.c */
if (sigrc == SIGILL)
abort ();