[DEV] add display backtrace in API

This commit is contained in:
Edouard DUPIN 2014-05-22 21:26:50 +02:00
parent b60324928a
commit 3cf514f7c7
2 changed files with 7 additions and 2 deletions

View File

@ -21,7 +21,7 @@
#include <cxxabi.h>
#include <dlfcn.h>
#define MAX_DEPTH (256)
static void displayBacktrace(bool _breakAtEnd) {
void etk::log::displayBacktrace(bool _breakAtEnd) {
// retrieve call-stack
void * trace[MAX_DEPTH];
int stack_depth = backtrace(trace, MAX_DEPTH);
@ -49,7 +49,7 @@
}
}
#else
static void displayBacktrace(bool _breakAtEnd) {
void etk::log::displayBacktrace(bool _breakAtEnd) {
#ifdef DEBUG
assert(false);
#endif

View File

@ -95,6 +95,11 @@ namespace etk {
void logChar1(int32_t _id, int32_t _level, const char* _log);
//! @previous
void logStream1(int32_t _id, int32_t _level, const std::ostream& _log);
/**
* @brief Display the current backtrace
* @param[in] _breakAtEnd assert program when backtrace is printed
*/
void displayBacktrace(bool _breakAtEnd = false);
};
};
#ifdef __class__