Skip to content

Commit ba3c35d

Browse files
committed
tcg/cpu-exec: precise single-stepping after an interrupt
When single-stepping with a debugger attached to QEMU, and when an interrupt is raised, the debugger misses the first instruction after the interrupt. Tested-by: Luc Michel <[email protected]> Reviewed-by: Luc Michel <[email protected]> Buglink: https://bugs.launchpad.net/qemu/+bug/757702 Message-Id: <[email protected]> Signed-off-by: Richard Henderson <[email protected]>
1 parent a7ba744 commit ba3c35d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

accel/tcg/cpu-exec.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,13 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
588588
else {
589589
if (cc->cpu_exec_interrupt(cpu, interrupt_request)) {
590590
replay_interrupt();
591-
cpu->exception_index = -1;
591+
/*
592+
* After processing the interrupt, ensure an EXCP_DEBUG is
593+
* raised when single-stepping so that GDB doesn't miss the
594+
* next instruction.
595+
*/
596+
cpu->exception_index =
597+
(cpu->singlestep_enabled ? EXCP_DEBUG : -1);
592598
*last_tb = NULL;
593599
}
594600
/* The target hook may have updated the 'cpu->interrupt_request';

0 commit comments

Comments
 (0)