mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-19 16:01:35 +00:00
Merge branch 'print-backtrace-ii' into 'next'
Fix compile warning on Windows See merge request STJr/SRB2!1426
This commit is contained in:
commit
ce0190a21f
1 changed files with 7 additions and 2 deletions
|
@ -140,6 +140,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
|||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#include <execinfo.h>
|
||||
#include <time.h>
|
||||
#define UNIXBACKTRACE
|
||||
#endif
|
||||
|
||||
// Locations for searching the srb2.pk3
|
||||
|
@ -243,6 +244,7 @@ SDL_bool framebuffer = SDL_FALSE;
|
|||
|
||||
UINT8 keyboard_started = false;
|
||||
|
||||
#ifdef UNIXBACKTRACE
|
||||
#define STDERR_WRITE(string) if (fd != -1) I_OutputMsg("%s", string)
|
||||
#define CRASHLOG_WRITE(string) if (fd != -1) write(fd, string, strlen(string))
|
||||
#define CRASHLOG_STDERR_WRITE(string) \
|
||||
|
@ -252,7 +254,6 @@ UINT8 keyboard_started = false;
|
|||
|
||||
static void write_backtrace(INT32 signal)
|
||||
{
|
||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
int fd = -1;
|
||||
size_t size;
|
||||
time_t rawtime;
|
||||
|
@ -302,11 +303,11 @@ static void write_backtrace(INT32 signal)
|
|||
CRASHLOG_WRITE("\n"); // Write another newline to the log so it looks nice :)
|
||||
|
||||
close(fd);
|
||||
#endif
|
||||
}
|
||||
#undef STDERR_WRITE
|
||||
#undef CRASHLOG_WRITE
|
||||
#undef CRASHLOG_STDERR_WRITE
|
||||
#endif // UNIXBACKTRACE
|
||||
|
||||
static void I_ReportSignal(int num, int coredumped)
|
||||
{
|
||||
|
@ -367,7 +368,9 @@ FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
|
|||
{
|
||||
D_QuitNetGame(); // Fix server freezes
|
||||
CL_AbortDownloadResume();
|
||||
#ifdef UNIXBACKTRACE
|
||||
write_backtrace(num);
|
||||
#endif
|
||||
I_ReportSignal(num, 0);
|
||||
I_ShutdownSystem();
|
||||
signal(num, SIG_DFL); //default signal action
|
||||
|
@ -761,7 +764,9 @@ static void I_RegisterSignals (void)
|
|||
#ifdef NEWSIGNALHANDLER
|
||||
static void signal_handler_child(INT32 num)
|
||||
{
|
||||
#ifdef UNIXBACKTRACE
|
||||
write_backtrace(num);
|
||||
#endif
|
||||
|
||||
signal(num, SIG_DFL); //default signal action
|
||||
raise(num);
|
||||
|
|
Loading…
Reference in a new issue