From 0642a0910ca0fb8e392636254684b91637a7b542 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 3 Jan 2020 21:58:20 +0200 Subject: PKGBUILD: add install stage for debug symbols - make toggling breakpad work properly --- src/main.cpp | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index f4f2b78..f6a5b17 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -148,26 +148,20 @@ int main(int argc, char **argv) // set this, otherwise the webview becomes black when using a stylesheet app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true); -#ifdef CONFIG_USEBREAKPAD - const std::string crashpath = config->value("browser.crash.path").value_or("/tmp"); - assert(!crashpath.empty()); - - CrashHandler::BreakpadContext ctx; - google_breakpad::MinidumpDescriptor descriptor(crashpath.c_str()); - - const auto crashHandler = config->value("browser.crash.handler"); - if(crashHandler) { - const int length = crashHandler.value().length() + 1; - ctx.handler = new char[length]; - crashHandler.value().copy(ctx.handler, length - 1); - ctx.handler[length - 1] = '\0'; - } - - // minidump descriptor, filter callback, minidump callback, callback_context, install handler, server_fd - google_breakpad::ExceptionHandler eh(descriptor, nullptr, CrashHandler::dumpCallback, &ctx, true, -1); + { + Configuration conf; + if(conf.value("usebreakpad").value()) { + CrashHandler::Context ctx( + conf.value("path.crashdump").value(), + conf.value("path.crashhandler").value()); - spdlog::debug("Installed breakpad exception handler (path {})", crashpath); -#endif // CONFIG_USEBREAKPAD + if(CrashHandler::install_handler(ctx)) { + spdlog::info("Installed breakpad crash handler: {}", ctx.dumppath); + } else { + spdlog::warn("Failed to install breakpad crash handler: {}", ctx.dumppath); + } + } + } const auto profile = []() { Configuration c; -- cgit v1.2.1