Skip to content

Commit

Permalink
When a python stack trace is present, show that before the C++ one
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 7, 2021
1 parent e811a47 commit 82d58fb
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions src/crashhandler/qgscrashreport.cpp
Expand Up @@ -44,28 +44,6 @@ const QString QgsCrashReport::toHtml() const

if ( flags().testFlag( QgsCrashReport::Stack ) )
{
reportData.append( QStringLiteral( "<br>" ) );
reportData.append( QStringLiteral( "<b>Stack Trace</b>" ) );
if ( !mStackTrace || mStackTrace->lines.isEmpty() )
{
reportData.append( QStringLiteral( "Stack trace could not be generated." ) );
}
else if ( !mStackTrace->symbolsLoaded )
{
reportData.append( QStringLiteral( "Stack trace could not be generated due to missing symbols." ) );
}
else
{
reportData.append( QStringLiteral( "<pre>" ) );
for ( const QgsStackTrace::StackLine &line : mStackTrace->lines )
{
QFileInfo fileInfo( line.fileName );
QString filename( fileInfo.fileName() );
reportData.append( QStringLiteral( "%2 %3:%4" ).arg( line.symbolName, filename, line.lineNumber ) );
}
reportData.append( QStringLiteral( "</pre>" ) );
}

QStringList pythonStack;
if ( !mPythonCrashLogFilePath.isEmpty() )
{
Expand Down Expand Up @@ -121,6 +99,27 @@ const QString QgsCrashReport::toHtml() const
pythonStackString.append( QStringLiteral( "</pre>" ) );
reportData.append( pythonStackString );
}

reportData.append( QStringLiteral( "<b>Stack Trace</b>" ) );
if ( !mStackTrace || mStackTrace->lines.isEmpty() )
{
reportData.append( QStringLiteral( "No stack trace is available." ) );
}
else if ( !mStackTrace->symbolsLoaded )
{
reportData.append( QStringLiteral( "Stack trace could not be generated due to missing symbols." ) );
}
else
{
reportData.append( QStringLiteral( "<pre>" ) );
for ( const QgsStackTrace::StackLine &line : mStackTrace->lines )
{
QFileInfo fileInfo( line.fileName );
QString filename( fileInfo.fileName() );
reportData.append( QStringLiteral( "%2 %3:%4" ).arg( line.symbolName, filename, line.lineNumber ) );
}
reportData.append( QStringLiteral( "</pre>" ) );
}
}

#if 0
Expand Down

0 comments on commit 82d58fb

Please sign in to comment.