am 14faf7a4
: Merge "Fix backtrace tool" into jb-mr1-dev
* commit '14faf7a47e7415744d628726c596b63d4228aff0': Fix backtrace tool
This commit is contained in:
commit
3ea851b84d
1 changed files with 7 additions and 4 deletions
|
@ -88,11 +88,13 @@ static inline void dumpWordInt(const int *word, const int length) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __ANDROID__
|
#ifndef __ANDROID__
|
||||||
#define ASSERT(success) do { if (!success) { showStackTrace(); assert(success);};} while (0)
|
#include <cassert>
|
||||||
#define SHOW_STACK_TRACE do { showStackTrace(); } while (0)
|
|
||||||
|
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#include <stdlib.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() {
|
static inline void showStackTrace() {
|
||||||
void *callstack[128];
|
void *callstack[128];
|
||||||
int i, frames = backtrace(callstack, 128);
|
int i, frames = backtrace(callstack, 128);
|
||||||
|
@ -107,7 +109,8 @@ static inline void showStackTrace() {
|
||||||
free(strs);
|
free(strs);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define ASSERT(success)
|
#include <cassert>
|
||||||
|
#define ASSERT(success) assert(success)
|
||||||
#define SHOW_STACK_TRACE
|
#define SHOW_STACK_TRACE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue