Commit Graph

9071 Commits

Author SHA1 Message Date
Bart Van Assche
099ef8542e drd: Avoid that an assertion failure is triggered if clone() fails.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12363
2012-02-02 10:14:30 +00:00
Bart Van Assche
c07ec732dc debug info reader: Add support for rvalue references. Closes #278313#c5.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12362
2012-02-01 14:59:14 +00:00
Bart Van Assche
6153849464 <valgrind/valgrind.h>: Fix for Intel C/C++ compiler in MSVC compatibility mode.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12361
2012-01-31 10:13:51 +00:00
Bart Van Assche
6c474ee221 Make -d (enable debug logging) work on Fedora 16 / x86.
Apparently the 32-bit Fedora 16 compiler chooses register esp to pass "&block"
to the inline assembly code in local_sys_write_stderr(). First pushing data on
the stack and next reading the contents of %0 doesn't yield the desired result
if %0 == %esp.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12360
2012-01-30 15:07:20 +00:00
Florian Krohm
83845abd22 Add testcase for bugzilla #287260. Testcase by M.Welinder
(mwelinder@gmail.com). Announce bug fix.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12359
2012-01-29 02:23:07 +00:00
Bart Van Assche
045137d886 none/tests/x86/bug125959-x86 language conformance fix: do not trigger signed integer overflow. Fixes #292628.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12358
2012-01-28 14:20:30 +00:00
Philippe Waroquiers
ce806ed31f (fixes bug 289939 wish: complete monitor cmd 'leak_check' with details
about leaked or reachable blocks)

This patch implements two new memcheck gdbserver monitor commands:
  block_list <loss_record_nr>
        after a leak search, shows the list of blocks of <loss_record_nr>
  who_points_at <addr> [<len>]
        shows places pointing inside <len> (default 1) bytes at <addr>
        (with len 1, only shows "start pointers" pointing exactly to <addr>,
         with len > 1, will also show "interior pointers")


Compiled and reg-tested on f12/x86, deb5/amd64, f16/ppc64.

The 'block_list' command is implemented on top of the 
lr_array/lc_chunks/lc_extras arrays used during the last leak search.
NB: no impact on the memory for the typical Valgrind usage where a leak
search is only done at the end of the run.
Printing the block_list of a loss record simply consists in scanning the
lc_chunks to find back the chunks corresponding to the loss record for which
block lists is requested.

The 'who_points_at' command is implemented by doing a scan similar to 
(but simpler than) the leak search scan.
lc_scan_memory has been enhanced to have a mode to search for a specific
address, rather than to search for all allocated blocks.
VG_(apply_to_GP_regs) has been enhanced to also provide the ThreadId and
register name in the callback function.

The patch touches multiple files (but most changes are easy/trivial or factorise
existing code).

Most significant changes are in memcheck/mc_leakcheck.c :
    * changed the LC_Extra struct to remember the clique for indirect leaks
      (size of structure not changed).
    * made lr_array a static global
    * changed lc_scan_memory:
        to have a search mode for a specific address (for who_points_at)
        (for leak search) to pass a 'current clique' in addition to the clique
         leader
         so as to have a proper clique hierarchy for indirectly leaked blocks.
    * print_results: reset values at the beginning of the print_result of the
      next leak search, rather than at the end of print_results of the previous
       leak search.
      This allows to continue showing the same info for loss records till a new
      leak search is done.
    * new function print_clique which recursively prints a group of leaked
      blocks, starting from the clique leader.
    * new function MC_(print_block_list) : calls print_clique for each clique
      leader found for the given loss record.
    * static void scan_memory_root_set : code extracted from
      MC_(detect_memory_leaks) (no relevant change)
    * void MC_(who_points_at) : calls scan_memory_root_set, lc_scan_memory
        and VG_(apply_to_GP_regs)(search_address_in_GP_reg) to search 
        pointers to the given address.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12357
