Diffusion Krita 05762b6eb3b2

Add a CMake option for ASAN address sanitizer

Authored by dkazakov on Dec 29 2018, 12:56 PM.

Description

Add a CMake option for ASAN address sanitizer

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