From: Marcel Lauhoff Date: Thu, 16 Jan 2025 09:24:09 +0000 (+0100) Subject: global: Make breakpad code compile-time conditional on HAVE_BREAKPAD X-Git-Tag: testing/wip-pdonnell-testing-20250604.171440-debug~33^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=cf7d43aec7a52891ee009522be1f1d88cba237ba;p=ceph-ci.git global: Make breakpad code compile-time conditional on HAVE_BREAKPAD Only build breakpad code if we build with breakpad support. Print warning if breakpad enabled in config, but not built. Signed-off-by: Marcel Lauhoff --- diff --git a/src/common/ceph_context.h b/src/common/ceph_context.h index 14e157f41c6..df96ae68dcb 100644 --- a/src/common/ceph_context.h +++ b/src/common/ceph_context.h @@ -34,7 +34,9 @@ #include "common/cmdparse.h" #include "common/code_environment.h" #include "msg/msg_types.h" +#ifdef HAVE_BREAKPAD #include "breakpad/src/client/linux/handler/exception_handler.h" +#endif #ifdef WITH_CRIMSON #include "crimson/common/config_proxy.h" #include "crimson/common/perf_counters_collection.h" @@ -144,7 +146,9 @@ public: ConfigProxy _conf; ceph::logging::Log *_log; +#ifdef HAVE_BREAKPAD std::unique_ptr _ex_handler; +#endif /* init ceph::crypto */ void init_crypto(); diff --git a/src/global/global_init.cc b/src/global/global_init.cc index 839951249c9..46e05916bd4 100644 --- a/src/global/global_init.cc +++ b/src/global/global_init.cc @@ -26,8 +26,10 @@ #include "extblkdev/ExtBlkDevPlugin.h" #include "global/global_context.h" #include "global/global_init.h" +#ifdef HAVE_BREAKPAD #include #include +#endif #include "global/pidfile.h" #include "global/signal_handler.h" #include "include/compat.h" @@ -180,6 +182,7 @@ void global_pre_init( g_conf().complain_about_parse_error(g_ceph_context); } +#ifdef HAVE_BREAKPAD static bool dumpCallback( const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded) { @@ -188,6 +191,7 @@ static bool dumpCallback( dout_emergency(buf); return succeeded; } +#endif boost::intrusive_ptr global_init(const std::map *defaults, @@ -227,11 +231,18 @@ global_init(const std::map *defaults, install_standard_sighandlers(); } +#ifdef HAVE_BREAKPAD if (g_conf()->breakpad) { google_breakpad::MinidumpDescriptor descriptor(g_conf()->crash_dir); g_ceph_context->_ex_handler.reset( new google_breakpad::ExceptionHandler(descriptor, nullptr, dumpCallback, nullptr, true, -1)); } +#else + if (g_conf()->breakpad) { + cerr << "breakpad crash reporting requested, but disabled at build time" + << std::endl; + } +#endif ceph::register_assert_context(g_ceph_context);