daily update
[deliverable/binutils-gdb.git] / sim / common / sim-resume.c
index 09b475ec5c89eb30e8cfccbf237f60e7b2778d8e..d7d61e73c1deeb1e5c5daf1176094133f2be5ca0 100644 (file)
@@ -65,19 +65,29 @@ sim_resume (SIM_DESC sd,
       int last_cpu_nr = sim_engine_last_cpu_nr (sd);
       int next_cpu_nr = sim_engine_next_cpu_nr (sd);
       int nr_cpus = sim_engine_nr_cpus (sd);
+      int sig_to_deliver;
 
       sim_events_preprocess (sd, last_cpu_nr >= nr_cpus, next_cpu_nr >= nr_cpus);
       if (next_cpu_nr >= nr_cpus)
        next_cpu_nr = 0;
 
+      /* Only deliver the SIGGNAL [sic] the first time through - don't
+         re-deliver any SIGGNAL during a restart.  NOTE: A new local
+         variable is used to avoid problems with the automatic
+         variable ``siggnal'' being trashed by a long jump.  */
+      if (jmpval == sim_engine_start_jmpval)
+       sig_to_deliver = siggnal;
+      else
+       sig_to_deliver = 0;
+
 #ifdef SIM_CPU_EXCEPTION_RESUME
       {
        sim_cpu* cpu = STATE_CPU (sd, next_cpu_nr);
-       SIM_CPU_EXCEPTION_RESUME(sd, cpu, siggnal);
+       SIM_CPU_EXCEPTION_RESUME(sd, cpu, sig_to_deliver);
       }
 #endif
 
-      sim_engine_run (sd, next_cpu_nr, nr_cpus, siggnal);
+      sim_engine_run (sd, next_cpu_nr, nr_cpus, sig_to_deliver);
     }
   engine->jmpbuf = NULL;
 
This page took 0.023214 seconds and 4 git commands to generate.