From 6dc77c25f680baa205484f7f4e29e1a8f0fb20aa Mon Sep 17 00:00:00 2001 From: zelgadis Date: Fri, 21 Nov 2008 13:00:21 +0000 Subject: Added a convenience script for invoking Valgrind to find memory errors/bugs, and a Valgrind suppressions file to suppress things that either aren't really memory bugs or are bugs in third party libraries which we can't fix. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7526 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/misc/grind.sh | 6 ++++ crawl-ref/source/misc/valgrind-suppress.txt | 53 +++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100755 crawl-ref/source/misc/grind.sh create mode 100644 crawl-ref/source/misc/valgrind-suppress.txt (limited to 'crawl-ref/source/misc') diff --git a/crawl-ref/source/misc/grind.sh b/crawl-ref/source/misc/grind.sh new file mode 100755 index 0000000000..568069a6a7 --- /dev/null +++ b/crawl-ref/source/misc/grind.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +# Convenience caller for the valgrind memory debugger + +nice -n 7 valgrind --tool=memcheck --leak-check=full --log-file=grind.log \ + --suppressions=misc/valgrind-suppress.txt ./crawl $* diff --git a/crawl-ref/source/misc/valgrind-suppress.txt b/crawl-ref/source/misc/valgrind-suppress.txt new file mode 100644 index 0000000000..5a4e483fb1 --- /dev/null +++ b/crawl-ref/source/misc/valgrind-suppress.txt @@ -0,0 +1,53 @@ +# stashFile in save_game() never gets freed since the process exits +# before save_game() returns. Wildcards at start and end of function +# names since they get mangled by the C++ compiler and mecheck goes +# by the mangled names. +# +# Also, the first "obj:*" is for the new() operator, which gets mangled +# in the valgrind library, and might be mangled differently in different +# version of valgrind. +# +# NOTE: The number of copies of "obj:*libstdc++*" might need to be changed +# for different versions of the C++ library. +{ + save_game_savedir_leak + Memcheck:Leak + obj:* + obj:*libstdc++* + obj:*libstdc++* + obj:*libstdc++* + obj:*libstdc++* + obj:*libstdc++* + fun:*get_savedir_filename* + fun:*save_game* +} + +# The error variable in end() is stuff.cc never gets freed since +# exit() is called before end() returns. See above suppression for more +# notes +{ + end_error_leak + Memcheck:Leak + obj:* + obj:*libstdc++* + obj:*libstdc++* + obj:*libstdc++* + obj:*libstdc++* + obj:*libstdc++* + fun:*end* +} + +# The Berkeley DB code sometimes writes the contents of an unitialized buffer +# when the save/db/ and save/des/ files are being generated. +{ + berkeley_db_write + Memcheck:Param + pwrite64(buf) + fun:pwrite64 + fun:__os_io + fun:__memp_pgwrite + fun:__memp_bhwrite + fun:__memp_sync_int + fun:__memp_fsync + fun:__db_sync +} -- cgit v1.2.3-54-g00ecf