asan.sh (703B)
1 #!/bin/bash 2 3 # Helper script to build and run neovim with Address Sanitizer enabled. 4 # You may read more information in src/nvim/README.md in the section "Build 5 # with ASAN". 6 7 shopt -s nullglob 8 9 root_path=$(git rev-parse --show-toplevel) 10 log_path=$(mktemp -d) 11 export CC='clang' 12 13 # Change to detect_leaks=1 to detect memory leaks (slower). 14 export ASAN_OPTIONS="detect_leaks=0:log_path=$log_path/asan" 15 16 make -C "$root_path" CMAKE_EXTRA_FLAGS="-DENABLE_ASAN_UBSAN=ON" 17 VIMRUNTIME="$root_path"/runtime "$root_path"/build/bin/nvim 18 19 # Need to manually reset terminal to avoid mangled output, nvim does not 20 # properly restore the terminal when it crashes. 21 tput reset 22 23 for i in "$log_path"/*; do 24 cat "$i" 25 done