11778 Commits

Author SHA1 Message Date
Mark Wielaard
10816c8683 Run memcheck/tests/demangle with -q.
The interesting part is the demangled backtrace in the error message.
Suppress the memory allocation/blocks summary which can differ slightly
depending on the underlying arch/libs.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15308
2015-06-03 09:52:00 +00:00
Philippe Waroquiers
8e6d249a36 Default is 1 for the unwind length range, not 0
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15307
2015-06-02 22:17:51 +00:00
Philippe Waroquiers
a833d76cd9 Add a gdbxrv monitor command to print the CFI unwind info for an address+len
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15306
2015-06-02 22:09:42 +00:00
Mark Wielaard
d2b96ae95b GCC 5.1 is too smart. Disable Identical Code Folding for preload libs.
We want to disabled Identical Code Folding for the tools preload shared
objects to get better backraces. For GCC 5.1 -fipa-icf is enabled by
default at -O2.

    The optimization reduces code size and may disturb
    unwind stacks by replacing a function by equivalent
    one with a different name.

Add a configure check to see if GCC supports -fno-ipa-icf.
If it does then add the flag to AM_CFLAGS_PSO_BASE.

Without this GCC will notice some of the preload replacement functions
in vg_replace_strmem are identical and fold them all into one picking
a random (existing) function name. This causes backtraces showing
completely unexpected function names.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15305
2015-06-02 20:23:06 +00:00
Mark Wielaard
9c0019f28a Enable process_vm_readv/writev syscall on arm32.
This makes none/tests/process_vm_readv_writev.vgtest pass on arm32.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15304
2015-06-02 18:17:44 +00:00
Rhys Kidd
c17ba15f61 Darwin11.supp should include suppression for known uninitialised read in pthread_rwlock_init() as required to pass the memcheck/tests/darwin/pth-supp test. bz#196528.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15303
2015-06-02 10:30:15 +00:00
Rhys Kidd
e6b0c3b899 Add regression test for bz#228343.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15302
2015-06-02 09:21:28 +00:00
Philippe Waroquiers
20b64d7378 unwind amd64 trace: improve also the fp chain unwind trace
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15301
2015-05-31 15:26:51 +00:00
Philippe Waroquiers
552b9735bb Improve tracing in amd64 unwind
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15300
2015-05-31 15:18:36 +00:00
Rhys Kidd
d289179fd2 Fix OS X host_create_mach_voucher: UNKNOWN host message [id 222, to mach_host_self(), reply 0x........]
bz#343649

Before:

== 591 tests, 220 stderr failures, 14 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 591 tests, 220 stderr failures, 14 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15299
2015-05-31 03:17:53 +00:00
Rhys Kidd
c8440021c5 Fix OS X host_get_special_port: UNKNOWN host message [id 412, to mach_host_self(), reply 0x........]
bz#343525

Before:

== 591 tests, 220 stderr failures, 14 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 591 tests, 220 stderr failures, 14 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15298
2015-05-31 01:58:57 +00:00
Rhys Kidd
11f675de8b Fix unhandled syscall: mach:41 (_kernelrpc_mach_port_guard_trap)
bz#344337

Before:

== 591 tests, 220 stderr failures, 14 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 591 tests, 220 stderr failures, 14 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15297
2015-05-30 08:59:46 +00:00
Rhys Kidd
9351332329 Signal handler ucontext_t not filled out correctly on OS X
bz#341419

Before:

== 589 tests, 220 stderr failures, 15 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 591 tests, 220 stderr failures, 15 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15296
2015-05-28 12:49:00 +00:00
Mark Wielaard
4198e8ed5a Bug #348247 jno jumps wrongly when overflow is not set.
Mention bug fixed in VEX r3147 in NEWS.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15295
2015-05-27 12:37:39 +00:00
Philippe Waroquiers
cc8f7a352f Make some numbers in helgrind stats use , separators, as the numbers can be big
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15294
2015-05-26 21:27:36 +00:00
Philippe Waroquiers
85a86af96d Slightly improve x86 unwind intensive workload.
e.g. perf/memrw is improved by 2% to 3% with this patch.

