]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/common/run.c
Report SIGBUS and halt simulation when ld/st detect a misaligned address.
[thirdparty/binutils-gdb.git] / sim / common / run.c
index 72d7509d721cf733e09cda6d160f7f317e472ce6..1a4e96908f11686d361c6888374454d4a714fcc4 100644 (file)
@@ -45,6 +45,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "bfd.h"
 #include "callback.h"
 #include "remote-sim.h"
+#include "ansidecl.h"
 
 #include "../libiberty/alloca-conf.h"
 
@@ -69,7 +70,7 @@ int (*ui_loop_hook) PARAMS ((int signo));
 static SIM_DESC sd;
 
 static RETSIGTYPE
-cntrl_c (int sig)
+cntrl_c (int sig ATTRIBUTE_UNUSED)
 {
   if (! sim_stop (sd))
     {
@@ -230,26 +231,30 @@ main (ac, av)
   if (sim_create_inferior (sd, abfd, prog_args, NULL) == SIM_RC_FAIL)
     exit (1);
 
-  prev_sigint = signal (SIGINT, cntrl_c);
   if (trace)
     {
       int done = 0;
+      prev_sigint = signal (SIGINT, cntrl_c);
       while (!done)
        {
          done = sim_trace (sd);
        }
+      signal (SIGINT, prev_sigint);
     }
   else
     {
-      sim_resume (sd, 0, 0);
+      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);
     }
-  signal (SIGINT, prev_sigint);
 
   if (verbose)
     sim_info (sd, 0);
-
-  sim_stop_reason (sd, &reason, &sigrc);
-
   sim_close (sd, 0);
 
   /* If reason is sim_exited, then sigrc holds the exit code which we want