diff options
author | Mark Mitchell <mark@codesourcery.com> | 2005-11-28 18:33:03 +0000 |
---|---|---|
committer | Mark Mitchell <mark@codesourcery.com> | 2005-11-28 18:33:03 +0000 |
commit | aba6488e0b73756f31f154d12a228baa82a68d8a (patch) | |
tree | a341ee1db97cb96dc8145f58351a1e09a20cde9b /sim/common | |
parent | 274b5ecdd76b658da77bc87fb720d79e485a6b2f (diff) | |
download | gdb-aba6488e0b73756f31f154d12a228baa82a68d8a.zip gdb-aba6488e0b73756f31f154d12a228baa82a68d8a.tar.gz gdb-aba6488e0b73756f31f154d12a228baa82a68d8a.tar.bz2 |
* remote-sim.c (gdbsim_wait): Pass target signal numbers to
sim_resume. Expect target signal numbers from sim_stop_reason.
* wrapper.c (gdb/signals.h): Include it.
(SIGTRAP): Don't define.
(SIGBUS): Likewise.
(sim_stop_reason): Use TARGET_SIGNAL_* instead of SIG*.
* 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.
* interp.c (gdb/signals.h): Include it.
(sim_stop_reason): Use TARGET_SIGNAL_*.
* interf.c: (gdb/signals.h): Include it.
(sim_stop_reason): Use TARGET_SIGNAL_*.
* sim_calls.c (gdb/signals.h): Include it.
(sim_stop_reason): Use TARGET_SIGNAL_*.
* psim.c (cntrl_c_simulation): Use TARGET_SIGNAL_*.
Diffstat (limited to 'sim/common')
-rw-r--r-- | sim/common/ChangeLog | 7 | ||||
-rw-r--r-- | sim/common/sim-reason.c | 16 | ||||
-rw-r--r-- | sim/common/sim-signal.c | 41 | ||||
-rw-r--r-- | sim/common/sim-signal.h | 3 |
4 files changed, 52 insertions, 15 deletions
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 */ |