static void kaduQtMessageHandler(QtMsgType type, const char *msg) { switch (type) { case QtDebugMsg: fprintf(stderr, "Debug: %s\n", msg); fflush(stderr); break; #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) case QtInfoMsg: fprintf(stderr, "Info: %s\n", msg); fflush(stderr); break; #endif case QtWarningMsg: fprintf(stderr, "\033[34mWarning: %s\033[0m\n", msg); fflush(stderr); if (strstr(msg, "no mimesource for") == 0) printBacktrace("warning from Qt (above)"); break; case QtCriticalMsg: fprintf(stderr, "\033[31;1mCritical: %s\033[0m\n", msg); fflush(stderr); printBacktrace("critical error from Qt (above)"); break; case QtFatalMsg: fprintf(stderr, "\033[31;1mFatal: %s\033[0m\n", msg); fflush(stderr); printBacktrace("fatal error from Qt (above)"); abort(); break; } }
void signalhandler(int sig) { /* printf("\n=======================================================\n"); */ /* printf("\nYamagi Quake II crashed! This should not happen...\n"); */ /* printf("\nMake sure that you're using the last version. It can\n"); */ /* printf("be found at http://www.yamagi.org/quake2. If you do,\n"); */ /* printf("send a bug report to [email protected] and include:\n\n"); */ /* printf(" - This output\n"); */ /* printf(" - The conditions that triggered the crash\n"); */ /* printf(" - How to reproduce the crash (if known)\n"); */ /* printf(" - The following files. None of them contains private\n"); */ /* printf(" data. They're necessary to analyze the backtrace:\n\n"); */ /* printf(" - quake2 (the executable / binary)\n\n"); */ /* printf(" - ref_gl.so (the renderer)\n\n"); */ /* printf(" - game.so (the game.so of the mod you were playing\n"); */ /* printf(" when the game crashed. baseq2/game.so for the\n"); */ /* printf(" main game)\n\n"); */ /* printf(" - Any other data which you think might be usefull\n"); */ /* printf("\nThank you very much for your help, making Yamagi Quake\n"); */ /* printf("II an even better source port. It's much appreciated.\n"); */ /* printf("\n=======================================================\n\n"); */ printBacktrace(sig); /* reset signalhandler */ signal(SIGSEGV, SIG_DFL); signal(SIGILL, SIG_DFL); signal(SIGFPE, SIG_DFL); signal(SIGABRT, SIG_DFL); /* pass signal to the os */ raise(sig); }
void akassert(const char* exprTxt, const char* file, int line, const char* func) { #if ANKI_OS == ANKI_OS_LINUX fprintf(stderr, "\033[1;31m(%s:%d %s) Assertion failed: %s\033[0m\n", file, line, func, exprTxt); #elif ANKI_OS == ANKI_OS_ANDROID __android_log_print(ANDROID_LOG_ERROR, "AnKi", "(%s:%d %s) Assertion failed: %s", file, line, func, exprTxt); #else fprintf(stderr, "(%s:%d %s) Assertion failed: %s\n", file, line, func, exprTxt); #endif printBacktrace(); abort(); }
void* operator new[]( size_t Size) { initHeap(); void* pMem = malloc( Size ); #ifdef PSY_DEBUG // neilogd: stamp 0x69 over uninitialised memory. BcMemSet( pMem, 0x69, Size ); #endif #ifdef MEM_DEBUG BcU32 BreakID = -1; if( gAllocID == BreakID ) { BcBreakpoint; } BcPrintf( "PsyNew: %p - %u\n", pMem, gAllocID++ ); printBacktrace(); #endif return pMem; }
QT_BEGIN_NAMESPACE /*! \internal */ void QtSharedPointer::internalSafetyCheckAdd(const volatile void *ptr) { KnownPointers *const kp = knownPointers(); if (!kp) return; // end-game: the application is being destroyed already QMutexLocker lock(&kp->mutex); void *actual = const_cast<void*>(ptr); if (kp->values.contains(actual)) { printBacktrace(knownPointers()->values.value(actual)); qFatal("QSharedPointerData: internal self-check failed: pointer %p was already tracked " "by another QSharedPointerData object", actual); } kp->values.insert(actual, saveBacktrace()); }
void handleSEGV(int, siginfo_t *, void *) { fprintf(stderr, "Oh boy, a SEGV happened...\n"); printBacktrace(); _exit(1); }
void CDebugHelper::run(lua_State* pState) { char buffer[1024]; char sep[] = " \t\n"; char* next = NULL; char* last = NULL; char* cmd = NULL; m_curFrame = 0; while(true) { printf("(db): "); fgets(buffer, 1024, stdin); if(buffer[0] == '\0') { if(m_lastCmd[0] == '\0') { continue; } else { strcpy(buffer, m_lastCmd); } } else { strcpy(m_lastCmd, buffer); } next = strtok_r(buffer, sep, &last); cmd = next; for(char* p = cmd; *p; ++p) { *p = tolower(*p); } if(strcmp(cmd, "h") == 0 || strcmp(cmd, "help") == 0) { help(); continue; } else if(strcmp(cmd, "c") == 0 || strcmp(cmd, "continue") == 0) { setNoneHook(pState); return; } else if(strcmp(cmd, "bt") == 0) { printBacktrace(pState); continue; } else if(strcmp(cmd, "l") == 0 || strcmp(cmd, "list") == 0) { int beginLine = 0; int endLine = 0; next = strtok_r(NULL, sep, &last); if (next) { beginLine = atoi(next); next = strtok_r(NULL, sep, &last); if (next) { endLine = atoi(next); } } printSource(pState, beginLine, endLine); } else if(strcmp(cmd, "f") == 0 || strcmp(cmd, "frame") == 0) { next = strtok_r(NULL, sep, &last); if(next) { m_curFrame = atoi(next); } printFrame(pState, m_curFrame); continue; } else if(strcmp(cmd, "p") == 0 || strcmp(cmd, "print") == 0) { next = strtok_r(NULL, sep, &last); if (next) { printValue(pState, next); } continue; } else if(strcmp(cmd, "n") == 0 || strcmp(cmd, "next") == 0) { setNextHook(pState); return; } else if(strcmp(cmd, "s") == 0 || strcmp(cmd, "step") == 0) { setStepHook(pState); return; } else if(strcmp(cmd, "return") == 0) { setReturnHook(pState); return; } } }
void Thread::printBacktrace() { printBacktrace(currentThread != this); }