September 2018
Intermediate to advanced
606 pages
14h 32m
English
We need to compile our code with particular flags to take advantage of ASan. Then, we will run tests and submit them to the dashboard. Let us take a look at how to do this:
add_library(buggy "")target_sources(buggy PRIVATE buggy.cpp PUBLIC ${CMAKE_CURRENT_LIST_DIR}/buggy.hpp )target_include_directories(buggy PUBLIC ${CMAKE_CURRENT_LIST_DIR} )
option(ENABLE_ASAN "Enable AddressSanitizer" OFF)if(ENABLE_ASAN) if(CMAKE_CXX_COMPILER_ID MATCHES GNU) message(STATUS "AddressSanitizer enabled") target_compile_options(buggy PUBLIC -g -O1 -fsanitize=address -fno-omit-frame-pointer ) target_link_libraries(buggy ...
Read now
Unlock full access