ASAN/UBSAN can be used to detect memory errors and other common forms of undefined behavior at runtime in debug builds.
- To build Neovim with sanitizers enabled, use
rm -rf build && CMAKE_EXTRA_FLAGS="-DCMAKE_C_COMPILER=clang -DCLANG_ASAN_UBSAN=1" make
- When running Neovim, use
or
UBSAN_OPTIONS='print_stacktrace=1' nvim args...
UBSAN_OPTIONS='print_stacktrace=1' ASAN_OPTIONS=log_path=/tmp/nvim_asan nvim args...
- To run a test:
UBSAN_OPTIONS='print_stacktrace=1' make functionaltest TEST_FILE=...