2015-05-23 13:35:12 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-12-24 02:34:30 +01:00
|
|
|
# Finds uninitialized memory, buffer overflows, memory leaks and discovered access to deallocated memory
|
|
|
|
|
|
|
|
if [ -z "$1" ]
|
|
|
|
then
|
2017-09-17 21:32:46 +02:00
|
|
|
PROG="../examples/.libs/ui"
|
2015-12-24 02:34:30 +01:00
|
|
|
else
|
|
|
|
PROG="$1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Is the file executable?
|
|
|
|
test ! -x "$PROG" && echo "No executable file not found" && exit -1
|
|
|
|
|
|
|
|
# ELF executable file?
|
2017-11-26 19:00:04 +01:00
|
|
|
ELFMAGIC="$(echo -e "\\x7fELF")"
|
2015-12-24 02:34:30 +01:00
|
|
|
MAGIC="$(dd bs=1 count=4 if="$PROG" 2>/dev/null)"
|
|
|
|
test "$MAGIC" != "$ELFMAGIC" && echo "No ELF executable file" && exit -2
|
|
|
|
|
|
|
|
LD_LIBRARY_PATH=../src/.libs/ valgrind --tool=memcheck --suppressions=../doc/ncurses.supp --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes --track-origins=yes --log-file=./valgrind.txt "$PROG" "$@"
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
less ./valgrind.txt
|
|
|
|
rm -f ./valgrind.txt
|