OSDN Git Service

linux-user/s390x: Fix single-stepping SVC
authorIlya Leoshkevich <iii@linux.ibm.com>
Wed, 10 May 2023 23:02:12 +0000 (01:02 +0200)
committerThomas Huth <thuth@redhat.com>
Mon, 5 Jun 2023 05:27:23 +0000 (07:27 +0200)
Currently single-stepping SVC executes two instructions. The reason is
that EXCP_DEBUG for the SVC instruction itself is masked by EXCP_SVC.
Fix by re-raising EXCP_DEBUG.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20230510230213.330134-2-iii@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
linux-user/s390x/cpu_loop.c

index 285bc60..8b7ac28 100644 (file)
@@ -86,6 +86,15 @@ void cpu_loop(CPUS390XState *env)
             } else if (ret != -QEMU_ESIGRETURN) {
                 env->regs[2] = ret;
             }
+
+            if (unlikely(cs->singlestep_enabled)) {
+                /*
+                 * cpu_tb_exec() did not raise EXCP_DEBUG, because it has seen
+                 * that EXCP_SVC was already pending.
+                 */
+                cs->exception_index = EXCP_DEBUG;
+            }
+
             break;
 
         case EXCP_DEBUG: