diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-10-19 18:49:57 +0100 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2018-11-12 15:48:00 +0100 |
commit | b10089a14cad93ca5cdcd441a23f522d1e15f554 (patch) | |
tree | 68d25c7d18ec1b99279f9c3b783a6277766575e6 /linux-user/aarch64 | |
parent | e285977e77e534f128413b86cabab68bbffcbe4c (diff) | |
download | qemu-b10089a14cad93ca5cdcd441a23f522d1e15f554.zip qemu-b10089a14cad93ca5cdcd441a23f522d1e15f554.tar.gz qemu-b10089a14cad93ca5cdcd441a23f522d1e15f554.tar.bz2 |
linux-user: Don't call gdb_handlesig() before queue_signal()
The CPU main-loop routines for linux-user generally
call gdb_handlesig() when they're about to queue a
SIGTRAP signal. This is wrong, because queue_signal()
will cause us to pend a signal, and process_pending_signals()
will then call gdb_handlesig() itself. So the effect is that
we notify gdb of the SIGTRAP, and then if gdb says "OK,
continue with signal X" we will incorrectly notify
gdb of the signal X as well. We don't do this double-notify
for anything else, only SIGTRAP.
Remove this unnecessary and incorrect code from all
the targets except for nios2 (whose main loop is
doing something different and broken, and will be handled
in a separate patch).
This bug only manifests if the user responds to the reported
SIGTRAP using "signal SIGFOO" rather than "continue"; since
the latter is the overwhelmingly common thing to do after a
breakpoint most people won't have hit this.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20181019174958.26616-2-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/aarch64')
-rw-r--r-- | linux-user/aarch64/cpu_loop.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index c97a646..65d815f 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -73,7 +73,7 @@ void cpu_loop(CPUARMState *env) { CPUState *cs = CPU(arm_env_get_cpu(env)); - int trapnr, sig; + int trapnr; abi_long ret; target_siginfo_t info; @@ -121,13 +121,10 @@ void cpu_loop(CPUARMState *env) break; case EXCP_DEBUG: case EXCP_BKPT: - sig = gdb_handlesig(cs, TARGET_SIGTRAP); - if (sig) { - info.si_signo = sig; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } + info.si_signo = TARGET_SIGTRAP; + info.si_errno = 0; + info.si_code = TARGET_TRAP_BRKPT; + queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); break; case EXCP_SEMIHOST: env->xregs[0] = do_arm_semihosting(env); |