[DEV] add display backtrace in API
This commit is contained in:
parent
b60324928a
commit
3cf514f7c7
@ -21,7 +21,7 @@
|
|||||||
#include <cxxabi.h>
|
#include <cxxabi.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#define MAX_DEPTH (256)
|
#define MAX_DEPTH (256)
|
||||||
static void displayBacktrace(bool _breakAtEnd) {
|
void etk::log::displayBacktrace(bool _breakAtEnd) {
|
||||||
// retrieve call-stack
|
// retrieve call-stack
|
||||||
void * trace[MAX_DEPTH];
|
void * trace[MAX_DEPTH];
|
||||||
int stack_depth = backtrace(trace, MAX_DEPTH);
|
int stack_depth = backtrace(trace, MAX_DEPTH);
|
||||||
@ -49,7 +49,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static void displayBacktrace(bool _breakAtEnd) {
|
void etk::log::displayBacktrace(bool _breakAtEnd) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
assert(false);
|
assert(false);
|
||||||
#endif
|
#endif
|
||||||
|
@ -95,6 +95,11 @@ namespace etk {
|
|||||||
void logChar1(int32_t _id, int32_t _level, const char* _log);
|
void logChar1(int32_t _id, int32_t _level, const char* _log);
|
||||||
//! @previous
|
//! @previous
|
||||||
void logStream1(int32_t _id, int32_t _level, const std::ostream& _log);
|
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__
|
#ifdef __class__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user