Skip to content
Permalink
Browse files

catch system signals and stack trace on linux

  • Loading branch information
jef-n committed May 3, 2013
1 parent e0907b0 commit adb4021ff0fa22d966ca3f7665e16a2208881be5
Showing with 18 additions and 0 deletions.
  1. +18 −0 src/app/main.cpp
@@ -81,6 +81,7 @@ typedef SInt32 SRefCon;
#if defined(linux) && !defined(ANDROID)
#include <unistd.h>
#include <execinfo.h>
#include <signal.h>
#endif

// (if Windows/Mac, use icon from resource)
@@ -193,6 +194,13 @@ LONG WINAPI qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo )
}
#endif

#ifdef Q_OS_UNIX
void qgisCrash( int signal )
{
qFatal( "QGIS died on signal %d", signal );
}
#endif

/*
* Hook into the qWarning/qFatal mechanism so that we can channel messages
* from libpng to the user.
@@ -270,6 +278,16 @@ int main( int argc, char *argv[] )
#if !defined(ANDROID) && !defined(_MSC_VER)
// Set up the custom qWarning/qDebug custom handler
qInstallMsgHandler( myMessageOutput );

signal( SIGQUIT, qgisCrash );
signal( SIGILL, qgisCrash );
signal( SIGFPE, qgisCrash );
signal( SIGSEGV, qgisCrash );
signal( SIGBUS, qgisCrash );
signal( SIGSYS, qgisCrash );
signal( SIGTRAP, qgisCrash );
signal( SIGXCPU, qgisCrash );
signal( SIGXFSZ, qgisCrash );
#endif

#ifdef Q_OS_WIN

0 comments on commit adb4021

Please sign in to comment.
You can’t perform that action at this time.