Skip to content

Commit

Permalink
accel/tcg/cpu-exec: Fix precise single-stepping after interrupt
Browse files Browse the repository at this point in the history
In some cases, cpu->exit_request can be false after handling the
interrupt, leading to another TB being executed instead of returning
to the main loop.

Fix this by returning true unconditionally when in single-step mode.

Fixes: ba3c35d ("tcg/cpu-exec: precise single-stepping after an interrupt")
Signed-off-by: Luc Michel <lmichel@kalray.eu>
Message-Id: <20220214132656.11397-1-lmichel@kalray.eu>
[rth: Unlock iothread mutex; simplify indentation]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
luc-mchl authored and rth7680 committed Feb 28, 2022
1 parent 8929906 commit 5b7b197
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions accel/tcg/cpu-exec.c
Expand Up @@ -799,8 +799,12 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
* raised when single-stepping so that GDB doesn't miss the
* next instruction.
*/
cpu->exception_index =
(cpu->singlestep_enabled ? EXCP_DEBUG : -1);
if (unlikely(cpu->singlestep_enabled)) {
cpu->exception_index = EXCP_DEBUG;
qemu_mutex_unlock_iothread();
return true;
}
cpu->exception_index = -1;
*last_tb = NULL;
}
/* The target hook may have updated the 'cpu->interrupt_request';
Expand Down

0 comments on commit 5b7b197

Please sign in to comment.