From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O2ZzG-0002RQ-8L for qemu-devel@nongnu.org; Thu, 15 Apr 2010 21:04:50 -0400 Received: from [140.186.70.92] (port=45289 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O2ZzE-0002Cv-2O for qemu-devel@nongnu.org; Thu, 15 Apr 2010 21:04:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O2ZyX-0000wa-9n for qemu-devel@nongnu.org; Thu, 15 Apr 2010 21:04:06 -0400 Received: from mail-yw0-f198.google.com ([209.85.211.198]:42205) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O2ZyX-0000wV-3h for qemu-devel@nongnu.org; Thu, 15 Apr 2010 21:04:05 -0400 Received: by ywh36 with SMTP id 36so993174ywh.4 for ; Thu, 15 Apr 2010 18:04:04 -0700 (PDT) MIME-Version: 1.0 From: Jun Koi Date: Fri, 16 Apr 2010 10:03:44 +0900 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Subject: [Qemu-devel] [PATCH] flush TB on singlestep command List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Jan Kiszka (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 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 {