From: Bart Van Assche Date: Fri, 6 Jun 2014 07:23:06 +0000 (+0000) Subject: drd manual: Document how to avoid false positive reports on the C++11 std::thread... X-Git-Tag: svn/VALGRIND_3_10_0~438 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7be4916bc24b02930bfe40d211622986293eeb86;p=thirdparty%2Fvalgrind.git drd manual: Document how to avoid false positive reports on the C++11 std::thread class git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13998 --- diff --git a/drd/docs/drd-manual.xml b/drd/docs/drd-manual.xml index fcf769cc99..0fb8b4bfdc 100644 --- a/drd/docs/drd-manual.xml +++ b/drd/docs/drd-manual.xml @@ -1249,6 +1249,32 @@ before Valgrind's header files are available. + +Debugging C++11 Programs + +If you want to use the C++11 class std::thread you will need to add the +following code at the start of a common header or at the start of each source +file to avoid that false positives are reported on the std::thread +implementation: + + +#include <valgrind/drd.h> +#define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(addr) ANNOTATE_HAPPENS_BEFORE(addr) +#define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(addr) ANNOTATE_HAPPENS_AFTER(addr) +#define _GLIBCXX_EXTERN_TEMPLATE -1 + + +This code must occur before any C++ header files are included. Since the +implementation of std::thread uses the C++ shared pointer implementation, that +shared pointer implementation has to be annotated in order to avoid false +positives. The above code implements such annotation. See also The +GNU C++ Library Manual, Debugging Support +(http://gcc.gnu.org/onlinedocs/libstdc++/manual/debug.html) +for more information. + + + + Debugging GNOME Programs