Install termination handler to collect additional information for C++ exceptions
This commit is contained in:
parent
853ba22b0d
commit
8e42daada7
@ -88,7 +88,6 @@ class SM:
|
|||||||
self.compiler.AddToListVar('POSTLINKFLAGS', '-m32')
|
self.compiler.AddToListVar('POSTLINKFLAGS', '-m32')
|
||||||
self.compiler.AddToListVar('POSTLINKFLAGS', '-Wl,-z,defs')
|
self.compiler.AddToListVar('POSTLINKFLAGS', '-Wl,-z,defs')
|
||||||
self.compiler.AddToListVar('CXXFLAGS', '-std=c++11')
|
self.compiler.AddToListVar('CXXFLAGS', '-std=c++11')
|
||||||
self.compiler.AddToListVar('CXXFLAGS', '-fno-exceptions')
|
|
||||||
self.compiler.AddToListVar('CXXFLAGS', '-fno-threadsafe-statics')
|
self.compiler.AddToListVar('CXXFLAGS', '-fno-threadsafe-statics')
|
||||||
self.compiler.AddToListVar('CXXFLAGS', '-Wno-non-virtual-dtor')
|
self.compiler.AddToListVar('CXXFLAGS', '-Wno-non-virtual-dtor')
|
||||||
self.compiler.AddToListVar('CXXFLAGS', '-Wno-overloaded-virtual')
|
self.compiler.AddToListVar('CXXFLAGS', '-Wno-overloaded-virtual')
|
||||||
|
@ -146,6 +146,27 @@ PluginInfo plugins[256];
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _LINUX
|
#if defined _LINUX
|
||||||
|
void terminateHandler()
|
||||||
|
{
|
||||||
|
const char *msg = "missing exception";
|
||||||
|
std::exception_ptr pEx = std::current_exception();
|
||||||
|
if (pEx) {
|
||||||
|
try {
|
||||||
|
std::rethrow_exception(pEx);
|
||||||
|
} catch(const std::exception &e) {
|
||||||
|
msg = strdup(e.what());
|
||||||
|
} catch(...) {
|
||||||
|
msg = "unknown exception";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t msgLength = strlen(msg) + 2;
|
||||||
|
volatile char * volatile msgForCrashDumps = (char *)alloca(msgLength);
|
||||||
|
strcpy((char *)msgForCrashDumps + 1, msg);
|
||||||
|
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
void (*SignalHandler)(int, siginfo_t *, void *);
|
void (*SignalHandler)(int, siginfo_t *, void *);
|
||||||
|
|
||||||
const int kExceptionSignals[] = {
|
const int kExceptionSignals[] = {
|
||||||
@ -253,6 +274,8 @@ static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
|
|||||||
|
|
||||||
void OnGameFrame(bool simulating)
|
void OnGameFrame(bool simulating)
|
||||||
{
|
{
|
||||||
|
std::set_terminate(terminateHandler);
|
||||||
|
|
||||||
bool weHaveBeenFuckedOver = false;
|
bool weHaveBeenFuckedOver = false;
|
||||||
struct sigaction oact;
|
struct sigaction oact;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user