finalcut/scripts/valgrind.sh

25 lines
733 B
Bash
Raw Normal View History

2015-05-23 13:35:12 +02:00
#!/bin/bash
# Finds uninitialized memory, buffer overflows, memory leaks and discovered access to deallocated memory
if [ -z "$1" ]
then
PROG="../examples/.libs/ui"
else
PROG="$1"
2018-02-04 19:42:30 +01:00
shift
fi
# Is the file executable?
2019-10-05 23:20:07 +02:00
test ! -x "$PROG" && echo "No executable file not found" && exit 1
# ELF executable file?
ELFMAGIC="$(echo -e "\\x7fELF")"
MAGIC="$(dd bs=1 count=4 if="$PROG" 2>/dev/null)"
2019-10-05 23:20:07 +02:00
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