1693 Commits

Author SHA1 Message Date
Philippe Waroquiers
9b67d18f11 Improve address description for address in the stack.
--read-var-info=yes is very memory and cpu intensive.
This patch ensures that even witout --read-var-info=yes that
the frame where the address point is reported in the address
description.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13991
2014-05-22 23:48:24 +00:00
Philippe Waroquiers
183b978d08 Factorises the address code description and printing
of memcheck and helgrind in a common module:
  pub_tool_addrinfo.h pub_core_addrinfo.h m_addrinfo.c

At the same time, the factorised code is made usable by other
tools also (and is used by the gdbserver command 'v.info location'
which replaces the helgrind 'describe addr' introduced 1 week ago
and which is now callable by all tools).

The new address description code can describe more addresses
(e.g. for memcheck, if the block is not on the free list anymore,
but is in an arena free list, this will also be described).

Similarly, helgrind address description can now describe more addresses
when --read-var-info=no is given (e.g. global symbols are
described, or addresses on the stack are described as
being on the stack, freed blocks in the arena free list are
described, ...).
See e.g. the change in helgrind/tests/annotate_rwlock.stderr.exp
or locked_vs_unlocked2.stderr.exp

The patch touches many files, but is basically a lot of improvements
in helgrind output files.
The code changes are mostly refactorisation of existing code.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13965
2014-05-14 20:39:27 +00:00
Philippe Waroquiers
4aea515f54 * document the %ps / %pS extensions to printf
* remove (from memcheck) emiN, as PRINTF_CHECK can be done properly


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13942
2014-05-07 22:03:59 +00:00
Julian Seward
f7058ba74b Renaming only (no functional change): rename IR artefacts to do
with i-cache invalidation to be more consistent with new d-cache
flushing functionality, so as to track changes in Vex r2852:
  Ijk_TInval          -> Ijk_InvalICache
  TISTART             -> CMSTART (CM == "Cache Management")
  TILEN               -> CMLEN
  VEX_TRC_JMP_TINVAL  -> VEX_TRC_JMP_INVALICACHE



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13934
2014-05-04 10:54:08 +00:00
Julian Seward
9e320cfacb ARM64: add support for cache management instructions (Valgrind side):
dc cvau, regX
  ic ivau, regX
  mrs regX, ctr_el0
Fixes #333228 and #333230.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13931
2014-05-03 21:22:55 +00:00
Philippe Waroquiers
ec8e145850 Add a new test that shows a surprising side effect of the
medium resolution (4 callers) used to compare errors.

To look at the strange side effect, do:
  ./vg-in-place -v --suppressions=memcheck/tests/suppfreecollision.supp memcheck/tests/suppfree activatenondangerouserror

You obtain at the end:
...
--19240-- used_suppression:      2 suppressnondangerouserror memcheck/tests/suppfreecollision.supp:2
...

showing that the suppression aiming at suppressing a nondangerous error has in fact
suppressed more than expected.

This is because m_errormgr.c compares the exe_context in medium resolution/4 calls
(or low resolution/2 calls  once 100 errors have been collected).

The error machinery first encounters the non dangerous error. This error is suppressed,
because all callers match the suppression entry. In particular, we have
in the stacktrace the function ok_to_suppress_double_free_from_this_fun

Then the error machinery encounters the second error.
The stacktrace of the 2nd error has the same first 4 callers than the non
dangerous error. So the 2nd error is considered equal to the first one
and is (unexpectedly in my opinion) suppressed.

This looks a bug (or at least something very surprising).
(the doc mentions the fact that errors are 'commoned up' on 4 callers, but
I am not sure the above side effect was understood).


There are several ways this can be improved, some are more easier than other
  * have   --error-resolution=low/med/high
    similar to the memcheck   --leak-resolution=low/med/high
     (which default value would we take for this new clo ?)

  * have a lot more intelligent error comparison:
      when comparing an error with a suppressed error, one must
      check that the callers used for suppression are equal.
     This looks difficult to implement and probably a significant slow down
     in the error machinery, which will impact applications producing
     many suppressed errors (e.g. helgrind + some pthread lib errors).
     This also implies more memory (e.g. one byte per caller in the
     error, to indicate which caller(s) were used to suppress.
     Still wondering what to do with * and ... ?

  * have a somewhat more intelligent error comparison:
     Instead of comparing only the callers used for suppression, we
     compare the range first..last caller used (so including some
     callers in the range that were not used to suppressed if e.g.
     a ... matching was put in the supp entry).
     Probably still a slowdown (less than previous solution ?)
     and less memory than the previous solution.
     But also not completely clear how to compute the range.

  * always re-evaluate the suppression : this will very probably be
    a significant slow down.

  * do nothing, as nobody complained about this behaviour up to now :)

  * ??? any other idea



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13914
2014-04-26 21:50:57 +00:00
Philippe Waroquiers
e2286363d9 * Implement optimisation in storev8/16/64 similar to optimisations in storev32
See comments in MC_(helperc_STOREV8) for a detailed explanation.

