Graphics.ValgrindDoug - lordmundi/wikidoctest GitHub Wiki
Initially, I was going to show how I got this working with Doug, but going to write in general, and show what I did for Doug later.
Valgrind is a tool to catch memory problems with an executable.
I had to download the latest for it to work with Doug. Here is the download site
If you get this error on startup
valgrind: failed to start tool 'memcheck' for platform 'x86-linux': No such file or directory
In perf/tinycc.c
after
tcc_add_library_path(s, "/usr/local/lib");
tcc_add_library_path(s, "/usr/lib");
tcc_add_library_path(s, "/lib");
add
tcc_add_library_path(s, "[myprefix]/lib");
% valgrind —tool=memcheck <myexec>
If you see something like:
==9567== Invalid read of size 4
==9567== at 0×4014C37: (within /lib/ld-2.6.1.so)
==9567== by 0×4A28061: (within /lib/tls/i686/cmov/libc-2.6.1.so)
==9567== by 0×400D015: (within /lib/ld-2.6.1.so)
==9567== by 0×4A28224: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.6.1.so)
==9567== Address 0×4EF2B04 is 28 bytes inside a block of size 31 alloc'd
==9567== at 0×4022765: malloc (vg_replace_malloc.c:149)
==9567== by 0×4007FA1: (within /lib/ld-2.6.1.so)
==9567== by 0×4A28061: (within /lib/tls/i686/cmov/libc-2.6.1.so)
==9567== by 0×400D015: (within /lib/ld-2.6.1.so)
==9567== by 0×4A28224: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.6.1.so)
==9567== by 0×4A02756: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.6.1.so)
Do this:
% valgrind —tool=memcheck —error-limit=no \
—gen-suppressions=yes \
—suppressions=${HOME}/bin/valgrind-suppressions <myexec>
→ STOPPED HERE ←