From 276bb86fca388416428613dec981e4e5eb927081 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Sat, 21 Aug 2021 18:48:52 +0200 Subject: Improved crash reporting setup and removed old stubs Also added ability to exercise crash reporting from command line --- zenserver/zenserver.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'zenserver/zenserver.cpp') diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp index 1d1711dfe..d9f72ed12 100644 --- a/zenserver/zenserver.cpp +++ b/zenserver/zenserver.cpp @@ -38,7 +38,6 @@ #include "casstore.h" #include "config.h" -#include "diag/crashreport.h" #include "diag/logging.h" #define SENTRY_BUILD_STATIC 1 @@ -74,6 +73,8 @@ public: using namespace fmt::literals; spdlog::info(ZEN_APP_NAME " initializing"); + m_DebugOptionForcedCrash = ServiceConfig.ShouldCrash; + if (ParentPid) { m_Process.Initialize(ParentPid); @@ -195,6 +196,13 @@ public: spdlog::info(ZEN_APP_NAME " now running"); + sentry_clear_modulecache(); + + if (m_DebugOptionForcedCrash) + { + __debugbreak(); + } + m_Http.Run(m_TestMode); spdlog::info(ZEN_APP_NAME " exiting"); @@ -288,6 +296,8 @@ private: HttpAdminService m_AdminService; HttpHealthService m_HealthService; zen::Mesh m_ZenMesh{m_IoContext}; + + bool m_DebugOptionForcedCrash = false; }; int @@ -295,18 +305,19 @@ main(int argc, char* argv[]) { mi_version(); + ZenServerOptions GlobalOptions; + ZenServiceConfig ServiceConfig; + ParseGlobalCliOptions(argc, argv, GlobalOptions, ServiceConfig); + InitializeLogging(GlobalOptions); + + // Initialize sentry.io client + sentry_options_t* SentryOptions = sentry_options_new(); sentry_options_set_dsn(SentryOptions, "https://8ba3441bebc941c1ae24b8cd2fd25d55@o10593.ingest.sentry.io/5919284"); sentry_init(SentryOptions); auto _ = zen::MakeGuard([&] { sentry_close(); }); - ZenServerOptions GlobalOptions; - ZenServiceConfig ServiceConfig; - ParseGlobalCliOptions(argc, argv, GlobalOptions, ServiceConfig); - InitializeCrashReporting(GlobalOptions.DataDir / "crashdumps"); - InitializeLogging(GlobalOptions); - // Prototype config system, let's see how this pans out ParseServiceConfig(GlobalOptions.DataDir, /* out */ ServiceConfig); -- cgit v1.2.3