void Panic_BreakOnPanic(void) { #ifdef _WIN32 if (Panic_GetBreakOnPanic()) { Warning("Panic: breaking into debugger\n"); DebugBreak(); } #else /* XXX: Linux experts: is there any equivalent of attaching a JIT debugger? */ #endif }
void Panic_BreakOnPanic(void) { #if defined(_WIN32) if (Panic_GetBreakOnPanic()) { Warning("Panic: breaking into debugger\n"); DebugBreak(); } #else // Posix switch (panicState.breakOnPanic) { case PanicBreakLevel_Never: break; case PanicBreakLevel_IfDebuggerAttached: { void (*handler)(int); handler = signal(SIGTRAP, SIG_IGN); /* * INT3 is not always ignored, so explicitely use kill() here. */ kill(getpid(), SIGTRAP); signal(SIGTRAP, handler); } break; default: case PanicBreakLevel_Always: Warning("Panic: breaking into debugger\n"); # if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) __asm__ __volatile__ ("int3"); # else kill(getpid(), SIGTRAP); # endif break; } #endif }