From 4e36be3285d9ec83c589a60cf7b364c86719e4d5 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 8 Mar 2012 14:59:25 +0000 Subject: [PATCH] When analyzing Valgrind with drd, suppress uninteresting race reports on VG_(threads)[].status git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12432 --- coregrind/m_main.c | 2 ++ coregrind/m_threadstate.c | 14 ++++++++++++++ coregrind/pub_core_threadstate.h | 3 +++ 3 files changed, 19 insertions(+) diff --git a/coregrind/m_main.c b/coregrind/m_main.c index f1ec4a6ab1..7bdb5bffdc 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -2003,6 +2003,8 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp ) VG_(printf_xml)( "\n" ); } + VG_(init_Threads)(); + //-------------------------------------------------------------- // Initialise the scheduler (phase 1) [generates tid_main] // p: none, afaics diff --git a/coregrind/m_threadstate.c b/coregrind/m_threadstate.c index d2f6acab4b..fb5bba9d39 100644 --- a/coregrind/m_threadstate.c +++ b/coregrind/m_threadstate.c @@ -33,6 +33,11 @@ #include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy #include "pub_core_threadstate.h" #include "pub_core_libcassert.h" +#include "pub_tool_inner.h" +#if defined(ENABLE_INNER_CLIENT_REQUEST) +#include "helgrind/helgrind.h" +#include "drd/drd.h" +#endif /*------------------------------------------------------------*/ /*--- Data structures. ---*/ @@ -46,6 +51,15 @@ ThreadState VG_(threads)[VG_N_THREADS]; /*--- Operations. ---*/ /*------------------------------------------------------------*/ +void VG_(init_Threads)(void) +{ + ThreadId tid; + + for (tid = 1; tid < VG_N_THREADS; tid++) + INNER_REQUEST(ANNOTATE_BENIGN_RACE_SIZED(&VG_(threads)[tid].status, + sizeof(VG_(threads)[tid].status), "")); +} + const HChar* VG_(name_of_ThreadStatus) ( ThreadStatus status ) { switch (status) { diff --git a/coregrind/pub_core_threadstate.h b/coregrind/pub_core_threadstate.h index e49926e129..4860bade88 100644 --- a/coregrind/pub_core_threadstate.h +++ b/coregrind/pub_core_threadstate.h @@ -373,6 +373,9 @@ extern ThreadId VG_(running_tid); /*--- Basic operations on the thread table. ---*/ /*------------------------------------------------------------*/ +/* Initialize the m_threadstate module. */ +void VG_(init_Threads)(void); + // Convert a ThreadStatus to a string. const HChar* VG_(name_of_ThreadStatus) ( ThreadStatus status ); -- 2.47.2