Skip to content
Permalink
Browse files
Fix symbol path for osgeo4w installs
  • Loading branch information
NathanW2 committed May 5, 2017
1 parent 3e05bd8 commit 52093a58c6c93d105cca0ff9a6d9c7029c6cf175
Showing with 35 additions and 3 deletions.
  1. +6 −0 src/app/main.cpp
  2. +22 −3 src/core/qgsstacktrace.cpp
  3. +7 −0 src/core/qgsstacktrace.h
@@ -470,6 +470,12 @@ int main( int argc, char *argv[] )
#endif

#ifdef Q_OS_WIN
if ( !QgsApplication::isRunningFromBuildDir() )
{
QString symbolPath( getenv( "QGIS_PREFIX_PATH" ) );
symbolPath = symbolPath + "\\pdb;http://msdl.microsoft.com/download/symbols;http://download.osgeo.org/osgeo4w/symstore ";
QgsStackTrace::setSymbolPath( symbolPath );
}
SetUnhandledExceptionFilter( QgsCrashHandler::handle );
#endif

@@ -37,9 +37,19 @@ QVector<QgsStackTrace::StackLine> QgsStackTrace::trace( _EXCEPTION_POINTERS *Exc
#endif

HANDLE process = GetCurrentProcess();
// TOOD Pull symbols from symbol server.
SymSetOptions( SYMOPT_DEFERRED_LOADS | SYMOPT_INCLUDE_32BIT_MODULES | SYMOPT_UNDNAME );
SymInitialize( process, NULL, TRUE );

PCSTR paths;
if ( QgsStackTrace::mSymbolPaths.isEmpty() )
{
paths = NULL;
}
else
{
paths = QgsStackTrace::mSymbolPaths.toStdString().c_str();
}

BOOL success = SymInitialize( process, paths, TRUE );

// StackWalk64() may modify context record passed to it, so we will
// use a copy.
@@ -121,10 +131,19 @@ QVector<QgsStackTrace::StackLine> QgsStackTrace::trace( _EXCEPTION_POINTERS *Exc
qgsFree( symbol );
qgsFree( line );
qgsFree( module );
SymCleanup( process );
return stack;

}
#endif

QString QgsStackTrace::mSymbolPaths;

void QgsStackTrace::setSymbolPath( QString symbolPaths )
{
mSymbolPaths = symbolPaths;
}

#endif // Q_OS_WIN

#ifdef Q_OS_LINUX
QVector<QgsStackTrace::StackLine> QgsStackTrace::trace( unsigned int maxFrames )
@@ -67,6 +67,12 @@ class CORE_EXPORT QgsStackTrace
* \note Added in QGIS 3.0
*/
static QVector<QgsStackTrace::StackLine> trace( struct _EXCEPTION_POINTERS *ExceptionInfo );

/**
* Set the paths to load the PDB symbols from on Windows.
* @param paths The path, or series of paths separated by a semicolon (;), that is used to search for symbol files.
*/
static void setSymbolPath( QString searchPath );
#endif

#ifdef Q_OS_LINUX
@@ -81,6 +87,7 @@ class CORE_EXPORT QgsStackTrace

private:
QgsStackTrace();
static QString mSymbolPaths;

};

0 comments on commit 52093a5

Please sign in to comment.