asan.sh 776 B

1234567891011121314151617181920212223242526272829
  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. # Show backtraces in the logs.
  12. export UBSAN_OPTIONS="print_stacktrace=1"
  13. make -C "$root_path" CMAKE_EXTRA_FLAGS="-DCLANG_ASAN_UBSAN=ON"
  14. VIMRUNTIME="$root_path"/runtime "$root_path"/build/bin/nvim
  15. # Need to manually reset terminal to avoid mangled output, nvim does not
  16. # properly restore the terminal when it crashes.
  17. tput reset
  18. for i in "$log_path"/*; do
  19. cat "$i"
  20. done