Skip to content

Commit

Permalink
Merge branch 'main' into acts-scalar-please
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger authored Oct 17, 2024
2 parents 8fd7506 + f935e25 commit fe37fe9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"inherits": "common",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS": "-Werror",
"CMAKE_COMPILE_WARNING_AS_ERROR": "ON",
"ACTS_FORCE_ASSERTIONS": "ON",
"ACTS_ENABLE_LOG_FAILURE_THRESHOLD": "ON",
"ACTS_BUILD_BENCHMARKS": "ON",
Expand Down
7 changes: 7 additions & 0 deletions Examples/Framework/src/Framework/Sequencer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ Sequencer::Sequencer(const Sequencer::Config& cfg)
"ACTS_SEQUENCER_DISABLE_FPEMON");
m_cfg.trackFpes = false;
}

if (m_cfg.trackFpes && !m_cfg.fpeMasks.empty() &&
!Acts::FpeMonitor::canSymbolize()) {
ACTS_ERROR("FPE monitoring is enabled but symbolization is not available");
throw std::runtime_error(
"FPE monitoring is enabled but symbolization is not available");
}
}

void Sequencer::addContextDecorator(
Expand Down
32 changes: 13 additions & 19 deletions Plugins/FpeMonitoring/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ else()

set(_backtrace_setup_complete FALSE)

find_path(
boost_stacktrace_include
NAMES "boost/stacktrace.hpp"
REQUIRED
)
if(Backtrace_FOUND)
# check if we need to link against bracktrace or not
set(backtrace_include "")
Expand All @@ -44,6 +49,7 @@ else()
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp"
LINK_LIBRARIES ${dl_LIBRARY}
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${boost_stacktrace_include}"
COMPILE_DEFINITIONS -DBOOST_STACKTRACE_USE_BACKTRACE
OUTPUT_VARIABLE __OUTPUT
)
Expand All @@ -54,9 +60,9 @@ else()
message(CHECK_FAIL "no")

file(GLOB hints "/usr/lib/gcc/*/*/include")
find_file(backtrace_header "backtrace.h" HINTS ${hints})
find_file(backtrace_header NAMES "backtrace.h" HINTS ${hints})

if(${backtrace_header} STREQUAL "backtrcae_header-NOTFOUND")
if(${backtrace_header} STREQUAL "backtrace_header-NOTFOUND")
message(STATUS "Could not find backtrace header file")
else()
set(backtrace_include
Expand All @@ -82,6 +88,8 @@ else()
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp"
LINK_LIBRARIES ${dl_LIBRARY}
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES=${boost_stacktrace_include}"
COMPILE_DEFINITIONS
-DBOOST_STACKTRACE_USE_BACKTRACE
${backtrace_include}
Expand Down Expand Up @@ -111,6 +119,7 @@ else()
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp"
LINK_LIBRARIES ${dl_LIBRARY}
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${boost_stacktrace_include}"
COMPILE_DEFINITIONS
-DBOOST_STACKTRACE_USE_BACKTRACE
${backtrace_include}
Expand All @@ -137,6 +146,8 @@ else()
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp"
LINK_LIBRARIES backtrace ${dl_LIBRARY}
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES=${boost_stacktrace_include}"
COMPILE_DEFINITIONS
-DBOOST_STACKTRACE_USE_BACKTRACE
${backtrace_include}
Expand All @@ -158,23 +169,6 @@ else()
endif()
endif()

if(NOT _backtrace_setup_complete)
message(CHECK_START "Is addr2line available")
if(addr2line_EXECUTABLE)
list(APPEND _fpe_options -DBOOST_STACKTRACE_USE_ADDR2LINE)
list(
APPEND
_fpe_options
-DBOOST_STACKTRACE_ADDR2LINE_LOCATION=${addr2line_EXECUTABLE}
)
message(CHECK_PASS "yes")

set(_backtrace_setup_complete TRUE)
else()
message(CHECK_FAIL "no")
endif()
endif()

if(NOT _backtrace_setup_complete)
message(STATUS "Unable to set up stacktrace setup: use noop")
list(APPEND _fpe_options -BOOST_STACKTRACE_USE_NOOP)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class FpeMonitor {
std::size_t depth);
static std::string getSourceLocation(const boost::stacktrace::frame &frame);

static bool canSymbolize();

private:
void enable();
void disable();
Expand Down
8 changes: 8 additions & 0 deletions Plugins/FpeMonitoring/src/FpeMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,12 @@ std::string FpeMonitor::getSourceLocation(
return frame.source_file() + ":" + std::to_string(frame.source_line());
}

bool FpeMonitor::canSymbolize() {
#if defined(BOOST_STACKTRACE_USE_NOOP)
return false;
#else
return true;
#endif
}

} // namespace Acts

0 comments on commit fe37fe9

Please sign in to comment.