425 Commits

Author SHA1 Message Date
Bart Van Assche
41cc572c7f drd/tests/trylock: Make this test pass for glibc >= 2.18
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13793
2014-02-08 11:19:12 +00:00
Bart Van Assche
0eeaab895d drd/tests/std_atomic: Add
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13756
2013-12-10 17:56:20 +00:00
Bart Van Assche
87ebe0d5a4 drd: Follow-up for r13749
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13752
2013-12-07 09:16:02 +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
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
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
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
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
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
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
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
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
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
Florian Krohm
25b18b0aa1 Char/HChar and constness fixes. Mostly cost center
on allocators which is always a const HChar *


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13089
2012-10-27 23:07:42 +00:00
Florian Krohm
5337376bf2 More Char/HChar fixes and constification.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13088
2012-10-27 18:39:11 +00:00
Florian Krohm
4d1f391529 Fix compile errors following function prototype change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13040
2012-10-14 02:58:42 +00:00
Bart Van Assche
b7ff000e27 drd/tests: Add a test that verifies whether the pthread_cancel() intercept works
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12908
2012-08-28 18:17:27 +00:00
Bart Van Assche
04a00aa879 drd/tests: Add test program that makes sem_trywait() return a non-zero value
(provided by Graham Whitted <7wz69ejteg@snkmail.com> - see also #305690).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12896
2012-08-24 17:57:44 +00:00
Bart Van Assche
2a476a846f drd/tests/filter_stderr: Remove a space and two backslashes
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12713
2012-07-05 16:21:49 +00:00
Bart Van Assche
adcdb6b0fb drd/tests/tc04_free_lock: Use drd/tests/filter_stderr
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12708
2012-07-04 10:43:12 +00:00
Bart Van Assche
1a2d5e0c03 drd/tests: Make the expected output match the actual output
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12702
2012-07-03 07:53:34 +00:00
Bart Van Assche
0eec2595ca drd/tests: Follow-up for r12690
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12700
2012-07-02 18:47:44 +00:00
Bart Van Assche
8b1be3d95c drd/tests: Rework r12662 as suggested by Florian Krohm
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12690
2012-06-30 18:00:08 +00:00
Bart Van Assche
9d97e3e6c7 drd: Add yet another expected output file
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12662
2012-06-23 10:15:17 +00:00
Bart Van Assche
0804b19b44 drd: Add two regression test output files
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12650
2012-06-17 06:13:58 +00:00
Julian Seward
8b6f93641c Add translation chaining support for amd64, x86 and ARM
(Valgrind side).  See #296422.



git-svn-id: svn://svn.valgrind.org/valgrind/branches/TCHAIN@12484
2012-04-02 21:56:03 +00:00
Bart Van Assche
f244dcefb6 drd: Reenable reporting races on stack variables that are shared over threads for --check-stack-var=yes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12475
2012-04-01 15:06:57 +00:00
Bart Van Assche
8e19567a85 drd: Don't complain about stack variables that are shared over threads. Closes #297147
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12474
2012-04-01 14:40:16 +00:00
Bart Van Assche
913d7fabc1 drd/tests/sigalrm: Report thread creation failure
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12364
2012-02-02 10:35:18 +00:00
Bart Van Assche
40ec829e21 drd: Rename DRD_STOP_TRACE_VAR() into DRD_STOP_TRACING_VAR()
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12348
2012-01-21 18:33:56 +00:00
Bart Van Assche
586df569b3 drd/tests/fp_race_xml: Filter out thread number and vector clock information
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12347
2012-01-20 09:27:15 +00:00
Bart Van Assche
e76f96cd60 drd: Fix a race condition in the pthread_create() intercept.
Avoid that the futex wake call in DRD_(sema_up)() can get invoked after the semaphore has
already been destroyed. This is most likely the real fix for the bug described in the
commit message of r12332.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12346
2012-01-19 19:52:15 +00:00
Bart Van Assche
6cfdbe2eab drd: Switch to new pool allocator
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12344
2012-01-18 09:46:57 +00:00
Philippe Waroquiers
be97cddd7a Fixes 282230 group allocator for small fixed size, use it for MC_Chunk/SEc vbit
* new files include/pub_tool_groupalloc.h and coregrind/m_groupalloc.c
  implementing a group allocator (based on helgrind group alloc).
* include/Makefile.am coregrind/Makefile.am : added pub_tool_groupalloc.h
  and m_groupalloc.c
* helgrind/libhb_core.c : use pub_tool_groupalloc.h/m_groupalloc.c
  instead  of the local implementation.
* include/pub_tool_oset.h coregrind/m_oset.c : new function
  allowing to create an oset that will use a pool allocator.
  new function allowing to clone an oset (so as to share the pool alloc)
* memcheck/tests/unit_oset.c drd/tests/unit_bitmap.c : modified
  so that it compiles with the new m_oset.c
* memcheck/mc_main.c : use group alloc for MC_Chunk
  memcheck/mc_include.h : declare the MC_Chunk group alloc
* memcheck/mc_main.c : use group alloc for the nodes of the secVBitTable OSet
* include/pub_tool_hashtable.h coregrind/m_hashtable.c : pass the free node
  function in the VG_(HT_destruct).
  (needed as the hashtable user can allocate a node with its own alloc,
  the hash table destroy must be able to free the nodes with the user
  own free).
* coregrind/m_gdbserver/m_gdbserver.c : pass free function to VG_(HT_destruct)
* memcheck/mc_replace_strmem.c memcheck/mc_machine.c
  memcheck/mc_malloc_wrappers.c memcheck/mc_leakcheck.c
  memcheck/mc_errors.c memcheck/mc_translate.c : new include needed
  due to group alloc.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12341
2012-01-17 21:16:30 +00:00
Bart Van Assche
571ec74b4e DRD: add two ppc output variants
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12311
2011-12-17 14:18:25 +00:00
Bart Van Assche
630f8b2e62 Add a configure test for detecting whether gcc supports atomic operations on
64-bit integers on 32-bit platforms. Apparently newer gcc versions support
this but older versions not. Thanks to Philippe Waroquiers for reporting this.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12309
2011-12-17 12:53:23 +00:00
Bart Van Assche
77fa5bdd2e drd/tests/Makefile.am: update EXTRA_DIST
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12307
2011-12-14 07:30:05 +00:00
Bart Van Assche
09bb951cba drd --trace-addr: make tracing 64-bit values on a 32-bit platform work
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12305
2011-12-13 11:12:05 +00:00