aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/remote-sim.c17
-rw-r--r--sim/arm/ChangeLog7
-rw-r--r--sim/arm/wrapper.c15
-rw-r--r--sim/common/ChangeLog7
-rw-r--r--sim/common/sim-reason.c16
-rw-r--r--sim/common/sim-signal.c41
-rw-r--r--sim/common/sim-signal.h3
-rw-r--r--sim/d10v/ChangeLog5
-rw-r--r--sim/d10v/interp.c9
-rw-r--r--sim/erc32/ChangeLog5
-rw-r--r--sim/erc32/interf.c8
-rw-r--r--sim/ppc/ChangeLog6
-rw-r--r--sim/ppc/psim.c2
-rw-r--r--sim/ppc/sim_calls.c5
15 files changed, 100 insertions, 51 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2246d8d..d630731 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2005-11-28 Mark Mitchell <mark@codesourcery.com>
+
+ * remote-sim.c (gdbsim_wait): Pass target signal numbers to
+ sim_resume. Expect target signal numbers from sim_stop_reason.
+
2005-11-27 Christopher Faylor <cgf@timesys.com>
* win32-nat.c (env_sort): New function.
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 6341b3c..e6fc0bd 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -674,8 +674,7 @@ gdbsim_wait (ptid_t ptid, struct target_waitstatus *status)
#else
prev_sigint = signal (SIGINT, gdbsim_cntrl_c);
#endif
- sim_resume (gdbsim_desc, resume_step,
- target_signal_to_host (resume_siggnal));
+ sim_resume (gdbsim_desc, resume_step, resume_siggnal);
signal (SIGINT, prev_sigint);
resume_step = 0;
@@ -690,24 +689,20 @@ gdbsim_wait (ptid_t ptid, struct target_waitstatus *status)
case sim_stopped:
switch (sigrc)
{
- case SIGABRT:
+ case TARGET_SIGNAL_ABRT:
quit ();
break;
- case SIGINT:
- case SIGTRAP:
+ case TARGET_SIGNAL_INT:
+ case TARGET_SIGNAL_TRAP:
default:
status->kind = TARGET_WAITKIND_STOPPED;
- /* The signal in sigrc is a host signal. That probably
- should be fixed. */
- status->value.sig = target_signal_from_host (sigrc);
+ status->value.sig = sigrc;
break;
}
break;
case sim_signalled:
status->kind = TARGET_WAITKIND_SIGNALLED;
- /* The signal in sigrc is a host signal. That probably
- should be fixed. */
- status->value.sig = target_signal_from_host (sigrc);
+ status->value.sig = sigrc;
break;
case sim_running:
case sim_polling:
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index 0e32a65..84bdf6e 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,3 +1,10 @@
+2005-11-23 Mark Mitchell <mark@codesourcery.com>
+
+ * wrapper.c (gdb/signals.h): Include it.
+ (SIGTRAP): Don't define.
+ (SIGBUS): Likewise.
+ (sim_stop_reason): Use TARGET_SIGNAL_* instead of SIG*.
+
2005-11-16 Shaun Jackman <sjackman@gmail.com>
* sim/arm/armos.c: Include limits.h
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index 9736add..4133110 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -37,14 +37,7 @@
#include "sim-utils.h"
#include "run-sim.h"
#include "gdb/sim-arm.h"
-
-#ifndef SIGTRAP
-#define SIGTRAP 5
-#endif
-
-#ifndef SIGBUS
-#define SIGBUS SIGSEGV
-#endif
+#include "gdb/signals.h"
host_callback *sim_callback;
@@ -910,7 +903,7 @@ sim_stop_reason (sd, reason, sigrc)
if (stop_simulator)
{
*reason = sim_stopped;
- *sigrc = SIGINT;
+ *sigrc = TARGET_SIGNAL_INT;
}
else if (state->EndCondition == 0)
{
@@ -921,10 +914,10 @@ sim_stop_reason (sd, reason, sigrc)
{
*reason = sim_stopped;
if (state->EndCondition == RDIError_BreakpointReached)
- *sigrc = SIGTRAP;
+ *sigrc = TARGET_SIGNAL_TRAP;
else if ( state->EndCondition == RDIError_DataAbort
|| state->EndCondition == RDIError_AddressException)
- *sigrc = SIGBUS;
+ *sigrc = TARGET_SIGNAL_BUS;
else
*sigrc = 0;
}
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 5e4e5a4..c27e7d7 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,10 @@
+2005-11-28 Mark Mitchell <mark@codesourcery.com>
+
+ * sim-reason.c (sim_stop_reason): Use
+ sim_signal_to_target, not sim_signal_to_host.
+ * sim-signal.c (sim_signal_to_host): Fix typo.
+ (sim_signal_to_target): New function.
+
2005-07-10 Hans-Peter Nilsson <hp@bitrange.com>
* sim-load.c (xprintf, eprintf): Remove fallout from ANSI_PROTOTYPES
diff --git a/sim/common/sim-reason.c b/sim/common/sim-reason.c
index b540df3..383df02 100644
--- a/sim/common/sim-reason.c
+++ b/sim/common/sim-reason.c
@@ -35,21 +35,9 @@ sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc)
case sim_exited :
*sigrc = engine->sigrc;
break;
- case sim_signalled :
- /* ??? See the comment below case `sim_signalled' in
- gdb/remote-sim.c:gdbsim_wait.
- ??? Consider the case of the target requesting that it
- kill(2) itself with SIGNAL. That SIGNAL, being target
- specific, will not correspond to either of the SIM_SIGNAL
- enum nor the HOST_SIGNAL. A mapping from TARGET_SIGNAL to
- HOST_SIGNAL is needed. */
- *sigrc = sim_signal_to_host (sd, engine->sigrc);
- break;
case sim_stopped :
- /* The gdb/simulator interface calls for us to return the host
- version of the signal which gdb then converts into the
- target's version. This is obviously a bit clumsy. */
- *sigrc = sim_signal_to_host (sd, engine->sigrc);
+ case sim_signalled :
+ *sigrc = sim_signal_to_target (sd, engine->sigrc);
break;
default :
abort ();
diff --git a/sim/common/sim-signal.c b/sim/common/sim-signal.c
index 77709b1..e8fd10c 100644
--- a/sim/common/sim-signal.c
+++ b/sim/common/sim-signal.c
@@ -77,7 +77,7 @@ sim_signal_to_host (SIM_DESC sd, SIM_SIGNAL sig)
break;
case SIM_SIGFPE:
-#ifdef SIGXCPU
+#ifdef SIGFPE
return SIGFPE;
#endif
break;
@@ -94,3 +94,42 @@ sim_signal_to_host (SIM_DESC sd, SIM_SIGNAL sig)
return 1;
#endif
}
+
+int
+sim_signal_to_target (SIM_DESC sd, SIM_SIGNAL sig)
+{
+ switch (sig)
+ {
+ case SIM_SIGINT :
+ return TARGET_SIGNAL_INT;
+
+ case SIM_SIGABRT :
+ return TARGET_SIGNAL_ABRT;
+
+ case SIM_SIGILL :
+ return TARGET_SIGNAL_ILL;
+
+ case SIM_SIGTRAP :
+ return TARGET_SIGNAL_TRAP;
+
+ case SIM_SIGBUS :
+ return TARGET_SIGNAL_BUS;
+
+ case SIM_SIGSEGV
+ return TARGET_SIGNAL_SEGV;
+
+ case SIM_SIGXCPU :
+ return TARGET_SIGNAL_XCPU;
+
+ case SIM_SIGFPE:
+ return TARGET_SIGNAL_FPE;
+ break;
+
+ case SIM_SIGNONE:
+ return TARGET_SIGNAL_0;
+ break;
+ }
+
+ sim_io_eprintf (sd, "sim_signal_to_host: unknown signal: %d\n", sig);
+ return TARGET_SIGNAL_HUP;
+}
diff --git a/sim/common/sim-signal.h b/sim/common/sim-signal.h
index 272e17d..8dd0d8f 100644
--- a/sim/common/sim-signal.h
+++ b/sim/common/sim-signal.h
@@ -21,6 +21,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef SIM_SIGNAL_H
#define SIM_SIGNAL_H
+#include "gdb/signals.h"
+
/* Signals we use.
This provides a layer between our values and host/target values. */
@@ -45,5 +47,6 @@ typedef enum {
} SIM_SIGNAL;
int sim_signal_to_host (SIM_DESC sd, SIM_SIGNAL);
+enum target_signal sim_signal_to_target (SIM_DESC sd, SIM_SIGNAL);
#endif /* SIM_SIGNAL_H */
diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index 6662d8b..b1a5b54 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -1,3 +1,8 @@
+2005-11-28 Mark Mitchell <mark@codesourcery.com>
+
+ * interp.c (gdb/signals.h): Include it.
+ (sim_stop_reason): Use TARGET_SIGNAL_*.
+
2005-03-23 Mark Kettenis <kettenis@gnu.org>
* configure: Regenerate.
diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c
index e4bae22..26f36ec 100644
--- a/sim/d10v/interp.c
+++ b/sim/d10v/interp.c
@@ -6,6 +6,7 @@
#include "d10v_sim.h"
#include "gdb/sim-d10v.h"
+#include "gdb/signals.h"
enum _leftright { LEFT_FIRST, RIGHT_FIRST };
@@ -1277,17 +1278,13 @@ sim_stop_reason (sd, reason, sigrc)
case SIG_D10V_BUS:
*reason = sim_stopped;
-#ifdef SIGBUS
- *sigrc = SIGBUS;
-#else
- *sigrc = SIGSEGV;
-#endif
+ *reson = TARGET_SIGNAL_BUS;
break;
default: /* some signal */
*reason = sim_stopped;
if (stop_simulator && !State.exception)
- *sigrc = SIGINT;
+ *sigrc = TARGET_SIGNAL_INT;
else
*sigrc = State.exception;
break;
diff --git a/sim/erc32/ChangeLog b/sim/erc32/ChangeLog
index 7bf7bc2..4636b90 100644
--- a/sim/erc32/ChangeLog
+++ b/sim/erc32/ChangeLog
@@ -1,3 +1,8 @@
+2005-11-28 Mark Mitchell <mark@codesourcery.com>
+
+ * interf.c: (gdb/signals.h): Include it.
+ (sim_stop_reason): Use TARGET_SIGNAL_*.
+
2005-07-08 Ben Elliston <bje@au.ibm.com>
* func.c: Remove ANSI_PROTOTYPES conditional code.
diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c
index 3d53574..fe075e1 100644
--- a/sim/erc32/interf.c
+++ b/sim/erc32/interf.c
@@ -33,6 +33,7 @@
#include "sim-config.h"
#include "gdb/remote-sim.h"
+#include "gdb/signals.h"
#define PSR_CWP 0x7
@@ -386,16 +387,13 @@ sim_stop_reason(sd, reason, sigrc)
switch (simstat) {
case CTRL_C:
*reason = sim_stopped;
- *sigrc = SIGINT;
+ *sigrc = TARGET_SIGNAL_INT;
break;
case OK:
case TIME_OUT:
case BPT_HIT:
*reason = sim_stopped;
-#ifdef _WIN32
-#define SIGTRAP 5
-#endif
- *sigrc = SIGTRAP;
+ *sigrc = TARGET_SIGNAL_TRAP;
break;
case ERROR:
*sigrc = 0;
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index fe32804..285cfa2 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,3 +1,9 @@
+2005-11-28 Mark Mitchell <mark@codesourcery.com>
+
+ * sim_calls.c (gdb/signals.h): Include it.
+ (sim_stop_reason): Use TARGET_SIGNAL_*.
+ * psim.c (cntrl_c_simulation): Use TARGET_SIGNAL_*.
+
2005-07-15 Ben Elliston <bje@au.ibm.com>
* hw_htab.c (bfd_get_section_lma): Remove macro; use BFD's.
diff --git a/sim/ppc/psim.c b/sim/ppc/psim.c
index a574fe7..e2eac2a 100644
--- a/sim/ppc/psim.c
+++ b/sim/ppc/psim.c
@@ -572,7 +572,7 @@ cntrl_c_simulation(void *data)
psim_halt(system,
psim_nr_cpus(system),
was_continuing,
- SIGINT);
+ TARGET_SIGNAL_INT);
}
INLINE_PSIM\
diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c
index 08feb39..781ff05 100644
--- a/sim/ppc/sim_calls.c
+++ b/sim/ppc/sim_calls.c
@@ -44,6 +44,7 @@
#include "bfd.h"
#include "gdb/callback.h"
#include "gdb/remote-sim.h"
+#include "gdb/signals.h"
/* Define the rate at which the simulator should poll the host
for a quit. */
@@ -197,13 +198,13 @@ sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc)
case was_continuing:
*reason = sim_stopped;
if (status.signal == 0)
- *sigrc = SIGTRAP;
+ *sigrc = TARGET_SIGNAL_TRAP;
else
*sigrc = status.signal;
break;
case was_trap:
*reason = sim_stopped;
- *sigrc = SIGTRAP;
+ *sigrc = TARGET_SIGNAL_TRAP;
break;
case was_exited:
*reason = sim_exited;