2012-01-26 23:13:52 +00:00
Bart Van Assche
af76b5a089 drd: Remove drd/drd_list.h again because of its GPLv2 license.
For more info about Valgrind source code licensing, see also:
[1] Top level README line 51.
[2] http://valgrind.org/docs/manual/manual-intro.html#manual-intro.overview, last paragraph.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12356
2012-01-25 20:36:27 +00:00
Bart Van Assche
75a946033a Fix a copy/paste error
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12355
2012-01-25 11:05:12 +00:00
Bart Van Assche
509b7a03ab drd: Add command-line option --ptrace-addr.
This command-line option has been used to track down the recently fixed race in
drd/drd_pthread_intercepts.c.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12354
2012-01-24 18:39:29 +00:00
Bart Van Assche
f7db19c85a drd: Use macros and inline functions for list manipulation
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12353
2012-01-24 18:28:55 +00:00
Bart Van Assche
38b17ca6f4 drd: Avoid that the changes from r12351 trigger a race condition when copying DrdPosixThreadArgs
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12352
2012-01-24 08:30:32 +00:00
Bart Van Assche
a1d8b80b36 drd, semaphore implementation: Only wake the associated futex if at least one thread is waiting
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12351
2012-01-23 17:01:58 +00:00
Bart Van Assche
135da8ceff drd: Source code refactoring - use DRD_(thread_get_vc)() wherever appropriate
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12350
2012-01-22 08:58:31 +00:00
Bart Van Assche
61dff515e6 drd: Source code refactoring - use DRD_(thread_get_vc)() wherever appropriate
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12349
2012-01-22 08:40:42 +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
f536ce6541 drd: Generalize a suppression pattern
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12345
2012-01-18 09:47:12 +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
Bart Van Assche
deb44ff6f0 Pool allocator: change the semantics of VG_(releasePA)() according to comment http://bugs.kde.org/show_bug.cgi?id=282230#c50.
This change also makes the semantics of releasePA match the semantics of
other release functions, e.g. those in XPCOM (see also http://developer.mozilla.org/en/XPCOM_Interface_Reference/nsISupports#Release%28%29).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12343
2012-01-18 08:12:16 +00:00
Philippe Waroquiers
4ea8a59e63 Add a perf test to measure the speed (and memory) of PDB handling.
* modified perf/heap.c so that it optionally creates a partially defined bytes every N bytes
* created perf/heap_pdb4.vgperf calling heap 4 (so one byte on 4 is PDB in what heap allocates).

before/after pool alloc, here are the performances on a ppc64. So, it looks like
pool alloc also significantly improves the speed of PDB handling.

perl perf/vg_perf --vg=../pool_alloc --vg=../before_pool_trunk_untouched --reps=5 perf/heap_pdb4.vgperf 
-- heap_pdb4 --
heap_pdb4 pool_alloc:0.41s  no: 3.0s ( 7.3x, -----)  me:11.9s (29.0x, -----)
heap_pdb4 before_pool_trunk_untouched:0.41s  no: 3.1s ( 7.6x, -3.7%)  me:16.9s (41.1x,-41.7%)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12342
2012-01-17 22:27:47 +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
Florian Krohm
93e3df9e39 Improve configure for SSE 4.2 detection. Fixes #271438
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12340
2012-01-17 13:16:50 +00:00
Florian Krohm
af81e988fc Announce fix for #270796. Also keep the bug list sorted.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12339
2012-01-16 17:26:48 +00:00
Bart Van Assche
cc7b410176 debug info reader: Add support for DW_TAG_unspecified_type. Closes #278313.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12338
2012-01-16 17:11:07 +00:00
Bart Van Assche
31e98a4515 drd: Remove prefix from local variable names
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12337
2012-01-16 13:08:05 +00:00
Bart Van Assche
ea43d21340 debug info reader: rearrange the source code such that gcc issues a warning if an enumeration label is missing.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12336
2012-01-16 09:22:25 +00:00
Florian Krohm
4b9b13911c Add support for the s390's TROO insn. These are the valgrind bits.
Detect ETF2 enhancement facility using STFLE. Add testcases.
Patch by Divya Vyas (divyvyas@linux.vnet.ibm.com) with
modifications. Partial fix of #273114


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12335
2012-01-15 21:02:44 +00:00
Bart Van Assche
fc034de43d Update Subversion ignore lists
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12334
2012-01-15 19:20:56 +00:00
Bart Van Assche
b443a1b776 drd: Make it easier to enable the debug statements in the ELF section suppression code
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12333
2012-01-15 19:17:37 +00:00
Bart Van Assche
0515a0bb85 drd: Set up red zone before the first instruction of a thread is run.
Avoids that DRD sporadically reports mysterious false positive conflicting accesses on
amd64 like e.g. the following:

$ ./vg-in-place --fair-sched=yes --tool=drd --read-var-info=yes --check-stack-var=yes --show-confl-seg=no drd/tests/annotate_smart_pointer 50 50
==18170== drd, a thread error detector
==18170== Copyright (C) 2006-2011, and GNU GPL'd, by Bart Van Assche.
==18170== Using Valgrind-3.8.0.SVN and LibVEX; rerun with -h for copyright info
==18170== Command: ./annotate_smart_pointer 50 50
==18170==
==18170== Conflicting store by thread 1 at 0x7fefff8a0 size 8
==18170==    at 0x400FCE: AnnotateCondVarSignal (unified_annotations.h:32)
==18170== Allocation context: unknown.
==18170==
==18170== Conflicting load by thread 1 at 0x7fefff8a0 size 8
==18170==    at 0x400FDD: AnnotateCondVarSignal (unified_annotations.h:34)
==18170==    by 0x401071: U_AnnotateHappensBefore (unified_annotations.h:46)
==18170==    by 0x4018DD: smart_ptr<counter>::set(counter*, AtomicInt32*) (annotate_smart_pointer.cpp:239)
==18170==    by 0x401778: smart_ptr<counter>::operator=(counter*) (annotate_smart_pointer.cpp:208)
==18170==    by 0x401377: main (annotate_smart_pointer.cpp:326)
==18170== Allocation context: unknown.






























git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12332
2012-01-15 19:13:35 +00:00
Bart Van Assche
d953fbfc3c drd: Refactor functions for starting / stopping to access stack memory
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12331
2012-01-15 19:08:13 +00:00
Bart Van Assche
f374300062 drd: Reformat three comment blocks
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12330
2012-01-15 19:02:20 +00:00
Philippe Waroquiers
48046f6940 Added a new parameter to the memcheck 'leak_check' GDB monitor command
to let the user specify a max nr of loss records to output : on huge
applications, interactive display of a lot of records in gdb can
take a lot of time.


* mc_include.h : 
  - added UInt max_loss_records_output; to LeakCheckParams structure
  - avoid passing LeakCheckParams by struct copy.
* modified test gdbserver_tests/mcleak to test the new parameter
* mc_main.c : parse or set max_loss_records_output in leak_check cmd
  handling and calls.
* mc-manual.xml : document new leak_check parameter
* mc_leakcheck.c : 
  - extract printing rules logic in its own function
  - in print_results, if there is a limit in LeakCheckParam,
    compute from where the printing of loss records has to start

 



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12329
2012-01-14 13:53:13 +00:00
Philippe Waroquiers
e1910a81ca Valgrind gdbserver can open/close connections multiple times
=> avoid leak when re-computing the default vgdb prefix.
Similar change in vgdb.c


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12328
2012-01-13 21:36:46 +00:00
Bart Van Assche
38e08a851c configure.in: Make compiler version check more robust
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12327
2012-01-11 11:34:23 +00:00
Philippe Waroquiers
7245de0062 * Use the arg name forClient to document the calls to VG_(am_get_advisory)
* in function  VG_(am_mmap_file_float_valgrind_flags), use False/*forClient*/
  instead of True (as VG_(am_mmap_file_float_valgrind_flags) is used
  for "valgrind" kind of mmap only).

Regtested on f16/ppc64, deb5/amd64, Ubuntu9.10/x86
 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12326
2012-01-08 21:01:02 +00:00
Florian Krohm
9d14305592 Terminate comment correctly.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12325
2012-01-02 16:12:30 +00:00
Florian Krohm
83e28c9beb Fix accounting for MC_(realloc). It was inconsistent as compared to
other wrappers in that it took place before the silly-args check. 
Testcase and patch by Yann Droneaud (yann@droneaud.fr).
Fixes #281482

Also included is a related fix to MC_(new_block). Incrementing the
alloc counter and updating the allocated memory amount should
occur under the same condition (allocation succeeded).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12324
2011-12-30 03:09:45 +00:00
Dirk Mueller
dc3e2bece3 add support for glibc 2.15
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12323
2011-12-29 08:24:55 +00:00
Philippe Waroquiers
225138a663 Avoid buffer overrun in percentify call.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12322
2011-12-27 18:43:32 +00:00
Bart Van Assche
a40eb02829 Spelling fix
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12321
2011-12-27 09:14:50 +00:00
Philippe Waroquiers
2d4970f494 Small doc changes:
* In core advanced manual, replace 3.7.0 by current release.
* cleanup in m_gdbserver/README_DEVELOPPERS



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12320
2011-12-27 09:03:36 +00:00
Philippe Waroquiers
09a83b50db fix 289699 vgdb connection in relay mode erroneously closed due to buffer overrun
* use PBUFSIZ+1 for buffers reading characters from gdbserver:
  vgdb reads up to PBUFSIZ characters from gdbserver.
  If vgdb receives a burst of packet from Valgrind gdbserver, PBUFSIZ
  characters can be read. The tracing code adds a trailing \0 to
  this buffer => to avoid buffer overrun, the buffers are dimensionned
  with PBUFSIZ+1.
* use read_buf in function read_char, rather than directly calling read.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12319
2011-12-26 21:21:37 +00:00
Florian Krohm
55996ac099 While investigating whether bugzilla #286040 was a problem or
not (it's not) I noticed that the code was more complex than
it needed to be. So this patch simplifies it a little.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12318
2011-12-26 18:35:29 +00:00
Florian Krohm
1abcf9f6e0 When reading a decimal value consume decimal digits, not hexdigits.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12317
2011-12-26 18:30:18 +00:00
Florian Krohm
b8466723cd Beef up VG_(strerror) to provide correct messages for the
errno codes in asm-generic/errno-base.h (on linux). 
The error strings were obtained by calling strerror natively in
Linux. 
Extend vki-linux.h accordingly. vki-darwin.h already had
those errno codes.
Add testcase. This fixes #287858.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12316
2011-12-24 21:50:53 +00:00
Philippe Waroquiers
c953f410c8 Fix 247386 make perf does not run all performance tests :
* move memcheck/perf/many-loss-records test to perf directory
       massif/perf/many-xpts test to perf directory
* modified many-loss-records.vgperf and many-xpts.vgperf,
  so as to have tool specific options prefixed with their tool
* remove directory memcheck/perf and massif/perf (containing no test anymore)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12315
2011-12-23 11:42:20 +00:00
Philippe Waroquiers
e52f0e1de0 * none/tests/linux/mremap3.vgtest : new test
mremap3.c based on testcase provided by Jan Engelhardt
* coregrind/m_syswrap/syswrap-generic.c
  - The two 'no-thrash checks' that were introduced to fix bug #129866
    were (probably) broken when adress space manager was reworked.
    The new VG_(am_get_advisory_client_simple) returns NULL for a free
    segment, but the check was based on checking not NULL and then
    that the state is free.
    => replaces these two local checks by a call to the new
    am Bool VG_(am_covered_by_single_free_segment) function.

* coregrind/pub_core_aspacemgr.h
  coregrind/m_aspacemgr/aspacemgr-linux.c
  - new function Bool VG_(am_covered_by_single_free_segment)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12314
2011-12-22 13:25:58 +00:00