The unwinding code on x86 is trying to unwind using
either the %ebp-chain or CFI unwinding.
If these 2 techniques fail, then it tries to unwind
using FPO (PDB) debug info.
However, unless running wine or similar, there will never be
such FPO/PDB info.
The function VG_(use_FPO_info) is thus called for nothing
for each 'end of stack'. This function scans all the loaded di
to find a debug info that has some FP, to not find anything.

With this patch, the unwind code on x86 will only call VG_(use_FPO_info) if
some FPO/PDB info was loaded.

The fact that FPO/PDB info was loaded is cached and updated similarly to
cfi cache : each time new debug info is loaded, the cache value is refreshed
using the debuginfo generation.

The patch also changes the name of VG_(CF_info_generation)
to VG_(debuginfo_generation), as this generation is changed for
any kind of load or unload of debug info, not only for CFI based debug
info



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15293
2015-05-26 21:26:39 +00:00
Florian Krohm
b5ae4edaaf Wraparounds are never allowed -- not evern for MAny requests.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15292
2015-05-26 17:59:50 +00:00
Florian Krohm
d655852d69 Remove dependency on bash. Fixes BZ #347978.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15291
2015-05-26 11:52:45 +00:00
Philippe Waroquiers
5f5fa8adf2 Some platforms such as x86 and amd64 have efficient unaligned access.
On these platforms, implement read_/write_<type> by doing a direct
access, rather than calling a function that will read or write
'byte per byte'.

For platforms that do not have efficient unaligned access,
or that do not support at all unaligned access, call function
  readUAS_/writeUAS_<type> that works as before.

Currently, direct acecss is activated only for x86 and amd64.
Unclear what other platforms support (efficiently) unaligned access.

On unwind intensive code (such as perf/memrw on amd64), this patch
gives up to 5% improvement.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15290
2015-05-25 20:15:25 +00:00
Philippe Waroquiers
f4dde903ab This patch decreases significantly the memory needed for OldRef and
slightly increases the performance. It also moderately improves
the nr of cases where helgrind can provide the stack trace of the old
access (when using the same amount of memory for the OldRef entries).
The patch also provides a new helgrind monitor command to show
the recorded accesses for an address+len, and adds an optional argument
lock_address to the monitor command 'info locks', to show the info
about just this lock.

Currently, oldref are maintained in a sparse WA, that points to N
entries, as specified by --conflict-cache-size=N.
For each entry (associated to an address), we have the last 5 accesses.

Old entries are recycled in an exact LRU order.
But inside an entry, we could have a recent access, and 4 very
old accesses that are kept 'alive' by a single thread accessing
repetitively the address shared with the 4 other old entries.


The attached patch replaces the sparse WA that maintains the OldREf
by an hash table.
Each OldRef now also only maintains one single access for an address.
As an OldRef now maintains only one access, all the entries are now
strictly in LRU mode.

Memory used for OldRef
-----------------------
For the trunk, an OldRef has a size of 72 bytes (on 32 bits archs)
maintaining up to 5 accesses to the same address.
On 64 bits arch, an OldRef is 104 bytes.

With the patch, an OldRef has a size of 32 bytes (on 32 bits archs)
or 56 bytes (on 64 bits archs).

So, for one single access, the new code needs (on 32 bits)
32 bytes, while the trunk needs only 14.4 bytes.
However, that is the worst case, assuming that the 5 entries in the
accs array are all used.
Looking on 2 big apps (one of them being firefox), we see that
we have very few OldRef entries that have the 5 entries occupied.
On a firefox startup, of the 5x1,000,000 accesses, we only have
1,406,939 accesses that are used.
So, in average, the trunk uses in reality around 52 bytes per access.

The default value for --conflict-cache-size has been doubled to 2000000.
This ensures that the memory used for the OldRef is more or less the
same as the trunk (104Mb for OldRef entries).

