qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] flush TB on singlestep command


From: Jun Koi
Subject: [Qemu-devel] [PATCH] flush TB on singlestep command
Date: Fri, 16 Apr 2010 10:03:44 +0900

(Thanks to Jan for comments on the last patch)

Qemu has a command named singlestep, which reduces the translated code
block to be only one instruction.
However, there is one flaw when this command is triggered via monitor
interface: we do not flush all the current TBs, so we will miss
single-step on already translated code.
This patch fixes the problem by flushing all the TB to force new code
generation.

Signed-off-by: Jun Koi <address@hidden>



diff --git a/monitor.c b/monitor.c
index 5659991..948b861 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1190,8 +1190,14 @@ static void do_log(Monitor *mon, const QDict *qdict)
 static void do_singlestep(Monitor *mon, const QDict *qdict)
 {
     const char *option = qdict_get_try_str(qdict, "option");
+    CPUState *env;
+
     if (!option || !strcmp(option, "on")) {
         singlestep = 1;
+        /* flush all the TBs to force new code generation */
+        for (env = first_cpu; env != NULL; env = env->next_cpu) {
+            tb_flush(env);
+        }
     } else if (!strcmp(option, "off")) {
         singlestep = 0;
     } else {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]