]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
DRD: make the tracing regression test more complete
authorBart Van Assche <bvanassche@acm.org>
Mon, 12 Dec 2011 19:37:10 +0000 (19:37 +0000)
committerBart Van Assche <bvanassche@acm.org>
Mon, 12 Dec 2011 19:37:10 +0000 (19:37 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12298

drd/drd_load_store.c
drd/tests/Makefile.am
drd/tests/annotate_trace_memory.c [new file with mode: 0644]
drd/tests/annotate_trace_memory.stderr.exp
drd/tests/annotate_trace_memory.vgtest
drd/tests/annotate_trace_memory_xml.stderr.exp
drd/tests/annotate_trace_memory_xml.vgtest

index e5f2cc4645ac2f85c2fbdc520e1c5fcaa5e6c871..2798e7c66e91e9e151be7c61e15a99f43efb34fa 100644 (file)
@@ -94,8 +94,8 @@ void DRD_(trace_mem_access)(const Addr addr, const SizeT size,
 
       vc = DRD_(vc_aprint)(DRD_(thread_get_vc)(DRD_(thread_get_running_tid)()));
       if (access_type == eStore && size <= sizeof(HWord)) {
-         DRD_(trace_msg_w_bt)("store 0x%lx size %ld val 0x%lx (thread %d /"
-                              " vc %s)", addr, size, stored_value,
+         DRD_(trace_msg_w_bt)("store 0x%lx size %ld val %ld/0x%lx (thread %d /"
+                              " vc %s)", addr, size, stored_value, stored_value,
                               DRD_(thread_get_running_tid)(), vc);
       } else {
          DRD_(trace_msg_w_bt)("%s 0x%lx size %ld (thread %d / vc %s)",
index f778d82871a0dc6dad898b9238f35835afd4bd20..8c0c6c1183893845a4ee66f1f6178e68f5973719 100644 (file)
@@ -337,6 +337,7 @@ if HAVE_BUILTIN_ATOMIC
 check_PROGRAMS +=        \
   annotate_barrier       \
   annotate_rwlock        \
+  annotate_trace_memory  \
   atomic_var             \
   circular_buffer
 endif
diff --git a/drd/tests/annotate_trace_memory.c b/drd/tests/annotate_trace_memory.c
new file mode 100644 (file)
index 0000000..232506a
--- /dev/null
@@ -0,0 +1,49 @@
+#include <stdio.h>
+#include <inttypes.h>
+#include "../../drd/drd.h"
+
+volatile float   f;
+volatile double  d;
+volatile int8_t  i8;
+volatile int16_t i16;
+volatile int32_t i32;
+volatile int64_t i64;
+
+int main(int argc, char** argv)
+{
+  DRD_TRACE_VAR(f);
+  DRD_TRACE_VAR(d);
+  DRD_TRACE_VAR(i8);
+  DRD_TRACE_VAR(i16);
+  DRD_TRACE_VAR(i32);
+  DRD_TRACE_VAR(i64);
+
+  fprintf(stderr, "float\n");
+  f = 1;
+  f += 2;
+  fprintf(stderr, "double\n");
+  d = 3;
+  d += 4;
+  fprintf(stderr, "uint8_t\n");
+  i8 = 5;
+  i8 += 6;
+  fprintf(stderr, "uint16_t\n");
+  i16 = 7;
+  i16++;
+  fprintf(stderr, "uint32_t\n");
+  i32 = 8;
+  __sync_add_and_fetch(&i32, 1);
+  fprintf(stderr, "uint64_t\n");
+  i64 = 9;
+  __sync_add_and_fetch(&i64, 0x12345678ULL);
+
+  DRD_STOP_TRACE_VAR(f);
+  DRD_STOP_TRACE_VAR(d);
+  DRD_STOP_TRACE_VAR(i8);
+  DRD_STOP_TRACE_VAR(i16);
+  DRD_STOP_TRACE_VAR(i32);
+  DRD_STOP_TRACE_VAR(i64);
+
+  fprintf(stderr, "Done.\n");
+  return 0;
+}
index fc74e285e2d0f0bd392f59d31bc9d62627cbfaeb..fe851323ab92d573a58da8e96ab9855a00cb1667 100644 (file)
@@ -1,20 +1,46 @@
 
-FLAGS [phb=1, fm=0]
-test01: positive
-store 0x........ size 4 val 0x........ (thread x / vc ...)
-   at 0x........: test01::Worker() (tsan_unittest.cpp:?)
-   by 0x........: MyThread::ThreadBody(MyThread*) (tsan_thread_wrappers_pthread.h:?)
-store 0x........ size 4 val 0x........ (thread x / vc ...)
-   at 0x........: test01::Parent() (tsan_unittest.cpp:?)
-   by 0x........: test01::Run() (tsan_unittest.cpp:?)
-Conflicting store by thread x at 0x........ size 4
-   at 0x........: test01::Parent() (tsan_unittest.cpp:?)
-   by 0x........: test01::Run() (tsan_unittest.cpp:?)
-Allocation context: BSS section of tsan_unittest
-
+float
+store 0x........ size 4 val 1065353216/0x........ (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+load  0x........ size 4 (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+store 0x........ size 4 val 1077936128/0x........ (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+double
+store 0x........ size 8 val 4613937818241073152/0x........ (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+load  0x........ size 8 (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+store 0x........ size 8 val 4619567317775286272/0x........ (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+uint8_t
+store 0x........ size 1 val 5/0x........ (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+load  0x........ size 1 (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+store 0x........ size 1 val 11/0x........ (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+uint16_t
+store 0x........ size 2 val 7/0x........ (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+load  0x........ size 2 (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+store 0x........ size 2 val 8/0x........ (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+uint32_t
+store 0x........ size 4 val 8/0x........ (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
 load  0x........ size 4 (thread x / vc ...)
-   at 0x........: test01::Run() (tsan_unittest.cpp:?)
-   by 0x........: Test::Run() (tsan_unittest.cpp:?)
-       GLOB=2
+   at 0x........: main (annotate_trace_memory.c:?)
+store 0x........ size 4 val 9/0x........ (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+uint64_t
+store 0x........ size 8 val 9/0x........ (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+load  0x........ size 8 (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+store 0x........ size 8 val 305419905/0x........ (thread x / vc ...)
+   at 0x........: main (annotate_trace_memory.c:?)
+Done.
 
-ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
index e7d23e25b948c5a7c57b200134b2e561f8ce7e10..20d5a518aa0f7539096e6f3f35f0958a911352b0 100644 (file)
@@ -1,5 +1,4 @@
-prereq: test -e tsan_unittest && ./supported_libpthread
+prereq: test -e annotate_trace_memory && ./supported_libpthread
 vgopts: --read-var-info=yes --check-stack-var=yes --show-confl-seg=no --num-callers=2
-prog: tsan_unittest
-args: 1
+prog: annotate_trace_memory
 stderr_filter: filter_stderr_and_thread_no
index 7602a0e0d7d128dd9d6f6040d94f4f149e770525..8a62b6c460fbdad75542375fc117c10c8f982a11 100644 (file)
@@ -19,8 +19,7 @@
 <args>
   <vargv>...</vargv>
   <argv>
-    <exe>./tsan_unittest</exe>
-    <arg>1</arg>
+    <exe>./annotate_trace_memory</exe>
   </argv>
 </args>
 
   <time>...</time>
 </status>
 
-FLAGS [phb=1, fm=0]
-test01: positive
-  <trace><text>store 0x........ size 4 val 0x........ (thread x / vc ...)</text>
+float
+  <trace><text>store 0x........ size 4 val 1065353216/0x........ (thread x / vc ...)</text>
   <stack>
     <frame>
       <ip>0x........</ip>
       <obj>...</obj>
-      <fn>test01::Worker()</fn>
+      <fn>main</fn>
       <dir>...</dir>
-      <file>tsan_unittest.cpp</file>
+      <file>annotate_trace_memory.c</file>
       <line>...</line>
     </frame>
+  </stack>
+  </trace>
+  <trace><text>load  0x........ size 4 (thread x / vc ...)</text>
+  <stack>
     <frame>
       <ip>0x........</ip>
       <obj>...</obj>
-      <fn>MyThread::ThreadBody(MyThread*)</fn>
+      <fn>main</fn>
       <dir>...</dir>
-      <file>tsan_thread_wrappers_pthread.h</file>
+      <file>annotate_trace_memory.c</file>
       <line>...</line>
     </frame>
   </stack>
   </trace>
-  <trace><text>store 0x........ size 4 val 0x........ (thread x / vc ...)</text>
+  <trace><text>store 0x........ size 4 val 1077936128/0x........ (thread x / vc ...)</text>
   <stack>
     <frame>
       <ip>0x........</ip>
       <obj>...</obj>
-      <fn>test01::Parent()</fn>
+      <fn>main</fn>
       <dir>...</dir>
-      <file>tsan_unittest.cpp</file>
+      <file>annotate_trace_memory.c</file>
       <line>...</line>
     </frame>
+  </stack>
+  </trace>
+double
+  <trace><text>store 0x........ size 8 val 4613937818241073152/0x........ (thread x / vc ...)</text>
+  <stack>
     <frame>
       <ip>0x........</ip>
       <obj>...</obj>
-      <fn>test01::Run()</fn>
+      <fn>main</fn>
       <dir>...</dir>
-      <file>tsan_unittest.cpp</file>
+      <file>annotate_trace_memory.c</file>
       <line>...</line>
     </frame>
   </stack>
   </trace>
-<error>
-  <unique>0x........</unique>
-  <tid>...</tid>
-  <kind>ConflictingAccess</kind>
-  <what>Conflicting store by thread x at 0x........ size 4</what>
+  <trace><text>load  0x........ size 8 (thread x / vc ...)</text>
   <stack>
     <frame>
       <ip>0x........</ip>
       <obj>...</obj>
-      <fn>test01::Parent()</fn>
+      <fn>main</fn>
       <dir>...</dir>
-      <file>tsan_unittest.cpp</file>
+      <file>annotate_trace_memory.c</file>
       <line>...</line>
     </frame>
+  </stack>
+  </trace>
+  <trace><text>store 0x........ size 8 val 4619567317775286272/0x........ (thread x / vc ...)</text>
+  <stack>
     <frame>
       <ip>0x........</ip>
       <obj>...</obj>
-      <fn>test01::Run()</fn>
+      <fn>main</fn>
       <dir>...</dir>
-      <file>tsan_unittest.cpp</file>
+      <file>annotate_trace_memory.c</file>
       <line>...</line>
     </frame>
   </stack>
-  <auxwhat>Allocation context: BSS section of tsan_unittest</auxwhat>
-</error>
-
+  </trace>
+uint8_t
+  <trace><text>store 0x........ size 1 val 5/0x........ (thread x / vc ...)</text>
+  <stack>
+    <frame>
+      <ip>0x........</ip>
+      <obj>...</obj>
+      <fn>main</fn>
+      <dir>...</dir>
+      <file>annotate_trace_memory.c</file>
+      <line>...</line>
+    </frame>
+  </stack>
+  </trace>
+  <trace><text>load  0x........ size 1 (thread x / vc ...)</text>
+  <stack>
+    <frame>
+      <ip>0x........</ip>
+      <obj>...</obj>
+      <fn>main</fn>
+      <dir>...</dir>
+      <file>annotate_trace_memory.c</file>
+      <line>...</line>
+    </frame>
+  </stack>
+  </trace>
+  <trace><text>store 0x........ size 1 val 11/0x........ (thread x / vc ...)</text>
+  <stack>
+    <frame>
+      <ip>0x........</ip>
+      <obj>...</obj>
+      <fn>main</fn>
+      <dir>...</dir>
+      <file>annotate_trace_memory.c</file>
+      <line>...</line>
+    </frame>
+  </stack>
+  </trace>
+uint16_t
+  <trace><text>store 0x........ size 2 val 7/0x........ (thread x / vc ...)</text>
+  <stack>
+    <frame>
+      <ip>0x........</ip>
+      <obj>...</obj>
+      <fn>main</fn>
+      <dir>...</dir>
+      <file>annotate_trace_memory.c</file>
+      <line>...</line>
+    </frame>
+  </stack>
+  </trace>
+  <trace><text>load  0x........ size 2 (thread x / vc ...)</text>
+  <stack>
+    <frame>
+      <ip>0x........</ip>
+      <obj>...</obj>
+      <fn>main</fn>
+      <dir>...</dir>
+      <file>annotate_trace_memory.c</file>
+      <line>...</line>
+    </frame>
+  </stack>
+  </trace>
+  <trace><text>store 0x........ size 2 val 8/0x........ (thread x / vc ...)</text>
+  <stack>
+    <frame>
+      <ip>0x........</ip>
+      <obj>...</obj>
+      <fn>main</fn>
+      <dir>...</dir>
+      <file>annotate_trace_memory.c</file>
+      <line>...</line>
+    </frame>
+  </stack>
+  </trace>
+uint32_t
+  <trace><text>store 0x........ size 4 val 8/0x........ (thread x / vc ...)</text>
+  <stack>
+    <frame>
+      <ip>0x........</ip>
+      <obj>...</obj>
+      <fn>main</fn>
+      <dir>...</dir>
+      <file>annotate_trace_memory.c</file>
+      <line>...</line>
+    </frame>
+  </stack>
+  </trace>
   <trace><text>load  0x........ size 4 (thread x / vc ...)</text>
   <stack>
     <frame>
       <ip>0x........</ip>
       <obj>...</obj>
-      <fn>test01::Run()</fn>
+      <fn>main</fn>
+      <dir>...</dir>
+      <file>annotate_trace_memory.c</file>
+      <line>...</line>
+    </frame>
+  </stack>
+  </trace>
+  <trace><text>store 0x........ size 4 val 9/0x........ (thread x / vc ...)</text>
+  <stack>
+    <frame>
+      <ip>0x........</ip>
+      <obj>...</obj>
+      <fn>main</fn>
+      <dir>...</dir>
+      <file>annotate_trace_memory.c</file>
+      <line>...</line>
+    </frame>
+  </stack>
+  </trace>
+uint64_t
+  <trace><text>store 0x........ size 8 val 9/0x........ (thread x / vc ...)</text>
+  <stack>
+    <frame>
+      <ip>0x........</ip>
+      <obj>...</obj>
+      <fn>main</fn>
       <dir>...</dir>
-      <file>tsan_unittest.cpp</file>
+      <file>annotate_trace_memory.c</file>
       <line>...</line>
     </frame>
+  </stack>
+  </trace>
+  <trace><text>load  0x........ size 8 (thread x / vc ...)</text>
+  <stack>
+    <frame>
+      <ip>0x........</ip>
+      <obj>...</obj>
+      <fn>main</fn>
+      <dir>...</dir>
+      <file>annotate_trace_memory.c</file>
+      <line>...</line>
+    </frame>
+  </stack>
+  </trace>
+  <trace><text>store 0x........ size 8 val 305419905/0x........ (thread x / vc ...)</text>
+  <stack>
     <frame>
       <ip>0x........</ip>
       <obj>...</obj>
-      <fn>Test::Run()</fn>
+      <fn>main</fn>
       <dir>...</dir>
-      <file>tsan_unittest.cpp</file>
+      <file>annotate_trace_memory.c</file>
       <line>...</line>
     </frame>
   </stack>
   </trace>
-       GLOB=2
+Done.
 
 <status>
   <state>FINISHED</state>
@@ -125,10 +258,6 @@ test01: positive
 </status>
 
 <errorcounts>
-  <pair>
-    <count>...</count>
-    <unique>0x........</unique>
-  </pair>
 </errorcounts>
 
 <suppcounts>...</suppcounts>
index c5aaaa551602da18533769629b2acb9dd806f6e5..48da0cb4bdb25a9a5942061ee3be30ca71dcde08 100644 (file)
@@ -1,5 +1,4 @@
-prereq: test -e tsan_unittest && ./supported_libpthread
+prereq: test -e annotate_trace_memory && ./supported_libpthread
 vgopts: --read-var-info=yes --check-stack-var=yes --show-confl-seg=no --num-callers=2 --xml=yes --xml-fd=2
-prog: tsan_unittest
-args: 1
+prog: annotate_trace_memory
 stderr_filter: ./filter_xml_and_thread_no