From 3a4698058840ff79e58709b6135c8fb757a99606 Mon Sep 17 00:00:00 2001 From: Pedro Larroy Date: Mon, 29 Apr 2019 19:22:03 -0700 Subject: [PATCH] Use USE_SIGNAL_HANDLER by default set to ON in CMakeLists.txt (#14599) * Use USE_SIGNAL_HANDLER by default set to ON in CMakeLists.txt * Fix lint error with NULL vs nullptr --- CMakeLists.txt | 2 +- src/initialize.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d014e96ff77f..37836c2607b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ mxnet_option(USE_VTUNE "Enable use of Intel Amplifier XE (VTune)" OFF mxnet_option(ENABLE_CUDA_RTC "Build with CUDA runtime compilation support" ON) mxnet_option(BUILD_CPP_EXAMPLES "Build cpp examples" ON) mxnet_option(INSTALL_EXAMPLES "Install the example source files." OFF) -mxnet_option(USE_SIGNAL_HANDLER "Print stack traces on segfaults." OFF) +mxnet_option(USE_SIGNAL_HANDLER "Print stack traces on segfaults." ON) mxnet_option(USE_TENSORRT "Enable infeference optimization with TensorRT." OFF) mxnet_option(USE_ASAN "Enable Clang/GCC ASAN sanitizers." OFF) mxnet_option(ENABLE_TESTCOVERAGE "Enable compilation with test coverage metric output" OFF) diff --git a/src/initialize.cc b/src/initialize.cc index 00a736abd8ba..7236ced52e93 100644 --- a/src/initialize.cc +++ b/src/initialize.cc @@ -46,8 +46,8 @@ class LibraryInitializer { dmlc::InitLogging("mxnet"); #if MXNET_USE_SIGNAL_HANDLER && DMLC_LOG_STACK_TRACE struct sigaction sa; - sigaction(SIGSEGV, NULL, &sa); - if (sa.sa_handler == NULL) { + sigaction(SIGSEGV, nullptr, &sa); + if (sa.sa_handler == nullptr) { signal(SIGSEGV, SegfaultLogger); } #endif