Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14faf7a4 authored by Satoshi Kataoka's avatar Satoshi Kataoka Committed by Android (Google) Code Review
Browse files

Merge "Fix backtrace tool" into jb-mr1-dev

parents 60af4f03 1c8fc83d
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -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