crashhandler: updated for linux
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include "crashhandler.h"
|
#include "crashhandler.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
@@ -7,15 +8,17 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#if defined(Q_OS_WINDOWS)
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <DbgHelp.h>
|
#include <DbgHelp.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#elif defined(Q_OS_LINUX)
|
||||||
|
#include <execinfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void crash_handler(int sig) {
|
void crash_handler(int sig) {
|
||||||
QString log_path = QDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)).filePath("olive_crash");
|
QString log_path = QDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)).filePath(QStringLiteral("olive_crash"));
|
||||||
QFile output(log_path);
|
QFile output(log_path);
|
||||||
|
|
||||||
output.open(QFile::WriteOnly);
|
output.open(QFile::WriteOnly);
|
||||||
@@ -105,13 +108,13 @@ void crash_handler(int sig) {
|
|||||||
size = backtrace(array, 10);
|
size = backtrace(array, 10);
|
||||||
|
|
||||||
// print out all the frames to stderr
|
// print out all the frames to stderr
|
||||||
fprintf(stderr, "Error: signal %d:\n", sig);
|
backtrace_symbols_fd(array, size, output.handle());
|
||||||
backtrace_symbols_fd(array, size, STDERR_FILENO);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
output.close();
|
output.close();
|
||||||
|
|
||||||
QProcess::startDetached(QStringLiteral("crashhandler"), {log_path});
|
QString crash_handler_exe = QDir(qApp->applicationDirPath()).filePath(QStringLiteral("crashhandler"));
|
||||||
|
QProcess::startDetached(crash_handler_exe, {log_path});
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,9 @@
|
|||||||
AboutDialog::AboutDialog(QWidget *parent) :
|
AboutDialog::AboutDialog(QWidget *parent) :
|
||||||
QDialog(parent)
|
QDialog(parent)
|
||||||
{
|
{
|
||||||
|
char* test = nullptr;
|
||||||
|
test[250] = 69;
|
||||||
|
|
||||||
setWindowTitle(tr("About %1").arg(QApplication::applicationName()));
|
setWindowTitle(tr("About %1").arg(QApplication::applicationName()));
|
||||||
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ extern "C" {
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QSurfaceFormat>
|
#include <QSurfaceFormat>
|
||||||
|
#include <csignal>
|
||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "common/crashhandler.h"
|
#include "common/crashhandler.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user