806 Commits

Author SHA1 Message Date
Bart Van Assche
39c447e4a9 Merge mc_replace_strmem.c, hg_intercepts.c and drd_strmem_intercepts.c
Move memcheck/mc_replace_strmem.c to shared/vg_replace_strmem.c and
add several intercepts for SSE-variants. Include that source file from
drd/drd_strmem_intercepts.c, helgrind/hg_intercepts.c and
memcheck/mc_replace_strmem.c.

Merge memcheck/tests/filter_memcpy into tests/filter_stderr_basic.
    
Update tests/check_headers_and_includes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13719
2013-11-24 17:48:13 +00:00
Bart Van Assche
e8ec2e8d5e drd: Add three additional strncpy() and strncmp() intercepts (#326816)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13706
2013-10-29 20:49:16 +00:00
Bart Van Assche
29032f4b6e drd: Add strncpy() and strncmp() intercepts (#326816)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13705
2013-10-29 17:16:47 +00:00
Bart Van Assche
906cc893d5 drd: Add strstr() intercept (#326623)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13699
2013-10-25 16:51:21 +00:00
Bart Van Assche
12a1867bda drd: Add range support for --ptrace-addr
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13698
2013-10-25 14:26:14 +00:00
Bart Van Assche
d8d62e85f5 drd: Add a test for the strmem intercepts
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13697
2013-10-25 12:30:46 +00:00
Bart Van Assche
635f963b8c drd: Add strrchr(), memchr(), memrchr() and memcmp() intercepts (#326623)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13696
2013-10-25 12:08:36 +00:00
Bart Van Assche
1b09dba092 drd: Add stpcpy() intercept (#326436)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13694
2013-10-24 10:01:45 +00:00
Bart Van Assche
af6922c039 drd: Add additional strchr(), strcpy() and strcmp() intercepts (#326436)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13686
2013-10-23 13:09:10 +00:00
Bart Van Assche
86ed37d6f5 drd/tests: Add std_list and std_string test programs
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13680
2013-10-23 12:37:44 +00:00
Bart Van Assche
9d13fe8a66 drd: Add strchr(), strcpy(), strcmp() and memcpy() intercepts (#326436)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13679
2013-10-23 12:19:30 +00:00
Bart Van Assche
f82cf02f0a drd: Avoid that optimized strlen() implementations trigger false positive race reports (#326091)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13664
2013-10-20 08:23:38 +00:00
Julian Seward
dbf9b63605 Update copyright dates (20XY-2012 ==> 20XY-2013)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13658
2013-10-18 14:27:36 +00:00
Philippe Waroquiers
619be966db Allow tools to provide some statistics in suppression list produced at the end
Option -v outputs a list of used suppressions. This only gives
the nr of times a suppression was used.
For a leak search, this only gives the nr of loss records that
have been suppressed, but it does not give additional needed details
to understand more precisely what has been suppressed
(i.e. nr of blocks and nr of bytes).

=> Add in the tool interface update_extra_suppression_use and
print_extra_suppression_info functions to allow the tool to record
additioonal use statistics for a suppression. These statistics
can be done depending on the error (and its data) which is suppressed.

Use this in memcheck for the leak suppressions, to maintain and output
the nr of blocks and bytes suppressed by a suppression during
the last leak search.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13651
2013-10-17 22:10:41 +00:00
Florian Krohm
90cba9e6d4 Add a specific configury check to test compilability of the
<thread> C++ header file by the selected compiler.
Suggested by Bart Van Assche.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13628
2013-10-08 13:04:00 +00:00
Florian Krohm
799f480786 Disable drd/tests/std_thread.cpp for clang.
clang 3.3 produces an error message for /usr/include/c++/4.6/chrono
which happens to get included somewhere inside <thread>.
This happens with C++ headers from:
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3. 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13620
2013-10-04 21:13:16 +00:00
Bart Van Assche
0dabd6dfd3 drd: Update copyright notice
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13613
2013-10-04 05:55:30 +00:00
Bart Van Assche
625c6aa3df drd/tests/annotate_smart_pointer: Avoid non-POD variable length arrays
Non-POD variable length arrays are supported by g++ but not by clang.
Hence convert the variable length array in this test program into a vector.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13606
2013-10-02 16:22:23 +00:00
Bart Van Assche
91136a3fbd drd: Change VALGRIND_DO_CLIENT_REQUEST_EXPR() into VALGRIND_DO_CLIENT_REQUEST_STMT() where appropriate
This should silence a few clang warnings. This was reported by Florian.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13595
2013-10-01 16:55:58 +00:00
Florian Krohm
abe71bded5 Followup to r13553 which caused some build failures.
(1) Detect availability of pthread_setname_np. Ignore testcases
    memcheck/tests/threadname[_xml] if not available.
(2) Enable _GNU_SOURCE to avold compiler warnings.
(3) In threadname_xml filter out stackframes referring to system
    libraries. Added tests/filter_xml_frames to do that.
(4) Adjust .exp files as needed
(5) Do not ship stdout.exp for memcheck/tests/threadname[_xml].


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13557
2013-09-17 20:15:36 +00:00
Florian Krohm
6d15b5deb4 Include pub_core/tool_clreq.h instead of valgrind.h where apropriate.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13555
2013-09-16 20:56:35 +00:00
Bart Van Assche
038beeccc0 drd: Fix bug #323905
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13511
2013-08-24 17:53:00 +00:00
Bart Van Assche
46135647c9 drd: Add command-line option --trace-sectsuppr
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13509
2013-08-24 17:51:18 +00:00
Bart Van Assche
d73260d5b0 drd/tests/concurrent_close: Add
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13508
2013-08-24 17:50:38 +00:00
Philippe Waroquiers
4c9052b4d6 fix incorrect lineno in supp error msgs+ -v give filename+lineno of used supp.
If a suppression file contains an error, the lineno reported could be wrong.
Also, give filename and lineno of the used suppressions in -v debugging output.

The fix consists in ensuring that tool specific read_extra function gets
the Int* lineno pointer, together with other VG_(get_line) parameters.






git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13469
2013-07-22 22:00:13 +00:00
Petar Jovanovic
5a593208b1 add and update exp files for drd/tests/annotate_trace_memory
exp-32bit files needed minor update for the last store, and some mips32
platforms also need additional exp-mips32 due to different way of loading
and storing double values.

This fixes drd/tests/annotate_trace_memory on different 32-bit platforms.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13414
2013-06-02 02:59:07 +00:00
Mark Wielaard
f9b7448882 Revert "Disable drd/tests/annotate_trace_memory[_xml].vgtest on arm and ppc."
The tests have been changed to not depend on atomic 64bit add_and_fetch.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13408
2013-05-22 20:43:25 +00:00
Bart Van Assche
4cbf288c81 drd/tests/annotate_trace_memory no longer depends on 64-bit atomics
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13407
2013-05-22 18:01:16 +00:00
Bart Van Assche
10fb98e91f drd/tests/annotate_trace_memory: Make this test more ARM/PPC friendly (#318643)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13406
2013-05-22 16:30:29 +00:00
Mark Wielaard
cd4df4ef9a Disable drd/tests/annotate_trace_memory[_xml].vgtest on arm and ppc.
Workaround for bug #318643. Disable the tests for now so they don't
go into an infinite loop and fill up the disks on arm, ppc32 or ppc64.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13402
2013-05-22 10:21:02 +00:00
Mark Wielaard
b81e3c86b6 Fix double 'the the' in documentation.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13363
2013-04-05 13:19:12 +00:00
Bart Van Assche
a8a84e19e1 drd/tests/annotate_smart_pointer2: Add an expected output file
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13322
2013-03-10 13:39:57 +00:00
Bart Van Assche
011cf17d6d drd/tests/sem_wait: Skip on Darwin since sem_init() fails with ENOSYS on Darwin
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13321
2013-03-10 13:38:41 +00:00
Bart Van Assche
0cca640bd4 drd: Fix stack growth tracking. Hopefully this is the proper fix for #297147.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13316
2013-03-10 11:02:32 +00:00
Bart Van Assche
7b44c91302 drd: Fix a 4x slowdown for certain applications (#316181)
This commit reverts r12629 ("drd: Don't sporadically report false positives on
newly allocated memory. Fixes #297147").


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13315
2013-03-10 10:43:11 +00:00
Petar Jovanovic
5dd4c02e39 mips: adding MIPS64LE support to Valgrind
Necessary changes to Valgrind to support MIPS64LE on Linux.
Minor cleanup/style changes embedded in the patch as well.
The change corresponds to r2687 in VEX.
Patch written by Dejan Jevtic and Petar Jovanovic.

More information about this issue:
https://bugs.kde.org/show_bug.cgi?id=313267


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13292
2013-02-27 23:17:33 +00:00
Bart Van Assche
0ab171e889 drd: Make --trace-addr trace all loads for the specified address
Thanks to Florian for reporting this.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13271
2013-01-27 10:58:47 +00:00
Bart Van Assche
9816dee903 drd: Avoid that Coverity complains about a dead assignment
Thanks to Florian for reporting this.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13270
2013-01-27 10:56:04 +00:00
Julian Seward
661c1c2b7b Merge, from branches/COMEM, revisions 13139 to 13235.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13236
2013-01-17 14:24:35 +00:00
Julian Seward
eca44c4855 Teach DRD about IRLoadG and IRStoreG. Includes small bug fix from
trunk r13209.


git-svn-id: svn://svn.valgrind.org/valgrind/branches/COMEM@13210
2012-12-27 17:47:09 +00:00
Julian Seward
bcf0ffc341 is_stack_access: don't iterate over possibly non-existent stmts. This
has been observed to cause the JIT to segfault when using DRD on ARM.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13209
2012-12-27 17:46:10 +00:00
Bart Van Assche
ecc22dab2c drd/tests/pth_cond_destroy_busy: Correct expected output
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13200
2012-12-24 10:43:15 +00:00
Bart Van Assche
3b50964baa drd/tests/pth_cond_destroy_busy: Add
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13199
2012-12-24 10:23:16 +00:00
Bart Van Assche
7b1a5978c9 drd: Handle pthread_cond_destroy() failure properly
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13198
2012-12-24 10:22:14 +00:00
Petar Jovanovic
b47835232b Minor style improvement over r13190.
Prerequisite should be non existence of a #define (rather than existence of
#undef in the comments).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13192
2012-12-21 02:15:23 +00:00
Petar Jovanovic
b282550dc1 Use different incorrect value in pth_detached3
The test pth_detached3 will crash on MIPS platform if the value passed to
pthread_detach is not correctly aligned. Thus, we change the value to be still
invalid but aligned.

This fixes the failure of drd/tests/pth_detached3 on MIPS32.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13191
2012-12-20 19:02:17 +00:00
Petar Jovanovic
40644676b1 Introduce DISABLE_PTHREAD_SPINLOCK_INTERCEPT flag
The flag DISABLE_PTHREAD_SPINLOCK_INTERCEPT is set only for MIPS32, and it is
used in DRD and Helgrind as a workaround for the issue #311690.
In short, pthread_spin_lock implementation has local branches to the start of
the function which interferes with the redirection system in Valgrind that
assumes it has to redirect each call/branch to a particular address.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13190
2012-12-20 18:56:57 +00:00
Philippe Waroquiers
35156f7ede fix 310424 --read-var-info does not properly describe static variables
This patch changes the way static variables are
recorded by readdwarf3.c (when giving --read-var-info=yes),
improving the way such variables are described.

Currently:
A static variable does not have the DW_AT_external tag.
So, readdwarf3.c does not consider it a global variable.
It is rather considered a "local" variable.
When it is recorded, it is associated to a range of program counters
(the functions in the file where it is visible).
However, even if the static variable is only visible
in the source file where it is declared, it can in reality
be used by any range of program counters, typically
by having the address of the local variable passed
to other functions.

Such local variable can then only be described
when the program counter is in the range of program
counters for which it has been recorded.
However, this (local) description is obtained
by a kludge in debuginfo.c (around line 3285).

This kludge then produces a strange description,
telling that the variable has been declared in
frame 0 of a thread (see second example below).

The kludge is not always able to describe
the address (if the IP of the tid is in another file than
where the variable has been declared).

I suspect the kludge can sometimes describe the var as being
declared in an unrelated thread
(e.g. if an error is triggered by tid 5, but tid1 is by
luck in an IP corresponding to the recorded range).


The patch changes the way a static variable is recorded:
if DW_AT_external tag is found, a variable is marked as global.
If a variable is not external, but is seen when level is 1,
then we record the variable as a global variable (i.e.
with a full IP range).
This improves the way such static variable are described:
* they are described even if being accessed by other files.
* their description is not in an artificial "thread frame".




First example:
**************
a variable cannot be described because it is
accessed by a function in another file:

with the trunk:
==20410== ----------------------------------------------------------------
==20410==
==20410== Possible data race during read of size 4 at 0x600F54 by thread #1
==20410== Locks held: none
==20410==    at 0x4007E4: a (abc.c:42)
==20410==    by 0x4006BC: main (mabc.c:24)
==20410==
==20410== This conflicts with a previous write of size 4 by thread #2
==20410== Locks held: none
==20410==    at 0x4007ED: a (abc.c:42)
==20410==    by 0x400651: brussels_fn (mabc.c:9)
==20410==    by 0x4C2B54E: mythread_wrapper (hg_intercepts.c:219)
==20410==    by 0x4E348C9: start_thread (pthread_create.c:300)
==20410==
==20410== ----------------------------------------------------------------


with the patch:
==4515== ----------------------------------------------------------------
==4515==
==4515== Possible data race during read of size 4 at 0x600F54 by thread #1
==4515== Locks held: none
==4515==    at 0x4007E4: a (abc.c:42)
==4515==    by 0x4006BC: main (mabc.c:24)
==4515==
==4515== This conflicts with a previous write of size 4 by thread #2
==4515== Locks held: none
==4515==    at 0x4007ED: a (abc.c:42)
==4515==    by 0x400651: brussels_fn (mabc.c:9)
==4515==    by 0x4C2B54E: mythread_wrapper (hg_intercepts.c:219)
==4515==    by 0x4E348C9: start_thread (pthread_create.c:300)
==4515==
==4515== Location 0x600f54 is 0 bytes inside global var "static_global"
==4515== declared at mabc.c:4
==4515==
==4515== ----------------------------------------------------------------


Second example:
***************
When the kludge can describe the variable, it is strangely described
as being declared in a frame of a thread, while for sure the declaration
has nothing to do with a thread
With the trunk:
==20410== Location 0x600f68 is 0 bytes inside local var "static_global_a"
==20410== declared at abc.c:3, in frame #0 of thread 1

With the patch:
==4515== Location 0x600f68 is 0 bytes inside global var "static_global_a"
==4515== declared at abc.c:3

#include <stdio.h>

static int static_global_a = 0; //// <<<< this is abc.c:3




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13153
2012-12-05 21:08:24 +00:00
Florian Krohm
af66466ce4 Changes to allow compilation with -Wwrite-strings. That compiler option
is not used for testcases, just for valgrind proper.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13137
2012-11-23 16:17:43 +00:00
Florian Krohm
d0aa69c331 Fix more Char/HChar mixups. Closing in...
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13119
2012-11-10 22:29:54 +00:00