From 40e7ca4c71a5777ead1699a7264cb39606504596 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Wed, 26 Sep 2018 18:10:28 +0200 Subject: Add breakpad submodule --- src/main.cpp | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 12961ff..f3ddeb9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,25 +7,40 @@ */ #include "browser.h" +#include "plugin.h" +#include "session.h" #include "version.h" #include +#include +#include #include -#include #include -#include "plugin.h" -#include "session.h" -#include -#include +#include #ifdef _WIN32 -#include #include +#include +#endif + +#ifdef BreakpadEnabled +#include + +static bool dumpCallback(const google_breakpad::MinidumpDescriptor &descriptor, void *context, bool succeeded) +{ + printf("Dump path: %s\n", descriptor.path()); + return succeeded; +} #endif int main(int argc, char **argv) { +#ifdef BreakpadEnabled + google_breakpad::MinidumpDescriptor descriptor("/tmp"); + google_breakpad::ExceptionHandler eh(descriptor, NULL, dumpCallback, NULL, true, -1); +#endif + // a beautiful hack to be able to write to stdout on Windows #ifdef _WIN32 - if (AttachConsole(ATTACH_PARENT_PROCESS)) { + if(AttachConsole(ATTACH_PARENT_PROCESS)) { freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stderr); } @@ -62,7 +77,7 @@ int main(int argc, char **argv) QVector plugins = loadPlugins(config->value("plugins.path").value()); QMap> pluginCommands; for(const auto &plugin : plugins) { - auto *pluginInterface = qobject_cast(plugin.instance); + auto *pluginInterface = qobject_cast(plugin.instance); Q_CHECK_PTR(pluginInterface); QHashIterator> i(pluginInterface->commands()); @@ -74,9 +89,11 @@ int main(int argc, char **argv) if(config->exists("help")) { std::cout << "smolbote " << SMOLBOTE_VERSION << ": yet another no-frills browser" << std::endl; - std::cout << "Usage: " << argv[0] << " [options] [command/URL(s)]" << std::endl << std::endl; + std::cout << "Usage: " << argv[0] << " [options] [command/URL(s)]" << std::endl + << std::endl; - std::cout << "Command-line Options: " << std::endl << config->commandlineOptions() << std::endl; + std::cout << "Command-line Options: " << std::endl + << config->commandlineOptions() << std::endl; std::cout << "Commands: " << std::endl; for(auto it = pluginCommands.constBegin(); it != pluginCommands.constEnd(); ++it) { @@ -84,10 +101,12 @@ int main(int argc, char **argv) } std::cout << std::endl; - std::cout << "Configuration Options: " << std::endl << config->configurationOptions() << std::endl; + std::cout << "Configuration Options: " << std::endl + << config->configurationOptions() << std::endl; #ifdef Q_OS_LINUX - std::cout << std::endl << "For more information refer to the manual page smolbote.7" << std::endl; + std::cout << std::endl + << "For more information refer to the manual page smolbote.7" << std::endl; #endif return 0; } -- cgit v1.2.1