Skip to content

Commit 52093a5

Browse files
committedMay 5, 2017
Fix symbol path for osgeo4w installs
1 parent 3e05bd8 commit 52093a5

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed
 

‎src/app/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,12 @@ int main( int argc, char *argv[] )
470470
#endif
471471

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

‎src/core/qgsstacktrace.cpp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,19 @@ QVector<QgsStackTrace::StackLine> QgsStackTrace::trace( _EXCEPTION_POINTERS *Exc
3737
#endif
3838

3939
HANDLE process = GetCurrentProcess();
40-
// TOOD Pull symbols from symbol server.
4140
SymSetOptions( SYMOPT_DEFERRED_LOADS | SYMOPT_INCLUDE_32BIT_MODULES | SYMOPT_UNDNAME );
42-
SymInitialize( process, NULL, TRUE );
41+
42+
PCSTR paths;
43+
if ( QgsStackTrace::mSymbolPaths.isEmpty() )
44+
{
45+
paths = NULL;
46+
}
47+
else
48+
{
49+
paths = QgsStackTrace::mSymbolPaths.toStdString().c_str();
50+
}
51+
52+
BOOL success = SymInitialize( process, paths, TRUE );
4353

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

126137
}
127-
#endif
138+
139+
QString QgsStackTrace::mSymbolPaths;
140+
141+
void QgsStackTrace::setSymbolPath( QString symbolPaths )
142+
{
143+
mSymbolPaths = symbolPaths;
144+
}
145+
146+
#endif // Q_OS_WIN
128147

129148
#ifdef Q_OS_LINUX
130149
QVector<QgsStackTrace::StackLine> QgsStackTrace::trace( unsigned int maxFrames )

‎src/core/qgsstacktrace.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ class CORE_EXPORT QgsStackTrace
6767
* \note Added in QGIS 3.0
6868
*/
6969
static QVector<QgsStackTrace::StackLine> trace( struct _EXCEPTION_POINTERS *ExceptionInfo );
70+
71+
/**
72+
* Set the paths to load the PDB symbols from on Windows.
73+
* @param paths The path, or series of paths separated by a semicolon (;), that is used to search for symbol files.
74+
*/
75+
static void setSymbolPath( QString searchPath );
7076
#endif
7177

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

8288
private:
8389
QgsStackTrace();
90+
static QString mSymbolPaths;
8491

8592
};
8693

0 commit comments

Comments
 (0)
Please sign in to comment.