mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Update POSIXProcessControl.cpp
This commit is contained in:
parent
2ef93acac6
commit
a3cfc7f008
1 changed files with 10 additions and 15 deletions
|
|
@ -33,6 +33,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <execinfo.h>
|
||||||
#include "console/engineAPI.h"
|
#include "console/engineAPI.h"
|
||||||
#include "core/util/journal/process.h"
|
#include "core/util/journal/process.h"
|
||||||
#ifndef TORQUE_DEDICATED
|
#ifndef TORQUE_DEDICATED
|
||||||
|
|
@ -59,21 +60,15 @@ static void CheckExitCode(S64 exitCode)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
static void SignalHandler(int sigtype)
|
static void SignalHandler(int sigtype)
|
||||||
{
|
{
|
||||||
if (sigtype == SIGSEGV || sigtype == SIGTRAP)
|
void* array[10];
|
||||||
{
|
size_t size;
|
||||||
signal(SIGSEGV, SIG_DFL);
|
|
||||||
signal(SIGTRAP, SIG_DFL);
|
size = backtrace(array, 10);
|
||||||
// restore the signal handling to default so that we don't get into
|
|
||||||
// a crash loop with ImmediateShutdown
|
dPrintf("Error: signal: % d\n", sigtype);
|
||||||
ImmediateShutdown(-sigtype, sigtype);
|
backtrace_symbols_fd(array, size, STDERR_FILENO);
|
||||||
}
|
// exit to be safe
|
||||||
else
|
ImmediateShutdown(1);
|
||||||
{
|
|
||||||
signal(sigtype, SIG_DFL);
|
|
||||||
dPrintf("Unknown signal caught by SignalHandler: %d\n", sigtype);
|
|
||||||
// exit to be safe
|
|
||||||
ImmediateShutdown(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue