From patchwork Mon Apr 30 20:46:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastian Koppelmann X-Patchwork-Id: 10372921 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0ED3760384 for ; Mon, 30 Apr 2018 20:48:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3CD12883B for ; Mon, 30 Apr 2018 20:48:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E75A328852; Mon, 30 Apr 2018 20:48:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EE5DE28946 for ; Mon, 30 Apr 2018 20:48:39 +0000 (UTC) Received: from localhost ([::1]:33344 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDFiu-0003TR-Si for patchwork-qemu-devel@patchwork.kernel.org; Mon, 30 Apr 2018 16:48:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDFhE-0002ot-Lc for qemu-devel@nongnu.org; Mon, 30 Apr 2018 16:46:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fDFhA-0001P0-NW for qemu-devel@nongnu.org; Mon, 30 Apr 2018 16:46:52 -0400 Received: from mail.uni-paderborn.de ([131.234.142.9]:41052) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fDFhA-0001LP-CG for qemu-devel@nongnu.org; Mon, 30 Apr 2018 16:46:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Message-Id:Date:Subject:To:From:Sender :Reply-To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=vF+cnBQiAnoassuH3Efwuwe/BFBObfaowIikAJv+A28=; b=rhBkB3Wn31/ed1QJd9MTyswrXQ venYc64lezM9Doc+9kmDyRABt3qhhekRcjvwEx/3pXx7axcnHKm4YxR3Lb7nobJUS1Xd7aOtrf2z3 0rhWPW+BV80maa25OWMRdeyA5yYDOIXJjL5dcraG/+h3vieOSysTJzpfmX3nyLA2gok4=; From: Bastian Koppelmann To: qemu-devel@nongnu.org Date: Mon, 30 Apr 2018 22:46:40 +0200 Message-Id: <20180430204640.1713-1-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.11.0 X-IMT-Spam-Score: 0.0 () X-PMX-Version: 6.4.2.2738846, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2018.4.30.204216, AntiVirus-Engine: 5.49.1, AntiVirus-Data: 2018.4.9.5491000 X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 131.234.142.9 Subject: [Qemu-devel] [PATCH] target/tricore: Fix QEMU crashing when using -singlestep X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP when -singlestep is enabled we will actually return a tb->size of 0, even though we emit one instruction. This is because we do the update to ctx.pc after exiting the translation loop on the singlestep path. Therefore we substract pc_start from ctx.pc, aka pc_start. Signed-off-by: Bastian Koppelmann --- target/tricore/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 diff --git a/target/tricore/translate.c b/target/tricore/translate.c index aef0d9cf06..be2579d189 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -8843,12 +8843,12 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) ctx.opcode = cpu_ldl_code(env, ctx.pc); decode_opc(env, &ctx, 0); + ctx.pc = ctx.next_pc; if (num_insns >= max_insns || tcg_op_buf_full()) { gen_save_pc(ctx.next_pc); tcg_gen_exit_tb(0); break; } - ctx.pc = ctx.next_pc; } gen_tb_end(tb, num_insns);