Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dschmidt/libcrashreporter-qt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeo Mrnjavac <teo@kde.org>2016-03-22 16:50:58 +0300
committerTeo Mrnjavac <teo@kde.org>2016-03-22 16:50:58 +0300
commit2ad2330c0934fcbc65de1a9005b5c707daff8877 (patch)
tree9a1697724f61b78540d33b1e7b4b301a42272a40
parentb5917ba8e1c5c9500e188fc28730ee4313b65108 (diff)
Handle BacktraceGenerator from CrashReporter.
-rw-r--r--src/libcrashreporter-gui/CrashReporter.cpp68
-rw-r--r--src/libcrashreporter-gui/CrashReporter.h7
2 files changed, 75 insertions, 0 deletions
diff --git a/src/libcrashreporter-gui/CrashReporter.cpp b/src/libcrashreporter-gui/CrashReporter.cpp
index fec76a1..bc344bf 100644
--- a/src/libcrashreporter-gui/CrashReporter.cpp
+++ b/src/libcrashreporter-gui/CrashReporter.cpp
@@ -1,6 +1,7 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
+ * Copyright 2016, Teo Mrnjavac <teo@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,11 +19,18 @@
#include "CrashReporter.h"
+#ifdef Q_OS_LINUX
+#include "linux-backtrace-generator/backtracegenerator.h"
+#include "linux-backtrace-generator/crashedapplication.h"
+#include "CrashReporterGzip.h"
+#endif
+
#include <QIcon>
#include <QDebug>
#include <QTimer>
#include <QDir>
#include <QDateTime>
+#include <QStandardPaths>
// #include "utils/TomahawkUtils.h"
@@ -72,6 +80,66 @@ CrashReporter::CrashReporter( const QUrl& url, const QStringList& args )
adjustSize();
setFixedSize( size() );
+
+#ifdef Q_OS_LINUX
+ if ( args.count() == 8 )
+ {
+ qDebug() << "These are all our args:" << args.join( ", " );
+ const CrashedApplication* app =
+ new CrashedApplication( args.value( 2 ).toInt(),
+ args.value( 3 ).toInt(),
+ args.value( 4 ),
+ QFileInfo( args.value( 5 ) ),
+ QFileInfo( args.value( 5 ) ).baseName(),
+ args.value( 6 ),
+ args.value( 7 ).toInt(),
+ QDateTime::currentDateTime() );
+
+ m_btg = new BacktraceGenerator(
+ Debugger::availableInternalDebuggers( "KCrash" ).first(),
+ app,
+ this );
+ connect( m_btg, &BacktraceGenerator::failedToStart,
+ this, []
+ {
+ qDebug() << "Error: GDB failed to start.";
+ } );
+ connect( m_btg, &BacktraceGenerator::someError,
+ this, []
+ {
+ qDebug() << "Error: GDB backtrace processing failed.";
+ } );
+ connect( m_btg, &BacktraceGenerator::done,
+ this, [ = ]
+ {
+ qDebug() << "Backtrace generation done.";
+ Q_ASSERT( m_btg->state() == BacktraceGenerator::Loaded );
+
+ QString btPath = QString( "%1%2calamares-gdb-%3.txt" )
+ .arg( QStandardPaths::writableLocation( QStandardPaths::TempLocation ) )
+ .arg( QDir::separator() )
+ .arg( QDateTime::currentMSecsSinceEpoch() );
+ QFile btFile( btPath );
+ if ( btFile.open( QFile::WriteOnly | QFile::Text ) )
+ {
+ QTextStream out( &btFile );
+ out << m_btg->backtrace();
+ out.flush();
+ qDebug() << "GDB backtrace written to" << btPath;
+
+ setReportData( "upload_file_linux_backtrace",
+ gzip_compress( m_btg->backtrace().toLocal8Bit() ),
+ "application/x-gzip",
+ QFileInfo( btFile ).fileName().toUtf8() );
+ }
+ else
+ qDebug() << "Cannot open file" << btPath << "to save the backtrace.";
+
+ });
+
+ m_btg->start();
+ }
+#endif
}
diff --git a/src/libcrashreporter-gui/CrashReporter.h b/src/libcrashreporter-gui/CrashReporter.h
index 2b39874..7c9db1a 100644
--- a/src/libcrashreporter-gui/CrashReporter.h
+++ b/src/libcrashreporter-gui/CrashReporter.h
@@ -1,6 +1,7 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
+ * Copyright 2016, Teo Mrnjavac <teo@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,6 +31,9 @@ namespace Ui
class CrashReporter;
}
+#ifdef Q_OS_LINUX
+class BacktraceGenerator;
+#endif
class CrashReporter : public QDialog
{
@@ -48,6 +52,9 @@ public:
private:
Ui::CrashReporter* m_ui;
+#ifdef Q_OS_LINUX
+ BacktraceGenerator* m_btg;
+#endif
QString m_minidump_file_path;
QNetworkRequest* m_request;