aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-09-26 18:10:28 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-09-26 18:10:28 +0200
commit40e7ca4c71a5777ead1699a7264cb39606504596 (patch)
treef585dfd45d8e2177ec1d12b746d6e845375002df /src/main.cpp
parentBookmarks: remove debug defines (diff)
downloadsmolbote-40e7ca4c71a5777ead1699a7264cb39606504596.tar.xz
Add breakpad submodule
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp43
1 files changed, 31 insertions, 12 deletions
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 <QFile>
+#include <QLibraryInfo>
+#include <QTranslator>
#include <configuration/configuration.h>
-#include <memory>
#include <iostream>
-#include "plugin.h"
-#include "session.h"
-#include <QTranslator>
-#include <QLibraryInfo>
+#include <memory>
#ifdef _WIN32
-#include <windows.h>
#include <cstdio>
+#include <windows.h>
+#endif
+
+#ifdef BreakpadEnabled
+#include <client/linux/handler/exception_handler.h>
+
+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<Plugin> plugins = loadPlugins(config->value<QString>("plugins.path").value());
QMap<QString, std::function<int()>> pluginCommands;
for(const auto &plugin : plugins) {
- auto *pluginInterface = qobject_cast<PluginInterface*>(plugin.instance);
+ auto *pluginInterface = qobject_cast<PluginInterface *>(plugin.instance);
Q_CHECK_PTR(pluginInterface);
QHashIterator<QString, std::function<int()>> 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;
}