|
From: <sv...@va...> - 2008-02-26 19:37:26
|
Author: sewardj
Date: 2008-02-26 19:37:27 +0000 (Tue, 26 Feb 2008)
New Revision: 7484
Log:
Make changes to improve robustness of these tests. Further changes
will be necessary.
Modified:
branches/DATASYMS/memcheck/tests/varinfo1.c
branches/DATASYMS/memcheck/tests/varinfo1.stderr.exp
branches/DATASYMS/memcheck/tests/varinfo2.c
branches/DATASYMS/memcheck/tests/varinfo2.stderr.exp
branches/DATASYMS/memcheck/tests/varinfo3.c
branches/DATASYMS/memcheck/tests/varinfo3.stderr.exp
branches/DATASYMS/memcheck/tests/varinfo4.c
branches/DATASYMS/memcheck/tests/varinfo4.stderr.exp
branches/DATASYMS/memcheck/tests/varinfo5so.c
branches/DATASYMS/memcheck/tests/varinfo6.c
branches/DATASYMS/memcheck/tests/varinfo6.stderr.exp
Modified: branches/DATASYMS/memcheck/tests/varinfo1.c
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo1.c 2008-02-26 19:13:04 UTC (rev 7483)
+++ branches/DATASYMS/memcheck/tests/varinfo1.c 2008-02-26 19:37:27 UTC (rev 7484)
@@ -18,11 +18,16 @@
its best guess as to what "a" actually is. a must be
addressible. */
-void croak ( void* a )
+void croak ( void* aV )
{
- volatile char undef;
- *(char*)a = undef;
+ char* a = (char*)aV;
+ char* undefp = malloc(1);
+ char saved = *a;
+ assert(undefp);
+ *a = *undefp;
VALGRIND_CHECK_MEM_IS_DEFINED(a, 1);
+ *a = saved;
+ free(undefp);
}
#include <stdio.h>
Modified: branches/DATASYMS/memcheck/tests/varinfo1.stderr.exp
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo1.stderr.exp 2008-02-26 19:13:04 UTC (rev 7483)
+++ branches/DATASYMS/memcheck/tests/varinfo1.stderr.exp 2008-02-26 19:37:27 UTC (rev 7484)
@@ -1,43 +1,43 @@
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo1.c:25)
- by 0x........: main (varinfo1.c:44)
+ at 0x........: croak (varinfo1.c:28)
+ by 0x........: main (varinfo1.c:49)
Address 0x........ is 1 bytes inside a block of size 3 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (varinfo1.c:42)
+ by 0x........: main (varinfo1.c:47)
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo1.c:25)
- by 0x........: main (varinfo1.c:47)
+ at 0x........: croak (varinfo1.c:28)
+ by 0x........: main (varinfo1.c:52)
Location 0x........ is 0 bytes inside global var "global_u1"
- declared at varinfo1.c:30
+ declared at varinfo1.c:35
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo1.c:25)
- by 0x........: main (varinfo1.c:48)
+ at 0x........: croak (varinfo1.c:28)
+ by 0x........: main (varinfo1.c:53)
Location 0x........ is 0 bytes inside global var "global_i1"
- declared at varinfo1.c:32
+ declared at varinfo1.c:37
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo1.c:25)
- by 0x........: main (varinfo1.c:49)
+ at 0x........: croak (varinfo1.c:28)
+ by 0x........: main (varinfo1.c:54)
Location 0x........ is 0 bytes inside global_u2[3],
- a global variable declared at varinfo1.c:34
+ a global variable declared at varinfo1.c:39
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo1.c:25)
- by 0x........: main (varinfo1.c:50)
+ at 0x........: croak (varinfo1.c:28)
+ by 0x........: main (varinfo1.c:55)
Location 0x........ is 0 bytes inside global_i2[7],
- a global variable declared at varinfo1.c:36
+ a global variable declared at varinfo1.c:41
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo1.c:25)
- by 0x........: main (varinfo1.c:51)
+ at 0x........: croak (varinfo1.c:28)
+ by 0x........: main (varinfo1.c:56)
Location 0x........ is 0 bytes inside local var "local"
- declared at varinfo1.c:41, in frame #1 of thread 1
+ declared at varinfo1.c:46, in frame #1 of thread 1
ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 0 from 0)
malloc/free: in use at exit: 0 bytes in 0 blocks.
-malloc/free: 1 allocs, 1 frees, 3 bytes allocated.
+malloc/free: 7 allocs, 7 frees, 9 bytes allocated.
For a detailed leak analysis, rerun with: --leak-check=yes
For counts of detected errors, rerun with: -v
Modified: branches/DATASYMS/memcheck/tests/varinfo2.c
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo2.c 2008-02-26 19:13:04 UTC (rev 7483)
+++ branches/DATASYMS/memcheck/tests/varinfo2.c 2008-02-26 19:37:27 UTC (rev 7484)
@@ -18,11 +18,16 @@
its best guess as to what "a" actually is. a must be
addressible. */
-void croak ( void* a )
+void croak ( void* aV )
{
- volatile char undef;
- *(char*)a = undef;
+ char* a = (char*)aV;
+ char* undefp = malloc(1);
+ char saved = *a;
+ assert(undefp);
+ *a = *undefp;
VALGRIND_CHECK_MEM_IS_DEFINED(a, 1);
+ *a = saved;
+ free(undefp);
}
#include <stdio.h>
Modified: branches/DATASYMS/memcheck/tests/varinfo2.stderr.exp
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo2.stderr.exp 2008-02-26 19:13:04 UTC (rev 7483)
+++ branches/DATASYMS/memcheck/tests/varinfo2.stderr.exp 2008-02-26 19:37:27 UTC (rev 7484)
@@ -1,27 +1,27 @@
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo2.c:25)
- by 0x........: foo (varinfo2.c:36)
- by 0x........: main (varinfo2.c:46)
+ at 0x........: croak (varinfo2.c:28)
+ by 0x........: foo (varinfo2.c:41)
+ by 0x........: main (varinfo2.c:51)
Location 0x........ is 0 bytes inside var[7],
- declared at varinfo2.c:34, in frame #1 of thread 1
+ declared at varinfo2.c:39, in frame #1 of thread 1
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo2.c:25)
- by 0x........: foo (varinfo2.c:38)
- by 0x........: main (varinfo2.c:46)
+ at 0x........: croak (varinfo2.c:28)
+ by 0x........: foo (varinfo2.c:43)
+ by 0x........: main (varinfo2.c:51)
Location 0x........ is 2 bytes inside var.bar,
- declared at varinfo2.c:37, in frame #1 of thread 1
+ declared at varinfo2.c:42, in frame #1 of thread 1
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo2.c:25)
- by 0x........: foo (varinfo2.c:41)
- by 0x........: main (varinfo2.c:46)
+ at 0x........: croak (varinfo2.c:28)
+ by 0x........: foo (varinfo2.c:46)
+ by 0x........: main (varinfo2.c:51)
Location 0x........ is 1 byte inside local var "var"
- declared at varinfo2.c:32, in frame #1 of thread 1
+ declared at varinfo2.c:37, in frame #1 of thread 1
ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
malloc/free: in use at exit: 0 bytes in 0 blocks.
-malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
+malloc/free: 3 allocs, 3 frees, 3 bytes allocated.
For a detailed leak analysis, rerun with: --leak-check=yes
For counts of detected errors, rerun with: -v
Modified: branches/DATASYMS/memcheck/tests/varinfo3.c
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo3.c 2008-02-26 19:13:04 UTC (rev 7483)
+++ branches/DATASYMS/memcheck/tests/varinfo3.c 2008-02-26 19:37:27 UTC (rev 7484)
@@ -18,11 +18,16 @@
its best guess as to what "a" actually is. a must be
addressible. */
-void croak ( void* a )
+void croak ( void* aV )
{
- volatile char undef;
- *(char*)a = undef;
+ char* a = (char*)aV;
+ char* undefp = malloc(1);
+ char saved = *a;
+ assert(undefp);
+ *a = *undefp;
VALGRIND_CHECK_MEM_IS_DEFINED(a, 1);
+ *a = saved;
+ free(undefp);
}
#include <stdio.h>
Modified: branches/DATASYMS/memcheck/tests/varinfo3.stderr.exp
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo3.stderr.exp 2008-02-26 19:13:04 UTC (rev 7483)
+++ branches/DATASYMS/memcheck/tests/varinfo3.stderr.exp 2008-02-26 19:37:27 UTC (rev 7484)
@@ -1,64 +1,64 @@
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo3.c:25)
- by 0x........: foo (varinfo3.c:49)
- by 0x........: main (varinfo3.c:61)
+ at 0x........: croak (varinfo3.c:28)
+ by 0x........: foo (varinfo3.c:54)
+ by 0x........: main (varinfo3.c:66)
Location 0x........ is 0 bytes inside static_global_def[1],
- declared at varinfo3.c:30, in frame #0 of thread 1
+ declared at varinfo3.c:35, in frame #0 of thread 1
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo3.c:25)
- by 0x........: foo (varinfo3.c:50)
- by 0x........: main (varinfo3.c:61)
+ at 0x........: croak (varinfo3.c:28)
+ by 0x........: foo (varinfo3.c:55)
+ by 0x........: main (varinfo3.c:66)
Location 0x........ is 0 bytes inside nonstatic_global_def[2],
- a global variable declared at varinfo3.c:31
+ a global variable declared at varinfo3.c:36
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo3.c:25)
- by 0x........: foo (varinfo3.c:51)
- by 0x........: main (varinfo3.c:61)
+ at 0x........: croak (varinfo3.c:28)
+ by 0x........: foo (varinfo3.c:56)
+ by 0x........: main (varinfo3.c:66)
Location 0x........ is 0 bytes inside static_global_undef[3],
- declared at varinfo3.c:32, in frame #0 of thread 1
+ declared at varinfo3.c:37, in frame #0 of thread 1
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo3.c:25)
- by 0x........: foo (varinfo3.c:52)
- by 0x........: main (varinfo3.c:61)
+ at 0x........: croak (varinfo3.c:28)
+ by 0x........: foo (varinfo3.c:57)
+ by 0x........: main (varinfo3.c:66)
Location 0x........ is 0 bytes inside nonstatic_global_undef[4],
- a global variable declared at varinfo3.c:33
+ a global variable declared at varinfo3.c:38
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo3.c:25)
- by 0x........: bar (varinfo3.c:37)
- by 0x........: foo (varinfo3.c:53)
- by 0x........: main (varinfo3.c:61)
- Address 0x........ is 5 bytes inside data symbol "static_local_def.2751"
+ at 0x........: croak (varinfo3.c:28)
+ by 0x........: bar (varinfo3.c:42)
+ by 0x........: foo (varinfo3.c:58)
+ by 0x........: main (varinfo3.c:66)
+ Address 0x........ is 5 bytes inside data symbol "static_local_def.2919"
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo3.c:25)
- by 0x........: bar (varinfo3.c:38)
- by 0x........: foo (varinfo3.c:53)
- by 0x........: main (varinfo3.c:61)
+ at 0x........: croak (varinfo3.c:28)
+ by 0x........: bar (varinfo3.c:43)
+ by 0x........: foo (varinfo3.c:58)
+ by 0x........: main (varinfo3.c:66)
Location 0x........ is 0 bytes inside nonstatic_local_def[6],
- declared at varinfo3.c:46, in frame #2 of thread 1
+ declared at varinfo3.c:51, in frame #2 of thread 1
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo3.c:25)
- by 0x........: bar (varinfo3.c:39)
- by 0x........: foo (varinfo3.c:53)
- by 0x........: main (varinfo3.c:61)
- Address 0x........ is 7 bytes inside data symbol "static_local_undef.2753"
+ at 0x........: croak (varinfo3.c:28)
+ by 0x........: bar (varinfo3.c:44)
+ by 0x........: foo (varinfo3.c:58)
+ by 0x........: main (varinfo3.c:66)
+ Address 0x........ is 7 bytes inside data symbol "static_local_undef.2921"
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo3.c:25)
- by 0x........: bar (varinfo3.c:40)
- by 0x........: foo (varinfo3.c:53)
- by 0x........: main (varinfo3.c:61)
+ at 0x........: croak (varinfo3.c:28)
+ by 0x........: bar (varinfo3.c:45)
+ by 0x........: foo (varinfo3.c:58)
+ by 0x........: main (varinfo3.c:66)
Location 0x........ is 0 bytes inside nonstatic_local_undef[8],
- declared at varinfo3.c:48, in frame #2 of thread 1
+ declared at varinfo3.c:53, in frame #2 of thread 1
ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0)
malloc/free: in use at exit: 0 bytes in 0 blocks.
-malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
+malloc/free: 8 allocs, 8 frees, 8 bytes allocated.
For a detailed leak analysis, rerun with: --leak-check=yes
For counts of detected errors, rerun with: -v
Modified: branches/DATASYMS/memcheck/tests/varinfo4.c
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo4.c 2008-02-26 19:13:04 UTC (rev 7483)
+++ branches/DATASYMS/memcheck/tests/varinfo4.c 2008-02-26 19:37:27 UTC (rev 7484)
@@ -18,11 +18,16 @@
its best guess as to what "a" actually is. a must be
addressible. */
-void croak ( void* a )
+void croak ( void* aV )
{
- volatile char undef;
- *(char*)a = undef;
+ char* a = (char*)aV;
+ char* undefp = malloc(1);
+ char saved = *a;
+ assert(undefp);
+ *a = *undefp;
VALGRIND_CHECK_MEM_IS_DEFINED(a, 1);
+ *a = saved;
+ free(undefp);
}
#include <stdio.h>
Modified: branches/DATASYMS/memcheck/tests/varinfo4.stderr.exp
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo4.stderr.exp 2008-02-26 19:13:04 UTC (rev 7483)
+++ branches/DATASYMS/memcheck/tests/varinfo4.stderr.exp 2008-02-26 19:37:27 UTC (rev 7484)
@@ -1,27 +1,27 @@
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo4.c:25)
- by 0x........: blah (varinfo4.c:42)
- by 0x........: main (varinfo4.c:51)
+ at 0x........: croak (varinfo4.c:28)
+ by 0x........: blah (varinfo4.c:47)
+ by 0x........: main (varinfo4.c:56)
Location 0x........ is 1 byte inside a[3].xyzzy[21].c1,
- declared at varinfo4.c:40, in frame #1 of thread 1
+ declared at varinfo4.c:45, in frame #1 of thread 1
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo4.c:25)
- by 0x........: blah (varinfo4.c:43)
- by 0x........: main (varinfo4.c:51)
+ at 0x........: croak (varinfo4.c:28)
+ by 0x........: blah (varinfo4.c:48)
+ by 0x........: main (varinfo4.c:56)
Location 0x........ is 0 bytes inside a[5].bong,
- declared at varinfo4.c:40, in frame #1 of thread 1
+ declared at varinfo4.c:45, in frame #1 of thread 1
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo4.c:25)
- by 0x........: blah (varinfo4.c:44)
- by 0x........: main (varinfo4.c:51)
+ at 0x........: croak (varinfo4.c:28)
+ by 0x........: blah (varinfo4.c:49)
+ by 0x........: main (varinfo4.c:56)
Location 0x........ is 1 byte inside a[3].xyzzy[21].c2[2],
- declared at varinfo4.c:40, in frame #1 of thread 1
+ declared at varinfo4.c:45, in frame #1 of thread 1
ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
malloc/free: in use at exit: 0 bytes in 0 blocks.
-malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
+malloc/free: 3 allocs, 3 frees, 3 bytes allocated.
For a detailed leak analysis, rerun with: --leak-check=yes
For counts of detected errors, rerun with: -v
Modified: branches/DATASYMS/memcheck/tests/varinfo5so.c
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo5so.c 2008-02-26 19:13:04 UTC (rev 7483)
+++ branches/DATASYMS/memcheck/tests/varinfo5so.c 2008-02-26 19:37:27 UTC (rev 7484)
@@ -25,7 +25,7 @@
char* undefp = malloc(1);
char saved = *a;
assert(undefp);
- *(char*)a = *undefp;
+ *a = *undefp;
VALGRIND_CHECK_MEM_IS_DEFINED(a, 1);
*a = saved;
free(undefp);
Modified: branches/DATASYMS/memcheck/tests/varinfo6.c
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo6.c 2008-02-26 19:13:04 UTC (rev 7483)
+++ branches/DATASYMS/memcheck/tests/varinfo6.c 2008-02-26 19:37:27 UTC (rev 7484)
@@ -1,4 +1,12 @@
+/* Test the variable identification machinery in a non-toy sized
+ program. Also, the croak() call in BZ2_decompress causes Valgrind
+ to try to describe a local variable (i) that has at least a dozen
+ independent live ranges (hence, is really that many independent
+ variables). Hence it tests the machinery's ability to correctly
+ handle a variable which has multiple live ranges and hence multiple
+ non-overlapping areas in which it actually exists.
+*/
/* Relevant compile flags are:
@@ -16,16 +24,18 @@
its best guess as to what "a" actually is. a must be
addressible. */
-void croak ( void* a )
+void croak ( void* aV )
{
- volatile char saved = *(char*)a;
- volatile char undef;
- *(char*)a = undef;
+ char* a = (char*)aV;
+ char* undefp = malloc(1);
+ char saved = *a;
+ assert(undefp);
+ *a = *undefp;
VALGRIND_CHECK_MEM_IS_DEFINED(a, 1);
- *(char*)a = saved;
+ *a = saved;
+ free(undefp);
}
-
// This benchmark is basically bzip2 (mashed to be a single file)
// compressing and decompressing some data. It tests Valgrind's handling of
// realistic and "difficult" (ie. lots of branches and memory accesses)
@@ -2810,7 +2820,7 @@
#define SETMASK (1 << 21)
#define CLEARMASK (~(SETMASK))
-static __attribute__((noinline))
+/*static*/ __attribute__((noinline))
void mainSort ( UInt32* ptr,
UChar* block,
UInt16* quadrant,
@@ -3092,6 +3102,7 @@
ftab [ 0 .. 65536 ] destroyed
arr1 [0 .. nblock-1] holds sorted order
*/
+__attribute__((noinline))
void BZ2_blockSort ( EState* s )
{
UInt32* ptr = s->ptr;
@@ -4043,6 +4054,7 @@
/*---------------------------------------------------*/
+__attribute__((noinline))
void BZ2_compressBlock ( EState* s, Bool is_last_block )
{
if (s->nblock > 0) {
Modified: branches/DATASYMS/memcheck/tests/varinfo6.stderr.exp
===================================================================
--- branches/DATASYMS/memcheck/tests/varinfo6.stderr.exp 2008-02-26 19:13:04 UTC (rev 7483)
+++ branches/DATASYMS/memcheck/tests/varinfo6.stderr.exp 2008-02-26 19:37:27 UTC (rev 7484)
@@ -1,27 +1,27 @@
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo6.c:24)
- by 0x........: mainSort (varinfo6.c:2989)
- by 0x........: BZ2_blockSort (varinfo6.c:3132)
- by 0x........: BZ2_compressBlock (varinfo6.c:4060)
- by 0x........: handle_compress (varinfo6.c:4778)
- by 0x........: BZ2_bzCompress (varinfo6.c:4848)
- by 0x........: BZ2_bzBuffToBuffCompress (varinfo6.c:5655)
- by 0x........: main (varinfo6.c:6505)
+ at 0x........: croak (varinfo6.c:34)
+ by 0x........: mainSort (varinfo6.c:2999)
+ by 0x........: BZ2_blockSort (varinfo6.c:3143)
+ by 0x........: BZ2_compressBlock (varinfo6.c:4072)
+ by 0x........: handle_compress (varinfo6.c:4790)
+ by 0x........: BZ2_bzCompress (varinfo6.c:4860)
+ by 0x........: BZ2_bzBuffToBuffCompress (varinfo6.c:5667)
+ by 0x........: main (varinfo6.c:6517)
Location 0x........ is 2 bytes inside local var "budget"
- declared at varinfo6.c:3104, in frame #2 of thread 1
+ declared at varinfo6.c:3115, in frame #2 of thread 1
Uninitialised byte(s) found during client check request
- at 0x........: croak (varinfo6.c:24)
- by 0x........: BZ2_decompress (varinfo6.c:1689)
- by 0x........: BZ2_bzDecompress (varinfo6.c:5218)
- by 0x........: BZ2_bzBuffToBuffDecompress (varinfo6.c:5703)
- by 0x........: main (varinfo6.c:6520)
+ at 0x........: croak (varinfo6.c:34)
+ by 0x........: BZ2_decompress (varinfo6.c:1699)
+ by 0x........: BZ2_bzDecompress (varinfo6.c:5230)
+ by 0x........: BZ2_bzBuffToBuffDecompress (varinfo6.c:5715)
+ by 0x........: main (varinfo6.c:6532)
Location 0x........ is 2 bytes inside local var "i"
- declared at varinfo6.c:1507, in frame #1 of thread 1
+ declared at varinfo6.c:1517, in frame #1 of thread 1
ERROR SUMMARY: 10216 errors from 2 contexts (suppressed: 0 from 0)
malloc/free: in use at exit: 0 bytes in 0 blocks.
-malloc/free: 37 allocs, 37 frees, 24,358,500 bytes allocated.
+malloc/free: 10,253 allocs, 10,253 frees, 24,368,716 bytes allocated.
For a detailed leak analysis, rerun with: --leak-check=yes
For counts of detected errors, rerun with: -v
|