X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fdebug.cpp;h=8647160b1bed7c20cae3dae6e035bfc23bef521e;hb=65c09a96f41705bb8e75fc5ff4276342be91ed11;hp=bd970a8e4b953de49265dad7d5f7e99b75a51497;hpb=43f102271dd3dc64b167ee305be5061976bd41d6;p=minetest.git diff --git a/src/debug.cpp b/src/debug.cpp index bd970a8e4..8647160b1 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -26,8 +26,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include -#include "jthread/jmutex.h" -#include "jthread/jmutexautolock.h" +#include +#include "threading/mutex.h" +#include "threading/mutex_auto_lock.h" #include "config.h" #ifdef _MSC_VER @@ -36,115 +37,44 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "filesys.h" #endif +#if USE_CURSES + #include "terminal_chat_console.h" +#endif + /* - Debug output + Assert */ -#define DEBUGSTREAM_COUNT 2 - -FILE *g_debugstreams[DEBUGSTREAM_COUNT] = {stderr, NULL}; - -#define DEBUGPRINT(...)\ -{\ - for(int i=0; i g_debug_stacks; -JMutex g_debug_stacks_mutex; +Mutex g_debug_stacks_mutex; void debug_stacks_init() { @@ -221,7 +160,7 @@ void debug_stacks_init() void debug_stacks_print_to(std::ostream &os) { - JMutexAutoLock lock(g_debug_stacks_mutex); + MutexAutoLock lock(g_debug_stacks_mutex); os<<"Debug stacks:"<::iterator - i = g_debug_stacks.begin(); - i != g_debug_stacks.end(); ++i) - { - DebugStack *stack = i->second; - - for(int i=0; iprint(g_debugstreams[i], true); - } - } + debug_stacks_print_to(errorstream); } DebugStacker::DebugStacker(const char *text) { - threadid_t threadid = get_current_thread_id(); + threadid_t threadid = thr_get_current_thread_id(); - JMutexAutoLock lock(g_debug_stacks_mutex); + MutexAutoLock lock(g_debug_stacks_mutex); std::map::iterator n; n = g_debug_stacks.find(threadid); @@ -291,7 +215,7 @@ DebugStacker::DebugStacker(const char *text) DebugStacker::~DebugStacker() { - JMutexAutoLock lock(g_debug_stacks_mutex); + MutexAutoLock lock(g_debug_stacks_mutex); if(m_overflowed == true) return; @@ -369,9 +293,11 @@ long WINAPI Win32ExceptionHandler(struct _EXCEPTION_POINTERS *pExceptInfo) MINIDUMP_USER_STREAM_INFORMATION mdusi; MINIDUMP_USER_STREAM mdus; bool minidump_created = false; - std::string version_str("Minetest "); - std::string dumpfile = porting::path_user + DIR_DELIM "minetest.dmp"; + std::string dumpfile = porting::path_user + DIR_DELIM PROJECT_NAME ".dmp"; + + std::string version_str(PROJECT_NAME " "); + version_str += g_version_hash; HANDLE hFile = CreateFileA(dumpfile.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); @@ -385,8 +311,6 @@ long WINAPI Win32ExceptionHandler(struct _EXCEPTION_POINTERS *pExceptInfo) mdei.ExceptionPointers = pExceptInfo; mdei.ThreadId = GetCurrentThreadId(); - version_str += minetest_version_hash; - mdus.Type = CommentStreamA; mdus.BufferSize = version_str.size(); mdus.Buffer = (PVOID)version_str.c_str();