• Dmitry Kazakov's avatar
    Add a CMake option for ASAN address sanitizer · 05762b6e
    Dmitry Kazakov authored
    Summary:
    To activate sanitizer you should activate three options (it will cause
    a full rebuild):
    
    -DCMAKE_BUILD_TYPE=Debug \
    -DKRITA_DEVS=ON \
    -DKRITA_DEVS_SANITIZER
    
    After that, yiou should install llvm to get pretty
    backtrace output with resolved symbols:
    
    # find out the version of llvm installed
    sudo apt list 'libllvm*'
    
    # install the corresponding llvm binaries
    sudo apt install llvm-X.X # where X.X is a version of libllvm package
    
    export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-X.X # where X.X is the verison of your llvm
    export ASAN_OPTIONS=fast_unwind_on_malloc=1:symbolize=1:malloc_context_size=15
    
    Test Plan:
    Compile Krita and try to make it crash with a memory problem. Instead
    of failing with SIGSEGV it should crash with ASAN backtrace :)
    
    Reviewers: #krita, rempt
    
    Tags: #krita
    
    Differential Revision: https://phabricator.kde.org/D17853
    05762b6e
CMakeLists.txt 26.4 KB