summaryrefslogtreecommitdiff
path: root/src/debug.h
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-02-01 03:08:04 -0500
committerkwolekr <kwolekr@minetest.net>2015-02-02 01:39:17 -0500
commit43f102271dd3dc64b167ee305be5061976bd41d6 (patch)
tree25dc53b4aec9704ebff7ed0c0b4b3f3d0db2e87c /src/debug.h
parent48fa893abdaa7d7f29f7e909b326146b2f0606b9 (diff)
downloadminetest-43f102271dd3dc64b167ee305be5061976bd41d6.tar.gz
minetest-43f102271dd3dc64b167ee305be5061976bd41d6.tar.bz2
minetest-43f102271dd3dc64b167ee305be5061976bd41d6.zip
Create minidump on fatal Win32 exceptions
Remove software exception translator function, simplifying exception handler macros. FatalSystemExceptions are left unhandled.
Diffstat (limited to 'src/debug.h')
-rw-r--r--src/debug.h44
1 files changed, 12 insertions, 32 deletions
diff --git a/src/debug.h b/src/debug.h
index ba2e8704e..1027fde69 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -95,6 +95,8 @@ __NORETURN extern void assert_fail(
#define assert(expr) ASSERT(expr)
+void debug_set_exception_handler();
+
/*
DebugStack
*/
@@ -118,13 +120,12 @@ private:
bool m_overflowed;
};
-#define DSTACK(msg)\
+#define DSTACK(msg) \
DebugStacker __debug_stacker(msg);
-#define DSTACKF(...)\
- char __buf[DEBUG_STACK_TEXT_SIZE];\
- snprintf(__buf,\
- DEBUG_STACK_TEXT_SIZE, __VA_ARGS__);\
+#define DSTACKF(...) \
+ char __buf[DEBUG_STACK_TEXT_SIZE]; \
+ snprintf(__buf, DEBUG_STACK_TEXT_SIZE, __VA_ARGS__); \
DebugStacker __debug_stacker(__buf);
/*
@@ -132,34 +133,13 @@ private:
*/
#if CATCH_UNHANDLED_EXCEPTIONS == 1
- #define BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER try{
- #define END_PORTABLE_DEBUG_EXCEPTION_HANDLER(logstream)\
- }catch(std::exception &e){\
- logstream<<"ERROR: An unhandled exception occurred: "\
- <<e.what()<<std::endl;\
- assert(0);\
+ #define BEGIN_DEBUG_EXCEPTION_HANDLER try {
+ #define END_DEBUG_EXCEPTION_HANDLER(logstream) \
+ } catch (std::exception &e) { \
+ logstream << "ERROR: An unhandled exception occurred: " \
+ << e.what() << std::endl; \
+ assert(0); \
}
- #ifdef _WIN32 // Windows
- #ifdef _MSC_VER // MSVC
-void se_trans_func(unsigned int, EXCEPTION_POINTERS*);
- #define BEGIN_DEBUG_EXCEPTION_HANDLER \
- BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER\
- _set_se_translator(se_trans_func);
-
- #define END_DEBUG_EXCEPTION_HANDLER(logstream) \
- END_PORTABLE_DEBUG_EXCEPTION_HANDLER(logstream)
- #else // Probably mingw
- #define BEGIN_DEBUG_EXCEPTION_HANDLER\
- BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER
- #define END_DEBUG_EXCEPTION_HANDLER(logstream)\
- END_PORTABLE_DEBUG_EXCEPTION_HANDLER(logstream)
- #endif
- #else // Posix
- #define BEGIN_DEBUG_EXCEPTION_HANDLER\
- BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER
- #define END_DEBUG_EXCEPTION_HANDLER(logstream)\
- END_PORTABLE_DEBUG_EXCEPTION_HANDLER(logstream)
- #endif
#else
// Dummy ones
#define BEGIN_DEBUG_EXCEPTION_HANDLER