Merge, from branches/COMEM, revisions 13139 to 13235.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13236 a5019735-40e9-0310-863c-91ae7b9d1cf9
Change the size of the hash table used to cache IP -> debuginfo to a prime nr

This change is based on rumours/legends/oral transmission of experience/...
that prime nrs are good to use for hash table size :).

If someone has a (short) explanation about why this is useful, 
that will be welcome.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13237 a5019735-40e9-0310-863c-91ae7b9d1cf9
Implement a more efficient allocation of small blocks which are never freed.
This generalises the "perm_malloc" function which was in ms_main.c
The new VG_(perm_malloc) is used in ms_main.c
and for execontext : when there are a lot of execontext, this
can save significant memory.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13238 a5019735-40e9-0310-863c-91ae7b9d1cf9
Add an implementation of memset() that costs half as much on 64 bit
platforms.  (But why are we intercepting memset anyway?  It makes no
sense to me.)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13239 a5019735-40e9-0310-863c-91ae7b9d1cf9
Import from memcheck land, a less ludicrously inefficient
implementation of memcpy, which copies words at a time rather than
just bytes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13240 a5019735-40e9-0310-863c-91ae7b9d1cf9
Fix statement order. Found by Coverity's checker.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13241 a5019735-40e9-0310-863c-91ae7b9d1cf9
Fix a comment. Spotted by Maran.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13242 a5019735-40e9-0310-863c-91ae7b9d1cf9
Fix warning in perm_malloc (reported by Florian)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13243 a5019735-40e9-0310-863c-91ae7b9d1cf9
xen: add a missing break to the handling of XEN_DOMCTL_getdomaininfo

Thanks to Florian Krohm

From: Ian Campbell <Ian.Campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13244 a5019735-40e9-0310-863c-91ae7b9d1cf9
Fix buffer overrun due to copy paste from x86 to amd64.
Detected by Florian (using coverity tool).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13245 a5019735-40e9-0310-863c-91ae7b9d1cf9
Implement --merge-recursive-frames + provide VALGRIND_MONITOR_COMMAND client req.

In a big applications, some recursive algorithms have created
hundreds of thousands of stacktraces, taking a lot of memory.

Option --merge-recursive-frames=<number> tells Valgrind to
detect and merge (collapse) recursive calls when recording stack traces.
The value is changeable using the monitor command
'v.set merge-recursive-frames'.

Also, this provides a new client request: VALGRIND_MONITOR_COMMAND
allowing to execute a gdbsrv monitor command from the client
program.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13246 a5019735-40e9-0310-863c-91ae7b9d1cf9
Add documentation for VALGRIND_MONITOR_COMMAND client request


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13247 a5019735-40e9-0310-863c-91ae7b9d1cf9
mips: additional test case for fix in VEX r2648

Test program that triggers different corner cases related to position of
branch instruction and max size of a translation block (60 instructions).
Fix for these issues has been submitted in r2648.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13248 a5019735-40e9-0310-863c-91ae7b9d1cf9
mips: fix link_tool_exe_linux issue for different mips architectures

One issue has been reported on the mailing list by Ilya Smelykh, and the second
issue has been found in development for MIPS64.
The change modifies the way we detect target-arch by reading host_cpu from
config.log rather than asking the toolchain.

Also, for MIPS64, we use:

--section-start=.MIPS.options=$ala

while for o32 we still use:

--section-start=.reginfo=$ala


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13249 a5019735-40e9-0310-863c-91ae7b9d1cf9
In mc_translate a NULL guard expression is sometimes passed around
functions to indicate a "true" expression. That caused some confusion
and led people to believe believe, that IRDirty::guard could be NULL.
It cannot.
This confusion was indirectly spotted by coverity's checker who figured
out that IRDirty::guard was sometimes unconditionally dereferenced
and sometimes compared against NULL.
Cleaning this up...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13250 a5019735-40e9-0310-863c-91ae7b9d1cf9
xen: Add a missing break to the handling of XEN_DOMCTL_max_vcpus
found by Coverity's checker.
Also fix another missing break XEN_SYSCTL_numainfo found by via a
by-eye check. This one is at the end of the switch so it is benign.
Patch by Ian Campbell <ian.campbell@citrix.com>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13251 a5019735-40e9-0310-863c-91ae7b9d1cf9
Fix two asserts that Coverity's checker diagnosed as having side effects.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13252 a5019735-40e9-0310-863c-91ae7b9d1cf9
Replace bcopy on linux as, at least in 32 bit build, glibc will
sometimes choose to use an optimised version. Fixes #311407.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13253 a5019735-40e9-0310-863c-91ae7b9d1cf9
s390: Add another testcase for DFP insns.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13254 a5019735-40e9-0310-863c-91ae7b9d1cf9
Remove unneeded test. "info" cannot be NULL here as it was dereferenced
previously. Spotted by Coverity's checker.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13255 a5019735-40e9-0310-863c-91ae7b9d1cf9