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.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9330 a5019735-40e9-0310-863c-91ae7b9d1cf9
15 files changed