add heuristics decreasing false possible "possible leaks" in c++ code.

The option --leak-check-heuristics=heur1,heur2,... can activate
various heuristics to decrease the number of false positive
"possible leaks" for C++ code. The available heuristics are
detecting valid interior pointers to std::stdstring, to new[] allocated
arrays with elements having destructors and to interior pointers pointing
to an inner part of a C++ object using multiple inheritance.

This fixes 280271 Valgrind reports possible memory leaks on still-reachable
std::string 

This has been tested on x86/amd64/ppc32/ppc64.

First performance measurements seems to show a neglectible impact on
the leak search.

More feedback welcome both on performance and functional aspects
(false positive 'possibly leaked' rate decrease and/or 
false negative 'possibly leaked' rate increase).

Note that the heuristic is not checking that the memory has been
allocated with "new" or "new[]", as it is expected that in some cases,
specific alloc fn are used for c++ objects instead of the standard new/new[].
If needed, we might add an option to check the alloc functions
to be new/new[].



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13582 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/gdbserver_tests/mchelp.stdoutB.exp b/gdbserver_tests/mchelp.stdoutB.exp
index 0179b53..a2918fa 100644
--- a/gdbserver_tests/mchelp.stdoutB.exp
+++ b/gdbserver_tests/mchelp.stdoutB.exp
@@ -25,10 +25,12 @@
             and outputs a description of <addr>
   leak_check [full*|summary]
                 [kinds kind1,kind2,...|reachable|possibleleak*|definiteleak]
+                [heuristics heur1,heur2,...]
                 [increased*|changed|any]
                 [unlimited*|limited <max_loss_records_output>]
             * = defaults
         where kind is one of definite indirect possible reachable all none
+        where heur is one of stdstring newarray multipleinheritance all none
         Examples: leak_check
                   leak_check summary any
                   leak_check full kinds indirect,possible
@@ -78,10 +80,12 @@
             and outputs a description of <addr>
   leak_check [full*|summary]
                 [kinds kind1,kind2,...|reachable|possibleleak*|definiteleak]
+                [heuristics heur1,heur2,...]
                 [increased*|changed|any]
                 [unlimited*|limited <max_loss_records_output>]
             * = defaults
         where kind is one of definite indirect possible reachable all none
+        where heur is one of stdstring newarray multipleinheritance all none
         Examples: leak_check
                   leak_check summary any
                   leak_check full kinds indirect,possible