Skip to content

Commit cf7d43a

Browse files
committed
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 <[email protected]>
1 parent a451047 commit cf7d43a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/common/ceph_context.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
#include "common/cmdparse.h"
3535
#include "common/code_environment.h"
3636
#include "msg/msg_types.h"
37+
#ifdef HAVE_BREAKPAD
3738
#include "breakpad/src/client/linux/handler/exception_handler.h"
39+
#endif
3840
#ifdef WITH_CRIMSON
3941
#include "crimson/common/config_proxy.h"
4042
#include "crimson/common/perf_counters_collection.h"
@@ -144,7 +146,9 @@ class CephContext {
144146

145147
ConfigProxy _conf;
146148
ceph::logging::Log *_log;
149+
#ifdef HAVE_BREAKPAD
147150
std::unique_ptr<google_breakpad::ExceptionHandler> _ex_handler;
151+
#endif
148152

149153
/* init ceph::crypto */
150154
void init_crypto();

src/global/global_init.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626
#include "extblkdev/ExtBlkDevPlugin.h"
2727
#include "global/global_context.h"
2828
#include "global/global_init.h"
29+
#ifdef HAVE_BREAKPAD
2930
#include <client/linux/handler/minidump_descriptor.h>
3031
#include <google_breakpad/common/minidump_format.h>
32+
#endif
3133
#include "global/pidfile.h"
3234
#include "global/signal_handler.h"
3335
#include "include/compat.h"
@@ -180,6 +182,7 @@ void global_pre_init(
180182
g_conf().complain_about_parse_error(g_ceph_context);
181183
}
182184

185+
#ifdef HAVE_BREAKPAD
183186
static bool dumpCallback(
184187
const google_breakpad::MinidumpDescriptor& descriptor, void* context,
185188
bool succeeded) {
@@ -188,6 +191,7 @@ static bool dumpCallback(
188191
dout_emergency(buf);
189192
return succeeded;
190193
}
194+
#endif
191195

192196
boost::intrusive_ptr<CephContext>
193197
global_init(const std::map<std::string,std::string> *defaults,
@@ -227,11 +231,18 @@ global_init(const std::map<std::string,std::string> *defaults,
227231
install_standard_sighandlers();
228232
}
229233

234+
#ifdef HAVE_BREAKPAD
230235
if (g_conf()->breakpad) {
231236
google_breakpad::MinidumpDescriptor descriptor(g_conf()->crash_dir);
232237
g_ceph_context->_ex_handler.reset(
233238
new google_breakpad::ExceptionHandler(descriptor, nullptr, dumpCallback, nullptr, true, -1));
234239
}
240+
#else
241+
if (g_conf()->breakpad) {
242+
cerr << "breakpad crash reporting requested, but disabled at build time"
243+
<< std::endl;
244+
}
245+
#endif
235246

236247
ceph::register_assert_context(g_ceph_context);
237248

0 commit comments

Comments
 (0)