Skip to content

Commit

Permalink
Enable stack traces by default in all SDK and test executables (#768)
Browse files Browse the repository at this point in the history
  • Loading branch information
senderista authored Jul 8, 2021
1 parent ad3b204 commit 28a9a28
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
9 changes: 7 additions & 2 deletions production/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ project(production VERSION 0.1.0)

option(EXECUTE_FDW_TESTS "Execute FDW tests" OFF)

option(ENABLE_STACKTRACE "Enable stack traces in debug builds" ON)
option(ENABLE_STACKTRACE "Enable stack traces" ON)

option(BUILD_GAIA_RELEASE "Build Gaia Release packages and binaries" OFF)
include(GNUInstallDirs)
Expand Down Expand Up @@ -255,8 +255,13 @@ add_subdirectory(${FLATBUFFERS} flatbuffers)
include(ExternalProject)

# Backward.
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
if(ENABLE_STACKTRACE)
message(VERBOSE "ENABLE_STACKTRACE=${ENABLE_STACKTRACE}")
add_subdirectory("${GAIA_REPO}/third_party/production/backward" backward)
add_library(gaia_stack_trace INTERFACE)
target_sources(gaia_stack_trace INTERFACE "${GAIA_INC}/gaia_internal/common/backward.cpp")
target_compile_options(gaia_stack_trace INTERFACE -g -funwind-tables -fno-omit-frame-pointer)
target_link_libraries(gaia_stack_trace INTERFACE backward)
endif()
# Cpptoml.
add_subdirectory("${GAIA_REPO}/third_party/production/cpptoml" cpptoml)
Expand Down
4 changes: 4 additions & 0 deletions production/catalog/gaiac/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ target_include_directories(gaiac PRIVATE ${GAIA_CATALOG_TOOL_INCLUDES})
add_dependencies(gaiac gaia_db_server)
target_link_libraries(gaiac PRIVATE rt gaia_common gaia_catalog gaia_parser flatbuffers tabulate Threads::Threads)

if(ENABLE_STACKTRACE)
target_link_libraries(gaiac PRIVATE gaia_stack_trace)
endif()

install(TARGETS gaiac DESTINATION ${CMAKE_INSTALL_BINDIR})
4 changes: 4 additions & 0 deletions production/cmake/gaia_internal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ function(add_gtest TARGET SOURCES INCLUDES LIBRARIES)
endif()
target_link_libraries(${TARGET} PRIVATE ${LIBRARIES} ${GTEST_LIB})

if(ENABLE_STACKTRACE)
target_link_libraries(${TARGET} PRIVATE gaia_stack_trace)
endif()

if(NOT ("${ARGV6}" STREQUAL ""))
set(ENV "${ARGV6}")
else()
Expand Down
8 changes: 2 additions & 6 deletions production/db/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ set(GAIA_DB_SERVER_SOURCES
src/gaia_ptr.cpp
src/gaia_ptr_server.cpp)

if(ENABLE_STACKTRACE AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
list(APPEND GAIA_DB_SERVER_SOURCES src/backward.cpp)
endif()

add_executable(gaia_db_server ${GAIA_DB_SERVER_SOURCES})
add_dependencies(gaia_db_server "messages.fbs")
target_link_libraries(gaia_db_server PUBLIC gaia_build_options)
Expand All @@ -139,8 +135,8 @@ target_include_directories(gaia_db_server SYSTEM PRIVATE "${GEN_DIR}")

# Suppress spurious warnings about zero-initialized structs.
target_link_libraries(gaia_db_server PRIVATE gaia_common Threads::Threads rocks_wrapper gaia_memory_manager ${LIB_EXPLAIN} ${LIB_CAP} dl)
if(ENABLE_STACKTRACE AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
target_link_libraries(gaia_db_server PUBLIC backward)
if(ENABLE_STACKTRACE)
target_link_libraries(gaia_db_server PRIVATE gaia_stack_trace)
endif()
install(TARGETS gaia_db_server DESTINATION ${CMAKE_INSTALL_BINDIR})

Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions production/tools/gaia_translate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ target_link_libraries(gaiat
dl
)

if(ENABLE_STACKTRACE)
target_link_libraries(gaiat PRIVATE gaia_stack_trace)
endif()

install(TARGETS gaiat DESTINATION ${CMAKE_INSTALL_BINDIR})

set(TEST_INCLUDES
Expand Down

0 comments on commit 28a9a28

Please sign in to comment.