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
Expand Up @@ -66,6 +66,7 @@ QString QgsCrashDialog::htmlToMarkdown( const QString &html )
markdown.replace( "<br>", "\n" ); markdown.replace( "<br>", "\n" );
markdown.replace( "<b>", "*" ); markdown.replace( "<b>", "*" );
markdown.replace( "</b>", "*" ); markdown.replace( "</b>", "*" );
markdown.replace( "QGIS code revision: ", "QGIS code revision: commit:");
return markdown; return markdown;
} }


4 changes: 4 additions & 0 deletions src/app/qgscrashreport.cpp
Expand Up @@ -48,15 +48,18 @@ const QString QgsCrashReport::toHtml() const
} }
else else
{ {
reportData.append( "<pre>" );
Q_FOREACH ( const QgsStackTrace::StackLine &line, mStackTrace ) Q_FOREACH ( const QgsStackTrace::StackLine &line, mStackTrace )
{ {
QFileInfo fileInfo( line.fileName ); QFileInfo fileInfo( line.fileName );
QString filename( fileInfo.fileName() ); QString filename( fileInfo.fileName() );
reportData.append( QString( "(%1) %2 %3:%4" ).arg( line.moduleName, line.symbolName, filename, line.lineNumber ) ); 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 ) ) if ( flags().testFlag( QgsCrashReport::Plugins ) )
{ {
reportData.append( "<br>" ); reportData.append( "<br>" );
Expand All @@ -70,6 +73,7 @@ const QString QgsCrashReport::toHtml() const
reportData.append( "<b>Project Info</b>" ); reportData.append( "<b>Project Info</b>" );
// TODO Get project details // TODO Get project details
} }
#endif


if ( flags().testFlag( QgsCrashReport::QgisInfo ) ) if ( flags().testFlag( QgsCrashReport::QgisInfo ) )
{ {
Expand Down
8 changes: 6 additions & 2 deletions src/core/qgsstacktrace.cpp
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 // StackWalk64() may modify context record passed to it, so we will
// use a copy. // use a copy.
CONTEXT context_record = *ExceptionInfo->ContextRecord; CONTEXT context_record;
if (ExceptionInfo)
context_record = *ExceptionInfo->ContextRecord;
else
RtlCaptureContext(&context_record);

// Initialize stack walking. // Initialize stack walking.
STACKFRAME64 stack_frame; STACKFRAME64 stack_frame;
memset( &stack_frame, 0, sizeof( 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 ); qgsFree( module );
SymCleanup( process ); SymCleanup( process );
return stack; return stack;

} }


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

0 comments on commit 67f7b3a

Please sign in to comment.