1430 Commits

Author SHA1 Message Date
Florian Krohm
b9f5142112 Add comments from Julian as to why mc_main.c and mc_replace_strmem.c
deserve special compilation treatment.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12575
2012-05-22 01:41:48 +00:00
Julian Seward
d71610e63a Handle increase in ppc64 guest state size resulting from r2331.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12570
2012-05-21 11:01:35 +00:00
Julian Seward
8ebb8c30e5 Add initial support for Intel AVX instructions (Valgrind side).
Tracker bug is #273475.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12569
2012-05-21 10:18:10 +00:00
Philippe Waroquiers
cad5f2ea1d Bypass gcc 4.4/4.5 compilation bug by moving -fomit-frame-pointer to Makefile.all.am
gcc 4.4 and 4.5 has a bug which causes miscompilation of mc_main.c:
 args are not correctly given to VG_(am_munmap_valgrind).
This causes the secondary map entries to not be unmapped
(which can cause unlimited memory growth) 
and/or causes the assert on VG_(am_munmap_valgrind) result to fail.

Removing the pragma optimize from mc_main.c and inserting it instead
in Makefile.all.am for x86 solves the gcc bug.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12564
2012-05-15 21:04:31 +00:00
Philippe Waroquiers
354569b574 Add assertion that the munmap of the secmap succeeds.
It is suspected that there is a bug in the call to VG_(am_munmap_valgrind).

At first sight, it looks like a bug in gcc version 4.4.5 (Debian 4.4.5-8)
which seems to pass wrong arguments from mc_main.c to aspace mgr function.
Some tests are failing on gcc20 with this assert a.o.
  ./vg-in-place ./perf/bz2 x
gives an assert.
The bug does not happen if Valgrind is compiled with gcc 4.7.0.


On gcc20, the new tests failing with this assert are:
memcheck/tests/linux/lsframe1            (stderr)
memcheck/tests/linux/lsframe2            (stderr)
memcheck/tests/linux/stack_switch        (stderr)
memcheck/tests/origin5-bz2               (stdout)
memcheck/tests/vcpu_bz2                  (stdout)
memcheck/tests/vcpu_bz2                  (stderr)

The assert is committed so as to see other platforms
where this is failing.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12563
2012-05-13 22:58:09 +00:00
Florian Krohm
7d3eee1edf Move registration of mc_pre_reg_read to mc_post_clo_init.
This fixes the regtest failure for memcheck/tests/clireq_nofill on s390x.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12562
2012-05-12 18:06:35 +00:00
Philippe Waroquiers
6ccb4c199e fix 299756 (for symmetry, --free-fill must be ignored for MEMPOOL_FREE and FREELIKE client requests).
Test program from goodell@mcs.anl.gov



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12560
2012-05-11 22:10:39 +00:00
Philippe Waroquiers
0ea6d36f1d fix 219156 support static malloc or alternate malloc lib (e.g. tcmalloc) with new option --soname-synonyms
* pub_tool_redir.h : define the prefix to be used for "soname synonym"
  place holder
* vg_replace_malloc.c : define synonym place holder for malloc related
  functions
* m_redir.c : when detecting a soname synonym place holder redir spec, search
  in clo_soname_synonyms if there is a synonym pattern.
  If yes, replace the soname pattern. If not, ignore the redir spec.
* various files: implement or document the new clo --soname-synonyms
* new test memcheck/tests/static_malloc.vgtest



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12559
2012-05-11 19:33:46 +00:00
Julian Seward
6e0e5e15c5 Test cases for POWER Power Decimal Floating Point (DFP) test class,
test group and test exponent instructions dtstdc, dtstdcq, dtstdg,
dtstdgq, dtstex and dtstexq.  Bug #298862.  (Carl Love,
carll@us.ibm.com and Maynard Johnson, maynardj@us.ibm.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12546
2012-04-29 20:20:16 +00:00
Julian Seward
72eb6b7a7e POWER Processor decimal floating point instruction support, part 3 --
test cases.  (Carl Love, carll@us.ibm.com).  Bug 298080.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12541
2012-04-23 11:22:05 +00:00
Julian Seward
f069a7bb56 Merge branches/TCHAIN from r12476 (its creation point) into trunk.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12517
2012-04-20 23:58:55 +00:00
Julian Seward
4395ea6182 Changes needed to make t-chaining work on ppc64-linux (valgrind side).
git-svn-id: svn://svn.valgrind.org/valgrind/branches/TCHAIN@12514
2012-04-20 10:43:08 +00:00
Julian Seward
6d68ec0346 Add translation chaining support for ppc32 (tested) and to
a large extent for ppc64 (incomplete, untested) (Valgrind side)


git-svn-id: svn://svn.valgrind.org/valgrind/branches/TCHAIN@12512
2012-04-20 00:14:02 +00:00
Julian Seward
9c1af9b09a POWER Processor decimal floating point instruction support: part 2
(bug #297497) (Carl Love, carll@us.ibm.com) (Valgrind side, mostly
tests)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12500
2012-04-12 17:28:57 +00:00
Florian Krohm
12f588b195 Disable test on big-endian platforms.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12495
2012-04-06 14:50:52 +00:00
Florian Krohm
6798e87909 Skip the test if it was not compiled, i.e. dwarf4 is not supported.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12494
2012-04-06 13:54:53 +00:00
Julian Seward
e13d919613 Add support for reading DWARF4 .debug_types sections. Fixes #284124.
(Tom Tromey, tromey@redhat.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12491
2012-04-05 07:55:47 +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
Julian Seward
f8bd0543a4 Fix track-origin instrumentation for ppc32 following r2270/r12476
(initial DFP support).  Maynard Johnson (maynardj@us.ibm.com).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12480
2012-04-02 15:10:37 +00:00
Julian Seward
d2ca761361 Initial support for POWER Processor decimal floating point
instruction support -- VEX side changes.  See #295221.

This patch adds test cases.  Also adds some minor Memcheck
instrumentation tweaks necessitated by the IR changes.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12476
2012-04-02 10:22:05 +00:00
Julian Seward
b49612b466 /* Do expensive interpretation for Iop_Add32 and Iop_Add64 on
Darwin.  10.7 is mostly built with LLVM, which uses these for
   bitfield inserts, and we get a lot of false errors if the cheap
   interpretation is used, alas.  Could solve this much better if
   we knew which of such adds came from x86/amd64 LEA instructions,
   since these are the only ones really needing the expensive
   interpretation, but that would require some way to tag them in
   the _toIR.c front ends, which is a lot of faffing around.  So
   for now just use the slow and blunt-instrument solution. */

Pertains to, although does not completely solve, #242137.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12467
2012-03-27 10:19:39 +00:00
Julian Seward
a1e6c6723c Make this compile on Darwin.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12464
2012-03-27 09:39:22 +00:00
Philippe Waroquiers
b20b3938c6 add test-plo-no.stderr.exp-s390x-mvc in EXTRA_DIST.
Note: such missing files in EXTRA_DIST are found
by check_makefile_consistency.
However, to avoid blocking the tests, the return code
of check_makefile_consistency is ignored, but the errors
it detects are pages before the end of the make regtest output.

=> it might be a good idea to move the check_makefile_consistency
as the last step of regtest: target, and not ignore its return code.
This means:
   trials tests will not block make regtest
   such errors will be noticed.

For the moment, just fixed the missing file in EXTRA_DIST



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12455
2012-03-21 20:32:00 +00:00
Philippe Waroquiers
cbb290c3a3 fix 295799 Missing \n with get_vbits in gdbserver when line is % 80 and there are some unaddressable bytes
patch from Marc Bessières

Thanks



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12453
2012-03-20 19:04:39 +00:00
Florian Krohm
3898cbda6b Add expected output for s390x with compilers using mvc.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12448
2012-03-17 17:37:50 +00:00
Florian Krohm
55255ece42 Add expected results for 32-bit little endian platform.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12447
2012-03-17 17:27:17 +00:00
Philippe Waroquiers
825fdcf3cb Ensure VALGRIND_MALLOCLIKE_BLOCK protects the red zones.
* Redzones for custom alloc were not protected by VALGRIND_MALLOCLIKE_BLOCK.
  mc_main.c client request handling completed with protection
  of the redzones.
* custom_alloc.c test modified to test this case.
* mc_errors.c modified so as to first search for a malloc-ed block
  bracketting the error : for a custom allocator, a recently freed
  block can have just been re-allocated.
  In such a case, describing the address (e.g. in case of error)
  points to the block freed rather than to the block just allocated.
  If there is *also* a recently freed block bracketting the address,
  the block description is changed to indicate that.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12439
2012-03-11 17:59:00 +00:00
Julian Seward
cd43bae6a4 Change the behaviour of --partial-loads-ok=yes to avoid false
negatives, by marking the V bits that come from out of range parts of
the access as undefined; and hence any use of them leads to an value
error.  Prior to this they were marked as defined and could be used
without error.

Behaviour of --partial-loads-ok=no (the default case) is unchanged.

Also add some testing thereof.

Fixes #294523.  Modified version of a patch and testcase by Patrick
J. LoPresti (lopresti@gmail.com).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12430
2012-03-08 14:51:01 +00:00
Julian Seward
2db1d0a8a2 Reinstate intercepts for plain "memcpy" and "memmove" on OSX <= 10.6
(not on Lion).  Fixes #285662.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12423
2012-03-07 15:26:50 +00:00
Florian Krohm
d58aa28f82 Avoid possibly unaligned memory access.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12415
2012-03-03 18:46:05 +00:00
Philippe Waroquiers
7ec5224de5 In case VALGRIND_MALLOCLIKE_BLOCK is wrongly used, output
the execontext where the overlapping blocks have been reported
before crashing.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12412
2012-03-01 22:00:36 +00:00
Philippe Waroquiers
704e5c19d1 Fix one more leak detected by running memcheck in memcheck
(started to run regression tests in an outer)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12407
2012-02-27 21:52:45 +00:00
Philippe Waroquiers
1d7a774336 Fix some memory leaks found by running memcheck on annotated memcheck.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12405
2012-02-26 21:26:00 +00:00
Florian Krohm
0160d2dfc6 With the change in VEX r2258 the guest IA will now also be accessed
in the low word only. Adjust code accordingly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12392
2012-02-20 15:03:02 +00:00
Julian Seward
036b1a4105 Change the garbage collection policy for the secondary VBit table
(that holds partially defined bytes), to GC more aggressively.
Details in the comments.  This largely avoids a sometimes massive
space leak, that has been observed (eg) running the Firefox test suite
on Memcheck.  Without this patch it cannot complete with 4 million
nodes in the table; with the patch it completes comfortably with 50000
ish nodes.  This reduces the total memory use needed for the run
from above 7GB down to 6.2GB.

Smaller improvements have been seen with other programs too.  Speed
does not appear to be negatively affected.

(Based on a patch, and analysis of the problem, by Philippe Waroquiers.)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12383
2012-02-14 12:11:47 +00:00
Tom Hughes
74eb6fb3b4 Add support for process_vm_readv and process_vm_writev system calls.
Patch from Lénaïc Huard to fix BZ#292995.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12374
2012-02-10 09:39:37 +00:00
Philippe Waroquiers
b191da4da7 mc_main.c statistics has hard-coded logic to compute
the memory used by sec vbit table. This logic depends
on the way sec Vbit entries are maintained.
Due to the introduction of pool alloc, this logic has
to be changed to (more) correctly compute the memory.

Verified on f12/x86 by comparing the memory reported
by the memcheck stats with what is given by --profile-heap=yes.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12369
2012-02-08 22:23:55 +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
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
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
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
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
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
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
Bart Van Assche
2796d1b9be RHEL 4 build fix
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12263
2011-11-09 17:31:54 +00:00
Julian Seward
d2daafda62 Use normal setjmp/longjmp, not the __builtin_ ones, as LLVM pretty
much treats the latter kind as no-ops.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12254
2011-10-31 10:59:31 +00:00
Florian Krohm
b0ee68529f Give function copy_input_until_stop the noinline atribute.
At least one of the compilers for s390x nightly builds was inlining it.
Update exp files accoordingly. This should fix any residual back-trace 
noise for this testcase.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12235
2011-10-26 15:27:41 +00:00
Julian Seward
68cf6ae28d Some fixes for Android:
* initial support for Pandaboard/Linaro
* on Android/ARM, ask for non-executable stacks in the executables
* disable Memcheck's strcasestr intercept; its use of tolower()
  causes the dynamic linker to fail.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12234
2011-10-26 15:10:49 +00:00
Julian Seward
084b7cb10b Fix #284384 (clang 3.1 -Wunused-value warnings in valgrind.h,
memcheck.h) by changing a bunch of VALGRIND_DO_CLIENT_REQUEST_EXPR
into VALGRIND_DO_CLIENT_REQUEST_STMT for cases where the return value
of the former would be unused.  (Bart Van Assche, bart.vanassche@gmail.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12226
2011-10-24 13:21:57 +00:00
Julian Seward
daa6c4607b Change the behaviour of VALGRIND_CHECK_MEM_IS_DEFINED slightly, so
that if the range is partially non-addressable and it contains
undefined data, both errors are reported.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12222
2011-10-24 05:59:54 +00:00