12 #define FUNCTION_NAME __FUNCTION__
14 #define FUNCTION_NAME __PRETTY_FUNCTION__
21 #define CATCH_UNHANDLED_EXCEPTIONS 1
23 #define CATCH_UNHANDLED_EXCEPTIONS 0
29 const char *msg,
const char *file,
30 unsigned int line,
const char *function);
32#define FATAL_ERROR(msg) \
33 fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME)
35#define FATAL_ERROR_IF(expr, msg) \
37 ? fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME) \
47 const char *assertion,
const char *file,
48 unsigned int line,
const char *function);
50#define SANITY_CHECK(expr) \
53 : sanity_check_fn(#expr, __FILE__, __LINE__, FUNCTION_NAME))
55#define sanity_check(expr) SANITY_CHECK(expr)
65#if CATCH_UNHANDLED_EXCEPTIONS == 1
66 #define BEGIN_DEBUG_EXCEPTION_HANDLER try {
67 #define END_DEBUG_EXCEPTION_HANDLER \
68 } catch (std::exception &e) { \
69 std::string e_descr = debug_describe_exc(e); \
70 errorstream << "An unhandled exception occurred: " \
71 << e_descr << std::endl; \
72 FATAL_ERROR(e_descr.c_str()); \
76 #define BEGIN_DEBUG_EXCEPTION_HANDLER
77 #define END_DEBUG_EXCEPTION_HANDLER
std::string debug_describe_exc(const std::exception &e)
Definition debug.cpp:64
void debug_set_exception_handler()
Definition debug.cpp:185
void sanity_check_fn(const char *assertion, const char *file, unsigned int line, const char *function)
Definition debug.cpp:34
void fatal_error_fn(const char *msg, const char *file, unsigned int line, const char *function)
Definition debug.cpp:49