* [PATCH] tcg/cpu-exec: precise single-stepping after an interrupt
@ 2020-07-17 16:30 Richard Henderson
2020-07-17 18:03 ` Luc Michel
0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2020-07-17 16:30 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, luc.michel, peter.maydell
When single-stepping with a debugger attached to QEMU, and when an
interrupt is raised, the debugger misses the first instruction after
the interrupt.
Buglink: https://bugs.launchpad.net/qemu/+bug/757702
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
accel/tcg/cpu-exec.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 6a3d3a3cfc..66d38f9d85 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -588,7 +588,13 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
else {
if (cc->cpu_exec_interrupt(cpu, interrupt_request)) {
replay_interrupt();
- cpu->exception_index = -1;
+ /*
+ * After processing the interrupt, ensure an EXCP_DEBUG is
+ * raised when single-stepping so that GDB doesn't miss the
+ * next instruction.
+ */
+ cpu->exception_index =
+ (cpu->singlestep_enabled ? EXCP_DEBUG : -1);
*last_tb = NULL;
}
/* The target hook may have updated the 'cpu->interrupt_request';
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tcg/cpu-exec: precise single-stepping after an interrupt
2020-07-17 16:30 [PATCH] tcg/cpu-exec: precise single-stepping after an interrupt Richard Henderson
@ 2020-07-17 18:03 ` Luc Michel
0 siblings, 0 replies; 2+ messages in thread
From: Luc Michel @ 2020-07-17 18:03 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini, peter.maydell
On 7/17/20 6:30 PM, Richard Henderson wrote:
> When single-stepping with a debugger attached to QEMU, and when an
> interrupt is raised, the debugger misses the first instruction after
> the interrupt.
>
> Buglink: https://bugs.launchpad.net/qemu/+bug/757702
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Tested-by: Luc Michel <luc.michel@greensocs.com>
> ---
> accel/tcg/cpu-exec.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 6a3d3a3cfc..66d38f9d85 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -588,7 +588,13 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
> else {
> if (cc->cpu_exec_interrupt(cpu, interrupt_request)) {
> replay_interrupt();
> - cpu->exception_index = -1;
> + /*
> + * After processing the interrupt, ensure an EXCP_DEBUG is
> + * raised when single-stepping so that GDB doesn't miss the
> + * next instruction.
> + */
> + cpu->exception_index =
> + (cpu->singlestep_enabled ? EXCP_DEBUG : -1);
> *last_tb = NULL;
> }
> /* The target hook may have updated the 'cpu->interrupt_request';
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-17 18:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 16:30 [PATCH] tcg/cpu-exec: precise single-stepping after an interrupt Richard Henderson
2020-07-17 18:03 ` Luc Michel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.