On modern cpu, this gives a few percent speed improvement for
some perf tests, and reduces the nr of undistinguished secondary
map.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13904
2014-04-22 22:07:01 +00:00
Philippe Waroquiers
d17935e604 Factorise enum set parsing code
* add a function Bool VG_(parse_enum_set) in pub_tool_libcbase.h/m_libcbase.c
  (close to Bool VG_(parse_Addr)
* Implement Bool MC_(parse_leak_heuristics) and MC_(parse_leak_kinds)
  as a call to VG_(parse_enum_set)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13898
2014-04-19 09:52:32 +00:00
Julian Seward
9be796fe75 Make origin tracking work on arm64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13893
2014-04-08 15:26:12 +00:00
Dejan Jevtic
8b49c93465 mips32: Additional .exp file for mips32.
memcheck/tests/origin5-bz2: Add a regression test output file variant.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13885
2014-03-26 16:05:16 +00:00
Julian Seward
d410da3564 Add client requests
VALGRIND_DISABLE_ADDR_ERROR_REPORTING_IN_RANGE and
   VALGRIND_ENABLE_ADDR_ERROR_REPORTING_IN_RANGE
and supporting machinery for managing whole-address-space sparse
mappings.  n-i-bz.  In support of
https://bugzilla.mozilla.org/show_bug.cgi?id=970643



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13884
2014-03-20 23:00:09 +00:00
Dejan Jevtic
6107689cd8 mips32: When we are accessing elements via double pointer MIPS compiler can
generate two consecutive 32bit loads instead of one 64bit load. Because of that
in error log we have two conflict loads of size 4 instead of one conflict load
of size 8.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13883
2014-03-20 10:23:43 +00:00
Dejan Jevtic
b0917203d8 mips: Disable test on mips32/64 big-endian platforms.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13881
2014-03-19 15:44:19 +00:00
Dejan Jevtic
22b0f93413 VG_(strlen) ( const HChar* str ) does not count the null terminator '\0' at the
end of the string, so we need to add an extra element in string 's' for the null
terminator.
VG_(strcpy) ( HChar* dest, const HChar* src ) function copies the string pointed
to by src, including the null terminator ('\0'), to the buffer pointed to by dest.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13880
2014-03-19 11:58:35 +00:00
Julian Seward
d59e0ef2a4 Handle IROps introduced by the arm64 port:
Iop_ZeroHI64ofV128, Iop_ZeroHI96ofV128, Iop_ZeroHI112ofV128,
Iop_ZeroHI120ofV128, Iop_Abs64Fx2, Iop_Neg64Fx2



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13860
2014-03-10 10:42:36 +00:00
Julian Seward
e45807708a Fill in a (very) few cases for get_otrack_shadow_offset_wrk on arm64.
Apparently needed for generating some kinds of error messages, even
when not doing origin tracking, strangely enough.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13841
2014-02-27 11:15:58 +00:00
Mark Wielaard
85d5d54737 BZ#331380 cont. Don't crash if evp->sigev_notify is invalid. Fix scalar test.
We check evp.sigev_notify_thread_id only if evp->sigev_notify has
SIGEV_THREAD_ID set. But before checking we need to make sure accessing
evp->sigev_notify is valid.

Fix memcheck/tests/x86-linux/scalar.stderr.exp output.
We now produce separate warnings for the 3 different fields.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13837
2014-02-24 15:09:21 +00:00
Mark Wielaard
3473540d22 memcheck/tests/Makefile.am include filter_dw4 in dist_noinst_SCRIPTS.
The fix for BZ#331254 (r13814) added filter_dw4.
Make sure it is always included in the dist.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13825
2014-02-21 10:50:06 +00:00
Julian Seward
5f800d9f15 Make these buildable on arm64-linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13821
2014-02-20 17:34:45 +00:00
Tom Hughes
c6e0a9d24e Filter out differences in structure size
Patch from Ivo Raisr on BZ#331254


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13814
2014-02-17 22:59:42 +00:00
Florian Krohm
bd3b47c9e3 Fix V-bit tester failures introduced by VEX r2815.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13807
2014-02-14 09:08:39 +00:00
Tom Hughes
1cdbef5fd8 Fix typo in poll wrapper
Patch from Ivo Raisr via BZ#330941


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13795
2014-02-09 11:10:08 +00:00
Florian Krohm
5b0ce0cc5e Fix V-bit tester failures introduced by VEX r2812.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13790
2014-02-06 18:53:30 +00:00
Julian Seward
c2d3e03fbe Handle and instrument an extra rounding-mode argument as added by
vex r2809 to the following primops:

  Iop_Add32Fx4, Iop_Sub32Fx4, Iop_Mul32Fx4, Iop_Div32Fx4, 
  Iop_Add64Fx2, Iop_Sub64Fx2, Iop_Mul64Fx2, Iop_Div64Fx2, 
  Iop_Add64Fx4, Iop_Sub64Fx4, Iop_Mul64Fx4, Iop_Div64Fx4,
  Iop_Add32Fx8, Iop_Sub32Fx8, Iop_Mul32Fx8, Iop_Div32Fx8,



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13781
2014-01-26 18:36:52 +00:00
Julian Seward
3f6d211236 Add support for ARMv8 AArch64 (the 64 bit ARM instruction set).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13770
2014-01-12 12:54:00 +00:00
Dejan Jevtic
4247ea70e0 mips32/64: Add extra suppression for mips32/64.
After the thread is detached not all thread memory is freed. This memory (dtv-dynamic thread vector)
can be used by the main thread. There are two types of run-time handling of TLS.
Difference is in the position of memory. It can be either before the thread pointer or
after the thread pointer.
Taken form the document http://www.akkadia.org/drepper/tls.pdf:
"Variant I for the thread-local storage data structures were developed
as part of the IA-64 ABI. Being brand-new, compatibility was no issue. The thread
register for thread t is denoted by tpt. It points to a Thread Control Block (TCB) which
contains at offset zero a pointer to the dynamic thread vector dtvt for the thread.

Variant II has a similar structure. The only difference is that the thread pointer
points to a Thread Control Block of unspecified size and content. Somewhere the TCB
contains a pointer to the dynamic thread vector but it is not specified where. This is
under control of the run-time environment and the pointer must not be assumed to be
directly accessible; compilers are not allowed to emit code which directly access the
dtvt."

Because of this we have two types of error when the program ends:
possibly lost, and definitely lost.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13761
2013-12-16 13:57:18 +00:00
Philippe Waroquiers
492a8ae2a2 Implement gdbsrv "v.info stats" command giving statistics for valgrind core + tools
* addition of VG_(needs_print_stats) in pub_tool_tooliface.h
* use the above in memcheck and helgrind
* output valgrind stats and calls print_stats in server.c



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13760
2013-12-15 20:24:43 +00:00
Philippe Waroquiers
7d40b140ac Following svn r13758 (bug 328711), some further similar fixes,
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13759
2013-12-12 23:19:13 +00:00
Mark Wielaard
546e8d2c5c Bug 328711 valgrind.1 manpage "memcheck options" section is badly generated
Add missing para tags inside listitems. (Miroslav Franc, mfranc@redhat.com)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13758
2013-12-12 21:20:48 +00:00
Julian Seward
19f49b677b Select expensive add/sub/cmp interpretations for blocks containing
Iop_GetMSBs8x16, since the presence of those usually implies PMOVMSKB
instructions in the block, which can mean "inlined string operations".
Reduces the noise level a lot in some icc12 -O2 generated sequences.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13757
2013-12-11 16:49:46 +00:00
Julian Seward
e2bff1c182 Merge the following revisions from 3_9_BRANCH to trunk:
r13682  Initial cut at 3.9.0 release notes.
r13683  Remove duplicate NEWS entries for 3.9.0.
r13689  Minor docs/NEWS fixes
r13690  Documentation updates for 3.9.0.
r13691  More documentation updates, re leak-checker changes
r13692  NEWS: Note increased max mem size.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13724
2013-11-29 23:08:28 +00:00
Julian Seward
ee95729330 Merge r13704 from 3_9_BRANCH (Fix compile problem in
memcheck/tests/reach_thread_register.c)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13723
2013-11-29 16:57:29 +00:00
Bart Van Assche
84a7cef749 memcheck/tests/origin5-bz2: Add a regression test output file variant
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13721
2013-11-25 07:25:51 +00:00
Bart Van Assche
083723080c memcheck/tests/strchr: Add a regression test output variant
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13720
2013-11-25 06:46:45 +00:00
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
04252a5172 memcheck/mc_replace_strmem.c: Remove trailing whitespace
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13717
2013-11-23 16:41:54 +00:00
Bart Van Assche
38c8815567 memcheck: Optimize the memcpy() intercept
This change reduces the time needed to run the memcheck regression tests
with 2% on my development system.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13716
2013-11-23 15:48:12 +00:00
Dejan Jevtic
8eec882079 mips32: Change the tests values so that the result is
the same on all mips32 platforms. Add extra cases in 
vbit-test for mips32.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13687
2013-10-23 14:07:15 +00:00
Philippe Waroquiers
cc83a01b30 fix attribution of memcheck/tests/reach_thread_register.c code
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13673
2013-10-22 17:26:06 +00:00
Julian Seward
e37bfc02f3 mc_LOADVn_slow: also allow --partial-loads-ok=yes to grant an
exemption for aligned 32 bit loads on 64 bit targets, since it appears
to be necessary.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13672
2013-10-22 15:36:59 +00:00
Philippe Waroquiers
81d7bfddde Fix 324227 memcheck false positive leak when a thread calls exit+block
only reachable via other thread live register

The exiting thread will have its registers considered as not reachable
anymore, registers of other threads will be considered reachable.

This is ensured by using a different exit reason for the
exiting thread and for the other threads.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13670
2013-10-21 19:57:08 +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
Carl Love
30565b278a This commit adds testing support for the following instructions:
vaddcuq, vadduqm, vaddecuq, vaddeuqm,
  vsubcuq, vsubuqm, vsubecuq, vsubeuqm,
  vbpermq and vgbbd.

The completes adding the Power ISA 2.07 support.

Bugzilla 325816

VEX commit id 2790


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13653
2013-10-18 01:20:11 +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
Philippe Waroquiers
9f4120fb63 SIGSEGV/SIGBUS specific handling on s390, to cope with kernel peculiarity
On s390, the linux kernel does not deliver the exact address that
caused a SEGV but rather this address rounded down to a page boundary.
Also, old kernels do not deliver the address that caused a SIGBUS,
but deliver 0.
So, on s390, handle SIGSEGV and SIGBUG by always skipping one page
starting from the current value of the ptr scanning position.
As we need a correct value of ptr on this platform in the longjmp-ed
code, ptr is marked as volatile.
 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13648
2013-10-15 21:04:56 +00:00
Carl Love
d143dd1f43 Power 8 support, phase 5
This commit adds the testcases for the following instructions:

  vpmsumb, vpmsumh, vpmsumw, vpmsumd, vpermxor, vcipher, vcipherlast,
  vncipher, vncipherlast, vsbox,
  vclzb, vclzw, vclzh, vclzd,
  vpopcntb, vpopcnth, vpopcntw, vpopcntd,
  vnand, vorc, veqv,
  vshasigmaw, vshasigmad,
  bcdadd, bcdsub

The VEX commit that added the support for the above instructions was 
commit 2789.

The patch is for Bugzilla 325628


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13646
2013-10-15 18:13:21 +00:00
Philippe Waroquiers
39c780284b Add definedness checking when dereferencing ptr during heuristic reachedness
Patch ensures that no heuristic reachedness is obtained with undefined data.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13635
2013-10-13 18:38:30 +00:00
Philippe Waroquiers
90902aaf13 Fix use of uninit heuristic set for monitor command
* initialise leak_check heuristic parameter in the leak_check monitor command
* show the default value (none heuristic) in the monitor help command
  (none value chosen as default as this gives a backward compatible
   behaviour).
* document the heuristic leak check parameter in memcheck manual
  monitor command section



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13631
2013-10-09 20:12:39 +00:00
Dejan Jevtic
f0b787e8bf mips32: Don't test Iops that aren't supported in VEX.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13629
2013-10-09 08:33:18 +00:00
Dejan Jevtic
961e487650 mips64: add extra Iop cases in VEX and fix compiler
warning.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13624
2013-10-07 10:27:31 +00:00