summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2008-03-14 21:54:13 +0200
committerDaniel Stone <daniel@fooishbar.org>2008-03-14 21:56:31 +0200
commit88bec0915e3867f8dbf859a3dfbb771d0d07092d (patch)
tree2289e9f04564a59aadade3f3192a0fb679d8be6a /mi
parent57d48d94b8947c571925e6fd4c9bf041fbd1b2ac (diff)
mi: More meaningful assert crashes
When we fail an assert in miregion.c (which happens every now and then, though I haven't yet checked up why), at least generate a segfault, so we'll get a backtrace.
Diffstat (limited to 'mi')
-rw-r--r--mi/miregion.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/mi/miregion.c b/mi/miregion.c
index 45768a34f..69ecdc246 100644
--- a/mi/miregion.c
+++ b/mi/miregion.c
@@ -89,9 +89,14 @@ Equipment Corporation.
#undef assert
#ifdef DEBUG
-#define assert(expr) {if (!(expr)) \
- FatalError("Assertion failed file %s, line %d: expr\n", \
- __FILE__, __LINE__); }
+#define assert(expr) { \
+ CARD32 *foo = NULL; \
+ if (!(expr)) { \
+ ErrorF("Assertion failed file %s, line %d: %s\n", \
+ __FILE__, __LINE__, #expr); \
+ *foo = 0xdeadbeef; /* to get a backtrace */ \
+ } \
+ }
#else
#define assert(expr)
#endif