X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fdebug.cpp;h=8647160b1bed7c20cae3dae6e035bfc23bef521e;hb=c4b98deb616fbe204c503d678fb920baa33cbede;hp=82aa6d5193024c542d0668cb134cfbb4dc4dc142;hpb=2139d7d45fb1a8ed250ad96c9975c581f02f72a9;p=minetest.git diff --git a/src/debug.cpp b/src/debug.cpp index 82aa6d519..8647160b1 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -37,6 +37,10 @@ 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 + /* Assert */ @@ -44,8 +48,12 @@ with this program; if not, write to the Free Software Foundation, Inc., void sanity_check_fn(const char *assertion, const char *file, unsigned int line, const char *function) { +#if USE_CURSES + g_term_console.stopAndWaitforThread(); +#endif + errorstream << std::endl << "In thread " << std::hex - << (unsigned long)get_current_thread_id() << ":" << std::endl; + << thr_get_current_thread_id() << ":" << std::endl; errorstream << file << ":" << line << ": " << function << ": An engine assumption '" << assertion << "' failed." << std::endl; @@ -57,8 +65,12 @@ void sanity_check_fn(const char *assertion, const char *file, void fatal_error_fn(const char *msg, const char *file, unsigned int line, const char *function) { +#if USE_CURSES + g_term_console.stopAndWaitforThread(); +#endif + errorstream << std::endl << "In thread " << std::hex - << (unsigned long)get_current_thread_id() << ":" << std::endl; + << thr_get_current_thread_id() << ":" << std::endl; errorstream << file << ":" << line << ": " << function << ": A fatal error occured: " << msg << std::endl; @@ -93,8 +105,10 @@ DebugStack::DebugStack(threadid_t id) void DebugStack::print(FILE *file, bool everything) { - fprintf(file, "DEBUG STACK FOR THREAD %lx:\n", - (unsigned long)threadid); + std::ostringstream os; + os << threadid; + fprintf(file, "DEBUG STACK FOR THREAD %s:\n", + os.str().c_str()); for(int i=0; i g_debug_stacks; Mutex g_debug_stacks_mutex; @@ -158,7 +179,7 @@ void debug_stacks_print() DebugStacker::DebugStacker(const char *text) { - threadid_t threadid = get_current_thread_id(); + threadid_t threadid = thr_get_current_thread_id(); MutexAutoLock lock(g_debug_stacks_mutex);