From 7fae3e6739a341f13298702fcb37ef2de9b8df17 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 7 Jun 2017 14:22:52 +0200 Subject: [PATCH] Added ability to print backtraces in defines.h --- lib/defines.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/defines.h b/lib/defines.h index e9d5c40e..bc393c91 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -37,12 +37,30 @@ static const char * DBG_LVL_LIST[] = {"NONE", "FAIL", "ERROR", "WARN", "INFO", " #endif #endif +#include +static inline void show_stackframe() { + void *trace[16]; + char **messages = 0; + int i, trace_size = 0; + trace_size = backtrace(trace, 16); + messages = backtrace_symbols(trace, trace_size); + for (i=1; i