asan.sh 703 B

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