Commit a939cb1e authored by neverlord's avatar neverlord

added stack trace to CPPA_REQUIRE

parent b8aebbc0
......@@ -69,8 +69,16 @@
#ifdef CPPA_DEBUG
#include <cstdio>
#include <cstdlib>
#include <execinfo.h>
#define CPPA_REQUIRE__(stmt, file, line) \
printf("%s:%u: requirement failed '%s'\n", file, line, stmt); abort()
printf("%s:%u: requirement failed '%s'\n", file, line, stmt); \
{ \
void *array[10]; \
size_t size = backtrace(array, 10); \
backtrace_symbols_fd(array, size, 2); \
} \
abort()
#define CPPA_REQUIRE(stmt) \
if ((stmt) == false) { \
CPPA_REQUIRE__(#stmt, __FILE__, __LINE__); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment