aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src
diff options
context:
space:
mode:
authorSatoshi Kataoka <satok@google.com>2012-09-06 21:31:54 +0900
committerSatoshi Kataoka <satok@google.com>2012-09-10 12:54:42 +0900
commit1c8fc83dceb63bacbf236d017512015cfeb2c0a6 (patch)
tree5efc44730da5927e59ae02ed0032548e7fecc36f /native/jni/src
parenteae7b293e4a854819aa0de663066cd0b6cdd52e7 (diff)
downloadlatinime-1c8fc83dceb63bacbf236d017512015cfeb2c0a6.tar.gz
latinime-1c8fc83dceb63bacbf236d017512015cfeb2c0a6.tar.xz
latinime-1c8fc83dceb63bacbf236d017512015cfeb2c0a6.zip
Fix backtrace tool
Change-Id: Icc0e8ad94331e62a569183fa05ada335dcc5e26a
Diffstat (limited to 'native/jni/src')
-rw-r--r--native/jni/src/defines.h11
1 files 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 <cassert>
#include <execinfo.h>
#include <stdlib.h>
+
+#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 <cassert>
+#define ASSERT(success) assert(success)
#define SHOW_STACK_TRACE
#endif