system/corennnnn
修訂 | ecd23c09e87d7088285f8b7c2eeb98815c2e69e0 (tree) |
---|---|
時間 | 2009-08-09 05:54:49 |
作者 | Joe Onorato <joeo@andr...> |
Commiter | Joe Onorato |
Try not to crash with no error message.
@@ -8,6 +8,9 @@ | ||
8 | 8 | * |
9 | 9 | */ |
10 | 10 | |
11 | +#define LOG_TAG "acc" | |
12 | +#include <cutils/log.h> | |
13 | + | |
11 | 14 | #include <ctype.h> |
12 | 15 | #include <errno.h> |
13 | 16 | #include <stdarg.h> |
@@ -51,6 +54,8 @@ | ||
51 | 54 | #define ENABLE_ARM_DISASSEMBLY |
52 | 55 | // #define PROVIDE_TRACE_CODEGEN |
53 | 56 | |
57 | +#define assert(b) assertImpl(b, __LINE__) | |
58 | + | |
54 | 59 | namespace acc { |
55 | 60 | |
56 | 61 | // Subset of STL vector. |
@@ -562,10 +567,11 @@ class Compiler : public ErrorSink { | ||
562 | 567 | va_end(ap); |
563 | 568 | } |
564 | 569 | |
565 | - void assert(bool test) { | |
570 | + void assertImpl(bool test, int line) { | |
566 | 571 | if (!test) { |
572 | + error("code generator assertion failed at line %s:%d.", __FILE__, line); | |
573 | + LOGD("code generator assertion failed at line %s:%d.", __FILE__, line); | |
567 | 574 | * (char*) 0 = 0; |
568 | - error("code generator assertion failed."); | |
569 | 575 | } |
570 | 576 | } |
571 | 577 |
@@ -3436,8 +3442,9 @@ class Compiler : public ErrorSink { | ||
3436 | 3442 | * (char*) 0 = 0; |
3437 | 3443 | } |
3438 | 3444 | |
3439 | - void assert(bool isTrue) { | |
3445 | + void assertImpl(bool isTrue, int line) { | |
3440 | 3446 | if (!isTrue) { |
3447 | + LOGD("assertion failed at line %s:%d.", __FILE__, line); | |
3441 | 3448 | internalError(); |
3442 | 3449 | } |
3443 | 3450 | } |