Memory used for sparseWA versus hashtable
-----------------------------------------
Looking on 2 big apps (one of them being firefox), we see that
there are big variations on the size of the WA : it can go in a few
seconds from 10MB to 250MB, or can decrease back to 10 MB.
This all depends where the last N accesses were done: if well localised,
the WA will be small.
If the last N accesses were distributed over a big address space,
then the WA will be big: the last level of WA (the biggest memory consumer)
uses slightly more than 1KB (2KB on 64 bits) for each '256 bytes' memory
zone where there is an oldref. So, in the worst case, on 32 bits, we
need > 1_000_000_000 sparseWA memory to keep 1_000_000 OldRef.

The hash table has between 1 to 2 Word overhead per OldRef
(as the chain array is +- doubled each time the hash table is full).
So, unless the OldRef are extremely localised, the overhead of the
hash table will be significantly less.

With the patch, the core arena total alloc is:
  5299535/1201448632 totalloc-blocks/bytes
The trunk is
  6693111/3959050280 totalloc-blocks/bytes
(so, around 1.20Gb versus 3.95Gb).
This big difference is due to the fact that the sparseWA repetitively
allocates then frees Level0 or LevelN when OldRef in the region covered
by the Level0/N have all been recycled.

In terms of CPU
---------------
With the patch, on amd64, a firefox startup seems slightly faster (around 1%).
The peak memory mmaped/used decreases by 200Mb.
For a libreoffice test, the memory decreases by 230Mb. CPU also decreases
slightly (1%).


In terms of correctness:
-----------------------
The trunk could potentially show not the most recent access
to the memory of a race : the first OldRef entry matching the raced upon
address was used, while we could have a more recent access in a following
OldRef entry. In other words, the trunk only guaranteed to find the
most recent access in an OldRef, but not between the several OldRef that
could cover the raced upon address.
So, assuming it is important to show the most recent access, this patch
ensures we really show the most recent access, even in presence of overlapping
accesses.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15289
2015-05-25 17:24:27 +00:00
Rhys Kidd
11a09e916d Address clang compiler warnings on OS X.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15288
2015-05-25 14:43:47 +00:00
Rhys Kidd
2180224424 Fix regression test added in r15282.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15287
2015-05-25 13:53:55 +00:00
Philippe Waroquiers
50f5deb159 helgrind stats: show the total nr of thr_n_rcec
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15285
2015-05-23 15:47:35 +00:00
Philippe Waroquiers
2550bcbf3e helgrind stats: give the memory occupied by the OldRef
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15284
2015-05-23 15:35:29 +00:00
Philippe Waroquiers
5ae8b759d4 Add stats in helgrind for oldref history found versus not found
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15283
2015-05-23 12:25:22 +00:00
Rhys Kidd
09b00c49c4 Add (presently) failing test case for bz#234814.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15282
2015-05-23 10:20:06 +00:00
Rhys Kidd
bde4ed23f8 Unguard none/tests/x86/cse_fail on OS X, as the test completes. n-i-bz.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15281
2015-05-23 04:18:57 +00:00
Rhys Kidd
86b8c2f235 Re-enable functioning none/tests/amd64/bug137714-amd64 on OS X
n-i-bz

Before:

