Add helpers for debugging with valgrind

The environment variable USE_VALGRIND can be set to run tests with valgrind. If
VALGRIND_GDB is set, valgrind will start it's own gdbserver for remote
debugging with `target remote | vgdb`. USE_GDB can still be used, but it will
be ignored if USE_VALGRIND is set.
This commit is contained in:
Thiago de Arruda 2014-04-05 09:26:17 -03:00
parent ade0c127e5
commit cb9afe0dc0
2 changed files with 23 additions and 3 deletions

7
.valgrind.supp Normal file
View File

@ -0,0 +1,7 @@
{
nss_parse_service_list
Memcheck:Leak
fun:malloc
fun:nss_parse_service_list
fun:__nss_database_lookup
}

View File

@ -2,6 +2,8 @@
# Makefile to run all tests for Vim
#
export SHELL := sh
VIMPROG := ../../build/bin/nvim
SCRIPTS := test1.out test2.out test3.out test4.out test5.out test6.out \
@ -27,8 +29,19 @@ SCRIPTS := test1.out test2.out test3.out test4.out test5.out test6.out \
SCRIPTS_GUI := test16.out
ifdef VALGRIND_GDB
VGDB := --vgdb=yes --vgdb-error=0
endif
ifdef USE_VALGRIND
VALGRIND_TOOL=--tool=memcheck --leak-check=yes --track-origins=yes
# VALGRIND_TOOL=exp-sgcheck
TOOL = valgrind -q -q $(VALGRIND_TOOL) --suppressions=../../.valgrind.supp --error-exitcode=123 --log-file=valgrind.\%p.$* $(VGDB) --trace-children=yes
else
ifdef USE_GDB
GDB = gdb --args
TOOL = gdb --args
endif
endif
ifdef TESTNUM
@ -54,10 +67,10 @@ $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
RM_ON_RUN = test.out X* viminfo
RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok
RUN_VIM = $(GDB) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in
RUN_VIM = $(TOOL) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in
clean:
-rm -rf *.out *.failed *.rej *.orig test.log $(RM_ON_RUN) $(RM_ON_START) valgrind.*
-rm -rf *.out *.failed *.rej *.orig test.log $(RM_ON_RUN) $(RM_ON_START) valgrind.* .*.swp .*.swo
test1.out: .gdbinit test1.in
-rm -rf $*.failed $(RM_ON_RUN) $(RM_ON_START) wrongtermsize