Skip to content
Permalink
Browse files

fix gdb backtrace on FreeBSD

  • Loading branch information
melak authored and jef-n committed Sep 9, 2013
1 parent 45582e5 commit d6da4dee868f68b0b6b2567abbfffafed6845834
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/app/main.cpp
@@ -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 ) );

0 comments on commit d6da4de

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