aboutsummaryrefslogtreecommitdiff
path: root/src/crashhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/crashhandler.cpp')
-rw-r--r--src/crashhandler.cpp56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/crashhandler.cpp b/src/crashhandler.cpp
deleted file mode 100644
index ed9298f..0000000
--- a/src/crashhandler.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * This file is part of smolbote. It's copyrighted by the contributors recorded
- * in the version control history of the file, available from its original
- * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote
- *
- * SPDX-License-Identifier: GPL-3.0
- */
-
-#include "crashhandler.h"
-#include "version.h"
-#include <QByteArray>
-#include <client/linux/handler/exception_handler.h>
-#include <unistd.h>
-
-// bool filter_callback (void*)
-// --> true: continue processing and write a minidump
-static bool minidumpCb(const google_breakpad::MinidumpDescriptor &descriptor, void *context, bool succeeded)
-{
- printf("Dump path: %s\n", descriptor.path());
-
- auto *ctx = static_cast<CrashHandler::Context *>(context);
- if(ctx != nullptr) {
- if(!ctx->handler.empty()) {
- // fork and run 'handler master:commit path.dmp'
- pid_t pid = fork();
- if(pid == 0) {
- // pathname program argument ... nullptr
- execlp(ctx->handler.c_str(),
- ctx->handler.c_str(), "--crashd", ctx->dumppath.c_str(), "-c", descriptor.path(), poi_Version,
- (char *)nullptr);
- }
- }
- }
-
- return succeeded;
-}
-
-bool CrashHandler::install_handler(CrashHandler::Context &ctx)
-{
- if(ctx.dumppath.empty())
- return false;
-
- // Disable Chromium's crash handler so breakpad can capture crashes instead.
- // This has to be done before QtWebEngine gets initialized.
- const auto chromiumFlags = qgetenv("QTWEBENGINE_CHROMIUM_FLAGS");
- if(!chromiumFlags.contains("disable-in-process-stack-traces")) {
- qputenv("QTWEBENGINE_CHROMIUM_FLAGS", chromiumFlags + " --disable-in-process-stack-traces");
- }
-
- google_breakpad::MinidumpDescriptor descriptor(ctx.dumppath.c_str());
-
- // minidump descriptor, filter callback, minidump callback, callback_context, install handler, server_fd
- new google_breakpad::ExceptionHandler(descriptor, nullptr, minidumpCb, &ctx, true, -1);
-
- return true;
-}