From patchwork Wed Mar 12 14:12:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 329475 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2F53F2C00E0 for ; Thu, 13 Mar 2014 01:15:24 +1100 (EST) Received: from localhost ([::1]:60876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNjwH-0002Oy-VB for incoming@patchwork.ozlabs.org; Wed, 12 Mar 2014 10:15:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNjuI-0008D1-EQ for qemu-devel@nongnu.org; Wed, 12 Mar 2014 10:13:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNju9-0004TG-Ou for qemu-devel@nongnu.org; Wed, 12 Mar 2014 10:13:18 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:33622 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNju9-0004T4-Ih for qemu-devel@nongnu.org; Wed, 12 Mar 2014 10:13:09 -0400 Received: from localhost ([127.0.0.1] helo=zen.linaro.local) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1WNjuM-0003E8-W5; Wed, 12 Mar 2014 15:13:23 +0100 From: alex.bennee@linaro.org To: qemu-devel@nongnu.org Date: Wed, 12 Mar 2014 14:12:56 +0000 Message-Id: <1394633577-18053-2-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1394633577-18053-1-git-send-email-alex.bennee@linaro.org> References: <1394633577-18053-1-git-send-email-alex.bennee@linaro.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: alex.bennee@linaro.org X-SA-Exim-Scanned: No (on socrates.bennee.com); SAEximRunCond expanded to false X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 88.198.71.155 Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [Qemu-devel] [RCF PATCH 1/2] tcg: add tcg_abort_dbg() for additional debug info X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Alex Bennée There are times the tcg aborts with a fatal but terse error which isn't overly helpful. This adds an alternative macro that can be used to show a little more helper information when an abort occurs. diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c index f832282..1a6c565 100644 --- a/tcg/i386/tcg-target.c +++ b/tcg/i386/tcg-target.c @@ -1342,7 +1342,7 @@ static void tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l) } break; default: - tcg_abort(); + tcg_abort_dbg("bad opc:%x", opc); } /* Jump to the code corresponding to next IR of qemu_st */ @@ -1519,7 +1519,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg datalo, TCGReg datahi, } break; default: - tcg_abort(); + tcg_abort_dbg("bad memop=%x", memop); } } diff --git a/tcg/optimize.c b/tcg/optimize.c index 7777743..ae1a3f8 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -407,7 +407,7 @@ static bool do_constant_folding_cond_eq(TCGCond c) case TCG_COND_EQ: return 1; default: - tcg_abort(); + tcg_abort_dbg("bad condition:%d", c); } } diff --git a/tcg/tcg.h b/tcg/tcg.h index f7efcb4..bfde09f 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -657,12 +657,15 @@ typedef struct TCGTargetOpDef { const char *args_ct_str[TCG_MAX_OP_ARGS]; } TCGTargetOpDef; -#define tcg_abort() \ +#define tcg_abort_dbg(fmt, ...)\ do {\ - fprintf(stderr, "%s:%d: tcg fatal error\n", __FILE__, __LINE__);\ + fprintf(stderr, "%s:%d: tcg fatal error " fmt "\n",\ + __FILE__, __LINE__, ## __VA_ARGS__);\ abort();\ } while (0) +#define tcg_abort() tcg_abort_dbg("") + #ifdef CONFIG_DEBUG_TCG # define tcg_debug_assert(X) do { assert(X); } while (0) #elif QEMU_GNUC_PREREQ(4, 5)