Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix gdb backtrace on FreeBSD
  • Loading branch information
melak authored and jef-n committed Sep 9, 2013
1 parent 45582e5 commit d6da4de
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/main.cpp
Expand Up @@ -253,9 +253,15 @@ void qgisCrash( int signal )
{
// take full stacktrace using gdb
// http://stackoverflow.com/questions/3151779/how-its-better-to-invoke-gdb-from-program-to-print-its-stacktrace
// unfortunately, this is not so simple. the proper method is way more OS-specific
// than this code would suggest, see http://stackoverflow.com/a/1024937

char exename[512];
#if defined(__FreeBSD__)
int len = readlink( "/proc/curproc/file", exename, sizeof( exename ) - 1 );
#else
int len = readlink( "/proc/self/exe", exename, sizeof( exename ) - 1 );
#endif
if ( len < 0 )
{
myPrint( "Could not read link (%d:%s)\n", errno, strerror( errno ) );
Expand Down

0 comments on commit d6da4de

Please sign in to comment.