mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-16 09:02:06 +00:00
Merge branch 'signal-handler-fix' into 'next'
Fix crash handler showing garbage string for signal title See merge request STJr/SRB2!2102
This commit is contained in:
commit
f130e9fabd
1 changed files with 20 additions and 22 deletions
|
@ -325,8 +325,10 @@ static void write_backtrace(INT32 signal)
|
|||
static void I_ReportSignal(int num, int coredumped)
|
||||
{
|
||||
//static char msg[] = "oh no! back to reality!\r\n";
|
||||
const char *sigmsg, *sigttl;
|
||||
const char *sigmsg, *signame;
|
||||
char ttl[128];
|
||||
char sigttl[512] = "Process killed by signal: ";
|
||||
const char *reportmsg = "\n\nTo help us figure out the cause, you can visit our official Discord server\nwhere you will find more instructions on how to submit a crash report.\n\nSorry for the inconvenience!";
|
||||
|
||||
switch (num)
|
||||
{
|
||||
|
@ -335,16 +337,16 @@ static void I_ReportSignal(int num, int coredumped)
|
|||
// sigmsg = "SRB2 was interrupted prematurely by the user.";
|
||||
// break;
|
||||
case SIGILL:
|
||||
sigmsg = "SRB2 has attempted to execute an illegal instruction and needs to close. %s";
|
||||
sigttl = "SIGILL"; // illegal instruction - invalid function image
|
||||
sigmsg = "SRB2 has attempted to execute an illegal instruction and needs to close.";
|
||||
signame = "SIGILL"; // illegal instruction - invalid function image
|
||||
break;
|
||||
case SIGFPE:
|
||||
sigmsg = "SRB2 has encountered a mathematical exception and needs to close. %s";
|
||||
sigttl = "SIGFPE"; // mathematical exception
|
||||
sigmsg = "SRB2 has encountered a mathematical exception and needs to close.";
|
||||
signame = "SIGFPE"; // mathematical exception
|
||||
break;
|
||||
case SIGSEGV:
|
||||
sigmsg = "SRB2 has attempted to access a memory location that it shouldn't and needs to close. %s";
|
||||
sigttl = "SIGSEGV"; // segment violation
|
||||
sigmsg = "SRB2 has attempted to access a memory location that it shouldn't and needs to close.";
|
||||
signame = "SIGSEGV"; // segment violation
|
||||
break;
|
||||
// case SIGTERM:
|
||||
// sigmsg = "SRB2 was terminated by a kill signal.";
|
||||
|
@ -355,34 +357,31 @@ static void I_ReportSignal(int num, int coredumped)
|
|||
// sigttl = "SIGBREAK" // Ctrl-Break sequence
|
||||
// break;
|
||||
case SIGABRT:
|
||||
sigmsg = "SRB2 was terminated by an abort signal. %s";
|
||||
sigttl = "SIGABRT"; // abnormal termination triggered by abort call
|
||||
sigmsg = "SRB2 was terminated by an abort signal.";
|
||||
signame = "SIGABRT"; // abnormal termination triggered by abort call
|
||||
break;
|
||||
default:
|
||||
sigmsg = "SRB2 was terminated by an unknown signal. %s";
|
||||
sigmsg = "SRB2 was terminated by an unknown signal.";
|
||||
|
||||
sprintf(ttl, "number %d", num);
|
||||
if (coredumped)
|
||||
sigttl = 0;
|
||||
signame = 0;
|
||||
else
|
||||
sigttl = ttl;
|
||||
signame = ttl;
|
||||
}
|
||||
|
||||
if (coredumped)
|
||||
{
|
||||
if (sigttl)
|
||||
sprintf(ttl, "%s (core dumped)", sigttl);
|
||||
if (signame)
|
||||
sprintf(ttl, "%s (core dumped)", signame);
|
||||
else
|
||||
strcat(ttl, " (core dumped)");
|
||||
|
||||
sigttl = ttl;
|
||||
signame = ttl;
|
||||
}
|
||||
|
||||
sprintf(ttl, "Process killed by signal: %s", sigttl);
|
||||
|
||||
sigttl = ttl;
|
||||
|
||||
I_OutputMsg("\n%s\n\n", sigttl);
|
||||
strcat(sigttl, signame);
|
||||
I_OutputMsg("%s\n", sigttl);
|
||||
|
||||
if (M_CheckParm("-dedicated"))
|
||||
return;
|
||||
|
@ -396,8 +395,7 @@ static void I_ReportSignal(int num, int coredumped)
|
|||
SDL_MESSAGEBOX_ERROR, /* .flags */
|
||||
NULL, /* .window */
|
||||
sigttl, /* .title */
|
||||
va(sigmsg,
|
||||
"\n\nTo help us figure out the cause, you can visit our official Discord server\nwhere you will find more instructions on how to submit a crash report.\n\nSorry for the inconvenience!"), /* .message */
|
||||
va("%s %s", sigmsg, reportmsg), /* .message */
|
||||
SDL_arraysize(buttons), /* .numbuttons */
|
||||
buttons, /* .buttons */
|
||||
NULL /* .colorScheme */
|
||||
|
|
Loading…
Reference in a new issue