Skip to content

Commit

Permalink
crash report dialog:
Browse files Browse the repository at this point in the history
* get current context without an exception (eg. Ctrl+\)
* use <pre> around stack
* make report details expandable
* what about threads?
  • Loading branch information
jef-n committed Jul 20, 2017
1 parent 6624561 commit 67f7b3a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/app/qgscrashdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ QString QgsCrashDialog::htmlToMarkdown( const QString &html )
markdown.replace( "<br>", "\n" );
markdown.replace( "<b>", "*" );
markdown.replace( "</b>", "*" );
markdown.replace( "QGIS code revision: ", "QGIS code revision: commit:");
return markdown;
}

4 changes: 4 additions & 0 deletions src/app/qgscrashreport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,18 @@ const QString QgsCrashReport::toHtml() const
}
else
{
reportData.append( "<pre>" );
Q_FOREACH ( const QgsStackTrace::StackLine &line, mStackTrace )
{
QFileInfo fileInfo( line.fileName );
QString filename( fileInfo.fileName() );
reportData.append( QString( "(%1) %2 %3:%4" ).arg( line.moduleName, line.symbolName, filename, line.lineNumber ) );
}
reportData.append( "</pre>" );
}
}

#if 0
if ( flags().testFlag( QgsCrashReport::Plugins ) )
{
reportData.append( "<br>" );
Expand All @@ -70,6 +73,7 @@ const QString QgsCrashReport::toHtml() const
reportData.append( "<b>Project Info</b>" );
// TODO Get project details
}
#endif

if ( flags().testFlag( QgsCrashReport::QgisInfo ) )
{
Expand Down
8 changes: 6 additions & 2 deletions src/core/qgsstacktrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ QVector<QgsStackTrace::StackLine> QgsStackTrace::trace( _EXCEPTION_POINTERS *Exc

// StackWalk64() may modify context record passed to it, so we will
// use a copy.
CONTEXT context_record = *ExceptionInfo->ContextRecord;
CONTEXT context_record;
if (ExceptionInfo)
context_record = *ExceptionInfo->ContextRecord;
else
RtlCaptureContext(&context_record);

// Initialize stack walking.
STACKFRAME64 stack_frame;
memset( &stack_frame, 0, sizeof( stack_frame ) );
Expand Down Expand Up @@ -133,7 +138,6 @@ QVector<QgsStackTrace::StackLine> QgsStackTrace::trace( _EXCEPTION_POINTERS *Exc
qgsFree( module );
SymCleanup( process );
return stack;

}

QString QgsStackTrace::mSymbolPaths;
Expand Down
4 changes: 2 additions & 2 deletions src/ui/qgscrashdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -536,14 +536,14 @@
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<item row="3" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<width>0</width>
<height>0</height>
</size>
</property>
Expand Down

0 comments on commit 67f7b3a

Please sign in to comment.