aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-01-03 21:58:20 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2020-01-03 23:28:39 +0200
commit0642a0910ca0fb8e392636254684b91637a7b542 (patch)
tree4fa4328fcdf205b80103d5255ea1570439b46cce /src/main.cpp
parentMerge some QoL improvements from staging branch (diff)
downloadsmolbote-0642a0910ca0fb8e392636254684b91637a7b542.tar.xz
PKGBUILD: add install stage for debug symbols
- make toggling breakpad work properly
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp32
1 files changed, 13 insertions, 19 deletions
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<std::string>("browser.crash.path").value_or("/tmp");
- assert(!crashpath.empty());
-
- CrashHandler::BreakpadContext ctx;
- google_breakpad::MinidumpDescriptor descriptor(crashpath.c_str());
-
- const auto crashHandler = config->value<std::string>("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<bool>("usebreakpad").value()) {
+ CrashHandler::Context ctx(
+ conf.value<std::string>("path.crashdump").value(),
+ conf.value<std::string>("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;