From 1c8fc83dceb63bacbf236d017512015cfeb2c0a6 Mon Sep 17 00:00:00 2001 From: Satoshi Kataoka Date: Thu, 6 Sep 2012 21:31:54 +0900 Subject: [PATCH] Fix backtrace tool Change-Id: Icc0e8ad94331e62a569183fa05ada335dcc5e26a --- native/jni/src/defines.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/native/jni/src/defines.h b/native/jni/src/defines.h index 0286365bc..0b150ed7b 100644 --- a/native/jni/src/defines.h +++ b/native/jni/src/defines.h @@ -88,11 +88,13 @@ static inline void dumpWordInt(const int *word, const int length) { } #ifndef __ANDROID__ -#define ASSERT(success) do { if (!success) { showStackTrace(); assert(success);};} while (0) -#define SHOW_STACK_TRACE do { showStackTrace(); } while (0) - +#include #include #include + +#define ASSERT(success) do { if (!(success)) { showStackTrace(); assert(success);} } while (0) +#define SHOW_STACK_TRACE do { showStackTrace(); } while (0) + static inline void showStackTrace() { void *callstack[128]; int i, frames = backtrace(callstack, 128); @@ -107,7 +109,8 @@ static inline void showStackTrace() { free(strs); } #else -#define ASSERT(success) +#include +#define ASSERT(success) assert(success) #define SHOW_STACK_TRACE #endif