]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
drd: Don't complain about stack variables that are shared over threads. Closes #297147
authorBart Van Assche <bvanassche@acm.org>
Sun, 1 Apr 2012 14:40:16 +0000 (14:40 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 1 Apr 2012 14:40:16 +0000 (14:40 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12474

drd/drd_load_store.c
drd/tests/hg05_race2.stderr.exp
drd/tests/hg05_race2.stderr.exp-powerpc [deleted file]

index b60ea93487f24f18caf79024acfe59f5ed747a92..6eae573b39623a0c1f5a76cb6d90e7dbcd04050a 100644 (file)
@@ -137,21 +137,32 @@ static VG_REGPARM(3) void drd_trace_mem_store(const Addr addr,const SizeT size,
 static void drd_report_race(const Addr addr, const SizeT size,
                             const BmAccessTypeT access_type)
 {
-   DataRaceErrInfo drei;
-
-   drei.tid  = DRD_(thread_get_running_tid)();
-   drei.addr = addr;
-   drei.size = size;
-   drei.access_type = access_type;
-   VG_(maybe_record_error)(VG_(get_running_tid)(),
-                           DataRaceErr,
-                           VG_(get_IP)(VG_(get_running_tid)()),
-                           "Conflicting access",
-                           &drei);
-
-   if (s_first_race_only)
-   {
-      DRD_(start_suppression)(addr, addr + size, "first race only");
+   ThreadId vg_tid;
+
+   vg_tid = VG_(get_running_tid)();
+   if (DRD_(thread_address_on_any_stack)(addr)) {
+#if 0
+      GenericErrInfo GEI = {
+         .tid = DRD_(thread_get_running_tid)(),
+         .addr = addr,
+      };
+      VG_(maybe_record_error)(vg_tid, GenericErr, VG_(get_IP)(vg_tid),
+                              "--check-stack-var=no skips checking stack"
+                              " variables shared over threads",
+                              &GEI);
+#endif
+  } else {
+      DataRaceErrInfo drei = {
+         .tid  = DRD_(thread_get_running_tid)(),
+         .addr = addr,
+         .size = size,
+         .access_type = access_type,
+      };
+      VG_(maybe_record_error)(vg_tid, DataRaceErr, VG_(get_IP)(vg_tid),
+                              "Conflicting access", &drei);
+
+      if (s_first_race_only)
+         DRD_(start_suppression)(addr, addr + size, "first race only");
    }
 }
 
index f9a47f41688894b2c342ad19b70c98264ad5a600..d18786f80668a209115b4a13cf5e8afa8d9cd471 100644 (file)
@@ -1,24 +1,3 @@
 
-Thread 3:
-Conflicting load by thread 3 at 0x........ size 4
-   at 0x........: th (hg05_race2.c:17)
-   by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
-Location 0x........ is 0 bytes inside foo.poot[5].plop[11],
-declared at hg05_race2.c:24, in frame #? of thread 1
-Other segment start (thread 2)
-   (thread finished, call stack no longer available)
-Other segment end (thread 2)
-   (thread finished, call stack no longer available)
 
-Conflicting store by thread 3 at 0x........ size 4
-   at 0x........: th (hg05_race2.c:17)
-   by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
-Location 0x........ is 0 bytes inside foo.poot[5].plop[11],
-declared at hg05_race2.c:24, in frame #? of thread 1
-Other segment start (thread 2)
-   (thread finished, call stack no longer available)
-Other segment end (thread 2)
-   (thread finished, call stack no longer available)
-
-
-ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
diff --git a/drd/tests/hg05_race2.stderr.exp-powerpc b/drd/tests/hg05_race2.stderr.exp-powerpc
deleted file mode 100644 (file)
index e38c7ea..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-
-Thread 3:
-Conflicting load by thread 3 at 0x........ size 4
-   at 0x........: th (hg05_race2.c:17)
-   by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
-Allocation context: unknown.
-Other segment start (thread 2)
-   (thread finished, call stack no longer available)
-Other segment end (thread 2)
-   (thread finished, call stack no longer available)
-
-Conflicting store by thread 3 at 0x........ size 4
-   at 0x........: th (hg05_race2.c:17)
-   by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
-Allocation context: unknown.
-Other segment start (thread 2)
-   (thread finished, call stack no longer available)
-Other segment end (thread 2)
-   (thread finished, call stack no longer available)
-
-
-ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)