Skip to content

Commit

Permalink
debugging improvements:
Browse files Browse the repository at this point in the history
- use versioned class variables in QgsApplication (multiple version of qgis_core don't conflict)
- QgsLogger: log message to file before writing before invoking the message handler
- on linux: produce backtrace on fatal errors
  • Loading branch information
jef-n committed Jan 4, 2012
1 parent 26778bf commit 9e21b17
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 107 deletions.
13 changes: 12 additions & 1 deletion src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ typedef SInt32 SRefCon;
#include "qgsrectangle.h"
#include "qgslogger.h"

#if defined(linux)
#include <execinfo.h>
#endif

// (if Windows/Mac, use icon from resource)
#if ! defined(Q_WS_WIN) && ! defined(Q_WS_MAC)
#include "../../images/themes/default/qgis.xpm" // Linux
Expand Down Expand Up @@ -182,8 +186,15 @@ void myMessageOutput( QtMsgType type, const char *msg )

break;
case QtFatalMsg:
fprintf( stderr, "Fatal: %s\n", msg );
{
fprintf( stderr, "Fatal: %s\nStacktrace (run through c++filt):\n", msg );
#ifdef linux
void *buffer[256];
int nptrs = backtrace( buffer, sizeof( buffer ) / sizeof( *buffer ) );
backtrace_symbols_fd( buffer, nptrs, STDERR_FILENO );
#endif
abort(); // deliberately core dump
}
}
}

Expand Down
Loading

0 comments on commit 9e21b17

Please sign in to comment.