== 588 tests, 221 stderr failures, 16 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 588 tests, 220 stderr failures, 15 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15280
2015-05-22 16:16:19 +00:00
Rhys Kidd
5c8f850a39 Properly guard none/tests/amd64/*.vgtest on OS X for tests not compiled
n-i-bz

Before:

== 595 tests, 228 stderr failures, 23 stdout failures, 0 stderrB failure, 0 stdoutB failure, 30 post failures ==

After:

== 595 tests, 221 stderr failures, 16 stdout failures, 0 stderrB failure, 0 stdoutB failure, 30 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15279
2015-05-22 15:21:31 +00:00
Florian Krohm
b804dd161f Fix a comment. Do not enumerate segment kinds as all segments
have an extent ... including SkShmC segments.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15278
2015-05-22 15:14:04 +00:00
Julian Seward
9dc5a73468 Fix bug 345126: Incorrect handling of VIDIOC_G_AUDIO and G_AUDOUT
Patch from Hans Verkuil (hverkuil@xs4all.nl)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15276
2015-05-22 10:40:42 +00:00
Florian Krohm
bd01ac40f1 Followup to 15270. Completely forgot about the double maintenance.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15272
2015-05-22 09:34:30 +00:00
Mark Wielaard
ff965e1049 Add procfs-non-linux.stderr.exp variants to EXTRA_DIST.
For bz#344936 procfs-non-linux.stderr.exp was renamed and split into
procfs-non-linux.stderr.exp-with-readlinkat and
procfs-non-linux.stderr.exp-without-readlinkat add both to EXTRA_DIST.
Fixes make post-regtest-checks.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15271
2015-05-22 09:20:03 +00:00
Florian Krohm
50465bca95 Comment only change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15270
2015-05-22 09:17:28 +00:00
Florian Krohm
31536d92a1 Remove an incorrect assertion. Need to consider SkShmC segments as well.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15269
2015-05-21 22:41:39 +00:00
Philippe Waroquiers
d117a8d8b0 Also compare keys before calling cmp in the hash table stats printing
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15268
2015-05-21 22:01:19 +00:00
Rhys Kidd
cd8086c31a Follow-up bz#344936: Distinguish readlinkat tests for OS X platforms that do or do not support the readlinkat syscall.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15265
2015-05-21 12:56:23 +00:00
Florian Krohm
6f0aedc6af Fix rounding when printing floating point numbers.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15264
2015-05-20 15:14:00 +00:00
Philippe Waroquiers
b09ffd9fb9 Have the hash table 'gen' functions comparing the key instead of the
cmp function.
Document this in the cmp function comment in pub_tool_hashtable.h



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15263
2015-05-20 15:08:09 +00:00
Philippe Waroquiers
c6a1524e05 Improve presentation of first line of --profile-heap=yes
(i.e. use 
  -------- Arena "client": 4,194,304/4,194,304 max/cu...
instead of
  -------- Arena "client": 4194304/4194304 max/cu....



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15262
2015-05-20 14:33:30 +00:00
Rhys Kidd
2a3a28aecf Fix unhandled syscall: unix:473 (readlinkat) on OS X 10.10
bz#344936

Before:

== 595 tests, 229 stderr failures, 23 stdout failures, 1 stderrB failure, 1 stdoutB failure, 30 post failures ==

After:

== 595 tests, 228 stderr failures, 23 stdout failures, 1 stderrB failure, 1 stdoutB failure, 30 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15260
2015-05-20 13:31:02 +00:00
Rhys Kidd
b291112485 Improve documentation of syscall: unix: 44 profil() which was deprecated around OS X 10.6 and removed from the xnu kernel shipped with OS X 10.7. See unresolved bz#264253.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15259
2015-05-20 11:31:35 +00:00
Carl Love
4fb69b51c6 Set tests/check_ppc64le_cap to executable.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15258
2015-05-19 16:16:52 +00:00
Carl Love
d6beff654c Fix for the HWCAP2 aux vector.
The support assumed that if HWCAP2 is present that the system also supports
ISA2.07.  That assumption is not correct as we have found a few systems (OS)
where the HWCAP2 entry is present but the ISA2.07 bit is not set.  This patch
fixes the assertion test to specifically check the ISA2.07 support bit setting
in the HWCAP2 and vex_archinfo->hwcaps variable.  The setting for the 
ISA2.07 support must be the same in both variables if the HWCAP2 entry exists.

This patch updates Vagrind bugzilla 345695.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15257
2015-05-19 16:08:05 +00:00
Julian Seward
9f67c29f8b Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15256
2015-05-19 16:01:40 +00:00
Rhys Kidd
fa27ec3570 Silence some reachable system library reports on OS X 10.10 for simple Hello World console application. No regressions. n-i-bz.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15255
2015-05-19 13:53:27 +00:00
Philippe Waroquiers
d28004b4f3 Follow up to r15253:
Having a one elt free lineF cache avoids many PA calls.
This seems to slightly improve (a few %) a firefox startup.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15254
2015-05-17 21:36:05 +00:00
Philippe Waroquiers
435d51c1c9 This patch reduces the memory needed for the linesF.
Currently, each SecMap has an array of linesF, referenced by the linesZ
of the secmap that needs a lineF, via an index stored in dict[1].
When the array is full, its size is doubled.
The linesF array of a secmap is freed when the SecMap is GC-ed.
The above strategy has the following consequences:
  A. in average, 25% of the LinesF are unused.
  B. if a SecMap has 'temporarily' a need for linesF, but afterwards,
     these linesF are converted to normal lineZ representation, the linesF
     will not be recuperated unless the SecMap is GC-ed (i.e. fully marked
     no access).

The patch replaces the linesF array private per SecMap
by a pool allocator of LinesF shared between all SecMap.
A lineZ that needs a lineF will directly point to its lineF (using a pointer
stored in dict[1]), instead of having in dict[1] the index in the SecMap
linesF array.
When a lineZ needs a lineF, it is allocated from the pool allocator.
When a lineZ does not need anymore a lineF, it is returned back to the
pool allocator.

On a firefox startup, the above strategy reduces the memory for linesF
by about 42Mb. It seems that the more firefox is used (e.g. to visit
a few websites), the bigger the memory gain.
After opening the home page of valgrind, wikipedia and google, the memory
gain is about 94Mb:
trunk:
  linesF:    392,181 allocd ( 203,934,120 bytes occupied) (   173,279 used)
patch:
  linesF:    212,966 allocd ( 109,038,592 bytes occupied) (   170,252 used)

There is also less alloc/free operations in core arena with the patch:
trunk:
  core    :   810,680,320/  802,291,712 max/curr mmap'd, 17/19 unsplit/split sb unmmap'd,    759,441,224/  703,191,896 max/curr,    40631760/16376828248 totalloc-blocks/bytes,   188015696 searches 8 rzB
patch:
  core    :   701,628,416/  690,753,536 max/curr mmap'd, 12/29 unsplit/split sb unmmap'd,    643,041,944/  577,793,712 max/curr,    32050040/14056017712 totalloc-blocks/bytes,   174097728 searches 8 rzB


In terms of performance, no CPU impact detected on Firefox startup.
Note we have no representative reproducible (and preferrably small)
perf test that uses extensively linesF. Firefox is a good heavy lineF
user but is far to be reproducible, and is very far to be small.

Theoretically, in terms of CPU performance, the patch might have some
small benefits here and there for read operations, as the lineF pointer
is directly retrieved from the lineZ, rather than retrieved via an indirection
in the linesF array.
For write operations, the patch might need a little bit more CPU,
as we replace an
  assignment to lineF inUse boolean to False (and then probably back to True
  when the cacheline is written back)
by 
  a call to pool allocator VG_(freeEltPA) (and then probably a call to
  VG_(allocEltPA) when the cacheline is written back).
These PA functions are small, so cost should be ok.
We might however still maintain in clear_LineF_of_Z the last cleared lineF
and re-use it in alloc_LineF_for_Z. Not sure how many calls to the PA functions
would be avoided by this '1 elt cache' (and the needed 'if elt == NULL'
check in both clear_LineF_of_Z and alloc_LineF_for_Z.
This possible optimisationwill be looked at later.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15253
2015-05-17 19:32:42 +00:00
Philippe Waroquiers
66d85f81b3 Avoid warning about %d and long int
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15252
2015-05-17 18:37:14 +00:00
Philippe Waroquiers
00ef870633 When process dies due to a signal, show the signal and the stacktrace
at default verbosity


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15251
2015-05-17 18:31:55 +00:00