Added better filtering for Helgrind tests, removing all unreliable stack
traces, and a few other unreliable pieces. This allowed most of the tests
to be reduced to a single .stderr.exp file. It also means that all Helgrind
tests succeed on my AMD64/Linux box when configured with --enable-only32bit,
whereas previously 20 of them failed.
Also tweaked a couple non-Helgrind filters a tiny bit.
Remove Helgrind .exp files which are out-of-date, because Helgrind's output
has changed since they were generated. Also remove one
(tc23_bogus_condwait.stderr.exp-glibc25-x86) that was a duplicate.
Change 'nightly' to print "(unchanged)" at the start of the email subject
line if the results are unchanged from 24 hours ago. Makes it easier to see
(or filter) if results are unchanged.
Some tweaks to make more tests pass, or get closer to passing, on
--enable-only32bit builds on my Ubuntu box:
- For all tests, replace all operator new/new[]/delete/delete[] variants
with a common form, eg. "...operator new...". This makes
exp-ptrcheck/tests/ccc and memcheck/tests/mismatches pass.
- For Helgrind tests, replace all libpthread paths with "/...libpthread...",
as is done for libc paths. This avoids problems when /lib32/libpthread.so
is the path. No extra tests pass, but many of them get a lot closer to
passing.
This commit completely overhauls the leak checker. In particular:
- It heavily refactors the code: uses better names for things, splits up
complex functions that behaved very differently depending on how they were
called, removes some redundancies, and generally makes it much simpler and
easier to follow.
- It adds lots of comments, both inline, and also a big explanatory one at
the top which makes it clear exactly how the leak checker works and also
exactly what is meant by definite, possible, and indirect leaks. It also
has some ideas for future improvements.
- All tabs have been converted to spaces.
It also improves the functionality:
- Previously if you did --leak-check=summary, indirect and suppressed
blocks were counted as definite leaks. Now they are done properly, and so
the summary results from --leak-check=summary match those from
--leak-check=yes.
- Previously, some possibly reachable blocks were miscategorised as
definitely reachable, because only the pointer to the block itself was
considered, not any preceding pointers in the chain. This is now fixed.
- Added memcheck/tests/leak-cases, which fully tests all the possible
combinations of directly/indirectly reachable and possibly/definitely
reachable.
And it improves the manual quite a bit, and the FAQ a little bit.
This doesn't fix the leak checker to handle MALLOCLIKE_BLOCK works that have
been taken from within malloc'd blocks, but I think I know how to do it and
hope to do so in a subsequent commit.
It also changes all instances of "<constant>memcheck</constant>" in the
Memcheck manual to "Memcheck", for consistency and because "Memcheck" is
easier to write. There's one similar case for DRD but I didn't change that.
Tom Hughes [Mon, 9 Mar 2009 09:19:03 +0000 (09:19 +0000)]
Keep track of the svma and bias values for the debug data separately
as they may be different to those for other sections of the ELF file
if we have separated debug information and the main file has been
prelinked since they were split. Fixes bug #185816.
tests/arch_test is currently being used for two purposes:
- by vg_regtest for determining if a directory name matches an architecture;
- by various .vgtest files for detecting x86/AMD64 features.
This commit splits it in two for the two different purposes, which makes
things clearer.
Specific changes
- Moved the x86/AMD64 feature detection stuff out of arch_test.c, and
into the new x86_amd64_feature.c. Updated the relevant .vgtest files for
the change.
- In vg_regtest, now a prereq command must return 0 (prereq satisfied) or 1
(prereq not satisfied). Anything else makes vg_regtest abort. This
makes obvious any problems with prereq tests rather than just making the
tests skip innocuously. (We previously had exactly such a problem on the
DARWIN branch; the x86 feature detection tests caused segfaults so the
tests were incorrectly skipped. This change will catch any similar future
problem.)
- Changed os_test from a script to a C program, matching cpu_test.
- Removed some unintentional darwin stuff from platform_test.
Delete memcheck/tests/zeropage. The original purpose of the test is no
longer valid, as the comment indicates. Furthermore it mmaps arbitrary bits
of address space and so is horribly unportable, and doesn't work on Darwin.
atoll() is a terrible function -- you can't do any error checking with it.
Some of our option processing code uses it. This means that eg.
'--log-fd=9xxx' logs to fd 9, and '--log-fd=blahblahblah' logs to 0 (because
atoll() returns 0 if the string doesn't contain a number!)
It turns out that most of our option processing uses VG_(strtoll*) instead
of VG_(atoll). The reason that not all of it does is that the
option-processing macros are underpowered -- they currently work well if you
just want to assign the value to a variable, eg:
So this commit:
- Improves the *_CLO_* macros so that they can be used in all circumstances.
They're now just expressions (albeit ones with side-effects, setting the
named variable appropriately). Thus they can be used as if-conditions,
and any post-checking or processing can occur in the then-statement. And
malformed numeric arguments (eg. --log-fd=foo) aren't accepted. This also
means you don't have to specify the lengths of any option strings anywhere
(eg. the 9 in the --log-fd example above). The use of a wrong number
caused at least one bug, in Massif.
- Updates all places where the macros were used.
- Updates Helgrind to use the *_CLO_* macros (it didn't use them).
- Updates Callgrind to use the *_CLO_* macros (it didn't use them), except
for the more esoteric option names (those with numbers in the option
name). This allowed getUInt() and getUWord() to be removed.
- Improves the cache option parsing in Cachegrind and Callgrind -- now uses
VG_(strtoll10)(), detects overflow, and is shorter.
- Uses INT instead of NUM in the macro names, to distinguish better vs. the
DBL macro.
- Removes VG_(atoll*) and the few remaining uses -- they're wretched
functions and VG_(strtoll*) should be used instead.
- Adds the VG_STREQN macro.
- Changes VG_BINT_CLO and VG_BHEX_CLO to abort if the given value is outside
the range -- the current silent truncation is likely to cause confusion as
much as anything.
Test files were being passed multiple arch options (eg. "-m32 -m64") when
built. This worked fine on the x86/Linux and AMD64/Linux but broke
ppc*/Linux. This commit fixes the problem. Thanks to Bart for spotting it.
Bart Van Assche [Sat, 21 Feb 2009 16:17:50 +0000 (16:17 +0000)]
- Bug fix: swapped order of VG_(OSetGen_Remove)() and
(*p->any.cleanup)(p) such that the "first observed at" information is
now included in error messages.
- Performance optimization: started using VG_(OSetGen_ResetIterAt)().
Bart Van Assche [Sat, 21 Feb 2009 15:27:04 +0000 (15:27 +0000)]
Changes:
- pthread_barrier_wait() intercept now passes the information to the DRD
tool whether or not this function returned
PTHREAD_BARRIER_SERIAL_THREAD. This information is now displayed when
the command-line option --trace-barrier=yes has been specified.
- Changed the cleanup functions for client objects that are called just
before a thread stops into callback functions.
- Added DRD_(clientobj_delete_thread)().
- Removed DRD_(clientobj_resetiter)(void) and DRD_(clientobj_next)().
- Added test for race conditions between pthread_barrier_wait() and
pthread_barrier_destroy() calls. An error message is now printed if
this condition has been detected.
- Bug fix: pthread_barrier_delete() calls on barriers being waited upon
are now reported.
- Removed DRD_() wrapper from around the name of some static variables and
functions.