aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-07-15 16:13:12 +0000
committerAndrew Cagney <cagney@redhat.com>2002-07-15 16:13:12 +0000
commit39248af88ff763d5996858f16e87c7c1e14facfd (patch)
treefd6a6c3df2bf98ba416842d20d0d8234e5b47226 /sim/common
parent7c43edc1d206c42b6ed8e6da7dbd6265d25fa66f (diff)
downloadgdb-39248af88ff763d5996858f16e87c7c1e14facfd.zip
gdb-39248af88ff763d5996858f16e87c7c1e14facfd.tar.gz
gdb-39248af88ff763d5996858f16e87c7c1e14facfd.tar.bz2
* sim-resume.c (sim_resume): Add local variable sig_to_deliver to
avoid possible longjmp problems with automatic variable siggnal.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog5
-rw-r--r--sim/common/sim-resume.c17
2 files changed, 16 insertions, 6 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 6ab7edf..a55a55c 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,8 @@
+2002-07-15 Andrew Cagney <ac131313@redhat.com>
+
+ * sim-resume.c (sim_resume): Add local variable sig_to_deliver to
+ avoid possible longjmp problems with automatic variable siggnal.
+
2002-07-14 Andrew Cagney <ac131313@redhat.com>
From 2002-07-11 Momchil Velikov <velco@fadata.bg>:
diff --git a/sim/common/sim-resume.c b/sim/common/sim-resume.c
index 8cf75d5..d7d61e7 100644
--- a/sim/common/sim-resume.c
+++ b/sim/common/sim-resume.c
@@ -65,24 +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. */
- if (jmpval == sim_engine_restart_jmpval)
- siggnal = 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;