X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fdebug.h;h=5150758be13506d070b9ed8cca5bcd6ed4fd3f1b;hb=8492796a5c45787810aad7fe08fc63cadc0c96b5;hp=1973bb51062432f41d57b1af830eacaf6c177d4d;hpb=eb476f1ce2c559136f8e7d652ebe3084a6ba8dc2;p=oweals%2Fminetest.git diff --git a/src/debug.h b/src/debug.h index 1973bb510..5150758be 100644 --- a/src/debug.h +++ b/src/debug.h @@ -33,7 +33,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include - #include + #ifdef _MSC_VER + #include + #endif #else #endif @@ -83,7 +85,7 @@ public: return c; } - int xsputn(const char *s, int n) + std::streamsize xsputn(const char *s, std::streamsize n) { for(int i=0; i g_debug_stacks; extern JMutex g_debug_stacks_mutex; extern void debug_stacks_init(); +extern void debug_stacks_print_to(std::ostream &os); extern void debug_stacks_print(); class DebugStacker @@ -167,7 +171,10 @@ private: bool m_overflowed; }; -#define DSTACK(...)\ +#define DSTACK(msg)\ + DebugStacker __debug_stacker(msg); + +#define DSTACKF(...)\ char __buf[DEBUG_STACK_TEXT_SIZE];\ snprintf(__buf,\ DEBUG_STACK_TEXT_SIZE, __VA_ARGS__);\ @@ -230,26 +237,14 @@ private: #if CATCH_UNHANDLED_EXCEPTIONS == 1 #define BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER try{ - #define END_PORTABLE_DEBUG_EXCEPTION_HANDLER\ + #define END_PORTABLE_DEBUG_EXCEPTION_HANDLER(logstream)\ }catch(std::exception &e){\ - dstream<