tcg patch queue
The following changes since commit 95d1fbabae0cd44156ac4b96d512d143ca7dfd5e:
Merge remote-tracking branch 'remotes/kraxel/tags/fixes-20200716-pull-request' into staging (2020-07-16 18:50:51 +0100)
are available in the Git repository at:
https://github.com/rth7680/qemu.git tags/pull-tcg-20200717
for you to fetch changes up to ba3c35d9c4026361fd380b269dc6def9510b7166:
tcg/cpu-exec: precise single-stepping after an interrupt (2020-07-17 11:09:34 -0700)
----------------------------------------------------------------
Fix vector min/max fallback expansion
Fix singlestep from exception and interrupt
----------------------------------------------------------------
Luc Michel (1):
tcg/cpu-exec: precise single-stepping after an exception
Richard Henderson (2):
tcg: Save/restore vecop_list around minmax fallback tcg/cpu-exec: precise single-stepping after an interrupt
accel/tcg/cpu-exec.c | 19 ++++++++++++++++++- tcg/tcg-op-vec.c | 2 ++ 2 files changed, 20 insertions(+), 1 deletion(-)
[PULL for-5.1 1/3] tcg: Save/restore vecop_list around minmax fallback
Forgetting this asserts when tcg_gen_cmp_vec is called from within tcg_gen_cmpsel_vec.
--- tcg/tcg-op-vec.c | 2 ++ 1 file changed, 2 insertions(+)
tcg/tcg-op-vec.c +2 -0
@@ -657,7 +657,9 @@ static void do_minmax(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b, TCGOpcode opc, TCGCond cond) { if (!do_op3(vece, r, a, b, opc)) { + const TCGOpcode *hold_list = tcg_swap_vecop_list(NULL);tcg_gen_cmpsel_vec (cond, vece, r, a, b, a, b); +tcg_swap_vecop_list (hold_list); } }
Signature · 1 line
2.25.1
[PULL for-5.1 2/3] tcg/cpu-exec: precise single-stepping after an exception
In reply to Richard HendersonFrom: Luc Michel <[email protected]>
When single-stepping with a debugger attached to QEMU, and when an exception is raised, the debugger misses the first instruction after the exception:
$ qemu-system-aarch64 -M virt -display none -cpu cortex-a53 -s -S
$ aarch64-linux-gnu-gdb GNU gdb (GDB) 9.2 [...] (gdb) tar rem :1234 Remote debugging using :1234 warning: No executable has been specified and target does not support determining executable automatically. Try using the "file" command. 0x0000000000000000 in ?? () (gdb) # writing nop insns to 0x200 and 0x204 (gdb) set *0x200 = 0xd503201f (gdb) set *0x204 = 0xd503201f (gdb) # 0x0 address contains 0 which is an invalid opcode. (gdb) # The CPU should raise an exception and jump to 0x200 (gdb) si 0x0000000000000204 in ?? ()
With this commit, the same run steps correctly on the first instruction of the exception vector:
(gdb) si0x0000000000000200 in ?? ()
Message-Id: <[email protected]>
--- accel/tcg/cpu-exec.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
accel/tcg/cpu-exec.c +11 -0
@@ -504,6 +504,17 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) cc->do_interrupt (cpu);qemu_mutex_unlock_iothread (); cpu->exception_index =-1 ; + +if (unlikely (cpu->singlestep_enabled)) { +/* +* After processing the exception, ensure an EXCP_DEBUG is +* raised when single-stepping so that GDB doesn't miss the +* next instruction. +*/ + *ret =EXCP_DEBUG ; +cpu_handle_debug_exception (cpu); +return true; + } }else if (!replay_has_interrupt ()) {/* give a chance to iothread in replay mode */ *ret =EXCP_INTERRUPT ;
Signature · 1 line
2.25.1
[PULL for-5.1 3/3] tcg/cpu-exec: precise single-stepping after an interrupt
In reply to Richard HendersonWhen single-stepping with a debugger attached to QEMU, and when an interrupt is raised, the debugger misses the first instruction after the interrupt.
Message-Id: <[email protected]>
--- accel/tcg/cpu-exec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
accel/tcg/cpu-exec.c +7 -1
@@ -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';
Signature · 1 line
2.25.1
Re: [PULL for-5.1 3/3] tcg/cpu-exec: precise single-stepping after an interrupt
Quoted 20 lines · Richard Henderson
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]>Message-Id: <[email protected]>
Signed-off-by Richard Henderson <[email protected]>--- accel/tcg/cpu-exec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)accel/tcg/cpu-exec.c +0
-0@@ -588,7 +588,13 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,else {if (cc->cpu_exec_interrupt (cpu, interrupt_request)) {
accel/tcg/cpu-exec.c static inline bool cpu_handle_interrupt(CPUState *cpu, · line 598
Quoted 10 lines
accel/tcg/cpu-exec.c +7
-1replay_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 ;
I just rebased my reverse debugging patches and noticed that this breaks the debugging in record/replay icount mode for i386. At some points "si" in remote gdb does nothing.
This happens because of CPU_INTERRUPT_POLL. These are not real interrupts and converted into HW interrupt_request flags later.
Therefore we shouldn't stop when there is CPU_INTERRUPT_POLL request.
accel/tcg/cpu-exec.c static inline bool cpu_handle_interrupt(CPUState *cpu, · line 600
Quoted 3 lines
accel/tcg/cpu-exec.c +0
-0}/* The target hook may have updated the 'cpu->interrupt_request';
Pavel Dovgalyuk
Peter Maydell
AppliedQuoted 9 lines · Richard Henderson
The following changes since commit
95d1fbabae0cd44156ac4b96d512d143ca7dfd5e:Merge remote-tracking branch 'remotes/kraxel/tags/fixes-20200716-pull-request' into staging (2020-07-16 18:50:51 +0100)
are available in the Git repository at:
https://github.com/rth7680/qemu.git tags/pull-tcg-20200717
Quoted 7 lines
for you to fetch changes up to
ba3c35d9c4026361fd380b269dc6def9510b7166:tcg/cpu-exec: precise single-stepping after an interrupt (2020-07-17 11:09:34 -0700)
----------------------------------------------------------------
Fix vector min/max fallback expansion
Fix singlestep from exception and interrupt
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.
-- PMM