qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: alex.bennee@linaro.org
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Richard Henderson" <rth@twiddle.net>
Subject: [Qemu-devel] [RCF PATCH 1/2] tcg: add tcg_abort_dbg() for additional debug info
Date: Wed, 12 Mar 2014 14:12:56 +0000	[thread overview]
Message-ID: <1394633577-18053-2-git-send-email-alex.bennee@linaro.org> (raw)
In-Reply-To: <1394633577-18053-1-git-send-email-alex.bennee@linaro.org>

From: Alex Bennée <alex.bennee@linaro.org>

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)
-- 
1.9.0

  reply	other threads:[~2014-03-12 14:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 14:12 [Qemu-devel] [RCF PATCH 0/2] Improving TCG debug output alex.bennee
2014-03-12 14:12 ` alex.bennee [this message]
2014-03-12 15:02   ` [Qemu-devel] [RCF PATCH 1/2] tcg: add tcg_abort_dbg() for additional debug info Peter Maydell
2014-03-12 15:05     ` Richard Henderson
2014-03-12 14:12 ` [Qemu-devel] [RCF PATCH 2/2] tcg: add debug helpers tcg_debug_dump_i(32|64) alex.bennee
  -- strict thread matches above, loose matches on Subject: below --
2014-03-12 13:49 [Qemu-devel] [RCF PATCH 0/2] Improving TCG debug output alex.bennee
2014-03-12 13:49 ` [Qemu-devel] [RCF PATCH 1/2] tcg: add tcg_abort_dbg() for additional debug info alex.bennee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394633577-18053-2-git-send-email-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).