13 #define FUNCTION_NAME __FUNCTION__
15 #define FUNCTION_NAME __PRETTY_FUNCTION__
22 #define CATCH_UNHANDLED_EXCEPTIONS 1
24 #define CATCH_UNHANDLED_EXCEPTIONS 0
30 const char *msg,
const char *file,
31 unsigned int line,
const char *function);
33#define FATAL_ERROR(msg) \
34 fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME)
36#define FATAL_ERROR_IF(expr, msg) \
38 ? fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME) \
48 const char *assertion,
const char *file,
49 unsigned int line,
const char *function);
51#define SANITY_CHECK(expr) \
54 : sanity_check_fn(#expr, __FILE__, __LINE__, FUNCTION_NAME))
56#define sanity_check(expr) SANITY_CHECK(expr)
66#if CATCH_UNHANDLED_EXCEPTIONS == 1
67 #define BEGIN_DEBUG_EXCEPTION_HANDLER try {
68 #define END_DEBUG_EXCEPTION_HANDLER \
69 } catch (std::exception &e) { \
70 std::string e_descr = debug_describe_exc(e); \
71 errorstream << "An unhandled exception occurred: " \
72 << e_descr << std::endl; \
73 FATAL_ERROR(e_descr.c_str()); \
77 #define BEGIN_DEBUG_EXCEPTION_HANDLER
78 #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