Commit Graph

9935 Commits

Author SHA1 Message Date
Carl Love
fa4ebebbd7 Fix implementation of the DFP integer operands.
The implementation of integer operands doesn't really match the documentation
for the Iop. Take for example Iop_ExtractExpD64. It is documented as
D64 -> I64 but the implementation of the UNARY is defined as
UNARY(Ity_D64, Ity_D64). The result is an integer that is stored in an integer
format in a floating point register. On the IBM s390 however, the architecture
stores the integer value in a general purpose register (GPR) not a floating
point register. This issue exists with the implementation of 11 Iops where the
PPC implementation has either a source or destination whose value is an integer
but the value is stored in a floating point register in an integer format. After
reviewing the PPC implementation with the s390 developer, it was agreed the
cleanest way to fix this is to change the PPC implementation. The BINOP will be
changed to be consistent with the Iop description. This means the PPC
instruction implementation of the PPC instruction in guest_ppc_toIR.c will need
to reinterpret integer source operands as integers which will move the value
from a floating point register to an integer register before calling binop().
The underlying PPC implementation of the unop() for the specific Iop will also
need to change to move the value from the integer register back to the floating
point register so the native instruction can be issued with the integer value
in a floating point register. It was decided that making the changed in PPC,
rather then having the s390 reinterpret integers as DFP and then move the value
back to an integer register, was preferable as it makes the implementation of
the unop(), binops(), triop() consistent with the definition of the Iop.

This patch also includes the needed changes for the vbit tester.  The Iop
definitions in memcheck/tests/vbit-test/util.c had to be updated to be consitent
with the changes in the Iops as documented below.  Also, the function mkLazy3()
in memcheck/mc_translate.c had to be updated to handle the I32 x I8 x I64 -> I64
and I32 x I8 x I128 -> I128 cases.

The specific list of changes are as follows:

Iop name in pub/libvex_ir.h
   documented type
     type of UNARY/BINARY/TERNARY in priv/ir_defs.c
-------------------------------------------------------

Iop_ExtractExpD64
   D64 -> I64
      UNARY(Ity_D64, Ity_D64); (current)
      UNARY(Ity_D64, Ity_I64); (fix)
 

Iop_ExtractExpD128
   D128 -> I64
       UNARY(Ity_D128, Ity_D64); (current)
       UNARY(Ity_D128, Ity_I64); (fix)

Iop_InsertExpD64
   I64 x I64 -> D64
   I64 x D64 -> D64 (fix definition)
       BINARY(Ity_D64,Ity_D64, Ity_D64); (current)
       BINARY(Ity_I64,Ity_D64, Ity_D64); (fix)

Iop_InsertExpD128
    I64 x I128 -> D128
    I64 x D128 -> D128 (fix definition)
        BINARY(Ity_D64,Ity_D128, Ity_D128); (current)
        BINARY(Ity_I64,Ity_D128, Ity_D128); (fix)

Iop_I64StoD128
    I64S -> D128
        UNARY(Ity_D64, Ity_D128); (current)
        UNARY(Ity_I64, Ity_D128); (fix)

Iop_D64toI64S
    IRRoundingModeDFP(I32) x D64 -> I64
        BINARY(ity_RMode, Ity_D64, Ity_D64) (current)
        BINARY(ity_RMode, Ity_D64, Ity_I64) (fix)

Iop_D128toI64S
    IRRoundingModeDFP(I32) x D128 -> I64
        BINARY(ity_RMode, Ity_D128, Ity_D64); (current)
        BINARY(ity_RMode, Ity_D128, Ity_I64); (fix)

Iop_I64StoD64
    IRRoundingModeDFP(I32) x I64 -> D64
        BINARY(ity_RMode, Ity_D64, Ity_D64); (current)
        BINARY(ity_RMode, Ity_I64, Ity_D64); (fix)

Iop_SignificanceRoundD64
    IRRoundingModeDFP(I32) x I8 x D64 -> D64
        TERNARY(ity_RMode,Ity_D64,Ity_D64, Ity_D64); (current)
        TERNARY(ity_RMode,Ity_I8,Ity_D64, Ity_D64); (fix)

Iop_SignificanceRoundD128
    IRRoundingModeDFP(I32) x I8 x D128 -> D128
         TERNARY(ity_RMode,Ity_D128,Ity_D128, Ity_D128); (current)
         TERNARY(ity_RMode,Ity_I8,Ity_D128, Ity_D128); (fix)

The patch is for bugzilla 311100
VEX Committed revision 2652

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13260
2013-01-22 20:26:34 +00:00
Florian Krohm
bf50824155 s390: Pedantic cleanups by Maran.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13259
2013-01-22 13:59:54 +00:00
Florian Krohm
87dc0e335c Make sure the variable is completely initialised. That's good
practice and also silences a complaint from the Coverity checker.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13258
2013-01-22 00:25:05 +00:00
Philippe Waroquiers
35ee46968d Fix NULL dereference if no integer arg given to monitor block_list cmd
Reported by Florian (spotted by coverity).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13257
2013-01-21 22:05:47 +00:00
Florian Krohm
e0685bc47a Remove pointless test. vts->ts is an array and cannot be NULL.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13256
2013-01-21 20:38:54 +00:00
Florian Krohm
5591565c26 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
2013-01-21 20:29:54 +00:00
Florian Krohm
61ec39eecf 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
2013-01-21 15:39:44 +00:00
Tom Hughes
b97113218b 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
2013-01-21 15:17:02 +00:00
Florian Krohm
463822e3eb Fix two asserts that Coverity's checker diagnosed as having side effects.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13252
2013-01-21 13:51:21 +00:00
Florian Krohm
86d64d0227 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
2013-01-21 13:46:57 +00:00
Florian Krohm
29cf6415c3 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
2013-01-21 01:27:22 +00:00
Petar Jovanovic
e8e5546b81 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
2013-01-21 01:01:13 +00:00
Petar Jovanovic
00d404c557 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
2013-01-20 18:27:39 +00:00
Philippe Waroquiers
7f42659c6d Add documentation for VALGRIND_MONITOR_COMMAND client request
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13247
2013-01-20 17:46:19 +00:00
Philippe Waroquiers
6fb1158a78 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
2013-01-20 17:11:58 +00:00
Philippe Waroquiers
ef7a42868a 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
2013-01-19 21:08:27 +00:00
Bart Van Assche
bcfbe494bc 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
2013-01-19 13:22:54 +00:00
Philippe Waroquiers
cb09eb9349 Fix warning in perm_malloc (reported by Florian)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13243
2013-01-19 10:33:45 +00:00
Florian Krohm
436730a4f6 Fix a comment. Spotted by Maran.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13242
2013-01-19 02:50:41 +00:00
Florian Krohm
c826b773d4 Fix statement order. Found by Coverity's checker.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13241
2013-01-19 02:27:41 +00:00
Julian Seward
c162672540 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
2013-01-18 12:51:15 +00:00
Julian Seward
9244972b6d 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
2013-01-18 11:01:53 +00:00
Philippe Waroquiers
0ac5603a9d 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
2013-01-18 06:19:49 +00:00
Philippe Waroquiers
ac3eaed237 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
2013-01-17 23:57:35 +00:00
Julian Seward
661c1c2b7b Merge, from branches/COMEM, revisions 13139 to 13235.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13236
2013-01-17 14:24:35 +00:00
Philippe Waroquiers
1fcd318239 Small comment fix: .h specifies "all frames", implementation uses 8.
Two fixes could be done:
Either we fix the comments
or we increase N_FRAMES to be rather VG_DEEPEST_BACKTRACE.

We fix the comment for the following reason:
This is (at least for the moment) not performance critical.
as this is only called when an error is reported.
However, searching for local vars is extremely costly.
It is unlikely that an error is reported for a stack variable
which is more than 8 frames deeper than theframe in which
it is detected.

So, fix the comment, waiting for a complaint that a deeper
variable is not properly described.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13235
2013-01-16 22:07:02 +00:00
Florian Krohm
d62fe23131 Fix two memory leaks. Spotted by Coverity.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13234
2013-01-16 03:18:19 +00:00
Philippe Waroquiers
ddd6245418 Improve error handling when vgdb cannot read process cmd line
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13233
2013-01-15 23:09:41 +00:00
Florian Krohm
3958c97acf Announce bug fix.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13232
2013-01-15 03:31:26 +00:00
Florian Krohm
66925ec149 Fix a few compiler warnings on Darwin.
Patch Guy Harris (guy@alum.mit.edu). Part of fixing BZ 312980.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13231
2013-01-15 03:19:54 +00:00
Florian Krohm
1d18d1618e Minor code cleanup. These cases cannot occur.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13230
2013-01-15 03:09:16 +00:00
Tom Hughes
e960453f98 Test file mode correctly in vmsplice wrapper.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13229
2013-01-14 22:14:21 +00:00
Tom Hughes
fc1fb1f0b8 Accept glibc 2.17 as valid.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13228
2013-01-14 09:48:49 +00:00
Philippe Waroquiers
213b13ec9f Comment only changes
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13227
2013-01-13 15:18:51 +00:00
Philippe Waroquiers
36cb2b241c no recording of execontext for track origin in brk/signal stack when track-origin=no
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13226
2013-01-13 15:01:21 +00:00
Philippe Waroquiers
8817a79c9d Avoid to record execontext used for origin tracking when --trac-origins=no
All calls to VG_(unknown_SP_update) were recording an execontext
of one IP, useful only for track origin.
This patch implements splits VG_(unknown_SP_update) 
in two different functions VG_(unknown_SP_update_w_ECU)
(doing origin tracking) and VG_(unknown_SP_update)  (not doing origin tracking).




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13225
2013-01-13 13:59:17 +00:00
Florian Krohm
ee6b67bd79 Add memcheck support for the IROps added in VEX r2631.
Adapt vbit-tester.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13224
2013-01-12 22:04:00 +00:00
Philippe Waroquiers
739ae0bcb6 Implement --keep-stacktraces=alloc|free|alloc-and-free|alloc-then-free|none
The option --keep-stacktraces controls which stack trace(s) to keep for
malloc'd and/or free'd blocks. This can be used to obtain more information
for 'use after free' errors or to decrease Valgrind memory and/or cpu usage
by recording less information for heap blocks.

This fixes 312913 Dangling pointers error should also report the alloc
stack trace.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13223
2013-01-12 19:53:08 +00:00
Philippe Waroquiers
e008ba56c0 output the nr of IP in the stacktrace header produced by v.info exectxt
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13222
2013-01-11 23:48:28 +00:00
Philippe Waroquiers
dd96336e7f update a test following revision 13220
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13221
2013-01-10 22:35:33 +00:00
Philippe Waroquiers
6bd8cf1eae Addition of GDB server monitor command 'v.info execontext' that shows
information about the stack traces recorded by Valgrind.
This can be used to analyse one possible cause of Valgrind high
memory usage for some programs.

At work, a big set of regression tests crashed out of memory under Valgrind.

Two main causes for out of memory were identified:
1. big memory usage for stacktrace (exe contexts) recording by Valgrind
2. big number of partially initialised bytes.

This patch adds a gdbsrv monitor command that output (very) detailed
information about all the recorded exe context.

This has been used to analyse the problem 1. above,
showing the following identified causes for a (too) big nr of execontexts:

A. When the JIT handles an unknown SP update, even when --track-origins=no,
an execontext is (uselessly) created and recorded
to track the (never used) origin of some uninitialised stack memory.
This creates a whole bunch of 'one IP' execontexts.

B. same problem in handling some system calls (at least the brk system
 calls always records an origin, even when --track-origins=yes).

C. The Valgrind unwinder cannot properly unwind some stack traces.
  It unwinds a few frames, then go bezerk and stops at a "random" IP.
  This then causes the same "logical" stacktrace to be truncated
  and records thousands of times with this "differentiating" last IP.


For problem cause 2 above ( a lot of partially initialised bytes),
the idea is to similarly add another gdbsrv commands that will output
statistics about which stack traces are causing a lot of uninitialised bytes. 




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13220
2013-01-10 20:42:51 +00:00
Florian Krohm
a255caf02a s390: Add ecag.stdout.exp-zec12 to EXTRA_DIST.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13219
2013-01-10 15:44:28 +00:00
Christian Borntraeger
4836e36fee add ecag exp file for zec12
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13218
2013-01-09 14:54:33 +00:00
Philippe Waroquiers
8d4d2317dd remove useless undef of MYBUF_LEN
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13217
2013-01-08 14:30:17 +00:00
Julian Seward
aa2f793777 Companion fix to r2629: removal of specifiable default return values
in conditional dirty helper calls.



git-svn-id: svn://svn.valgrind.org/valgrind/branches/COMEM@13216
2013-01-08 14:11:25 +00:00
Florian Krohm
963e82c6fe s390: Add testcases for DFP "shift significant" insns.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13215
2013-01-01 22:20:12 +00:00
Florian Krohm
83a2d3c94d s390: Add testcase for "test data class/group" insns.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
This is part of fixing BZ 307113.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13214
2012-12-28 15:54:23 +00:00
Julian Seward
415490d305 Improvements to the built-in profiling infrastructure:
--profile-flags=00000000 now prints summary statistics, one line per
profiled block, but with no translation details.  Previously it had
no effect.

--profile-interval=<number> is a new flag that causes the profile data
to be dumped and zeroed every <number> event checks.  This makes it
possible to get profile data without waiting for runs to end, and to
get profile data which depends on the current workload etc.  If
--profile-interval=0 or is unset, the profile is printed only once, at
the end of the run, as before.

--profile-flags=XXXXXXXX (for at least one nonzero X) prints the
summary lines both at the start and end of the profile, so you don't
have to scroll back up to the top to see the summary.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13213
2012-12-28 09:12:14 +00:00
Florian Krohm
28063e7da5 s390: Add testcases for ESDTR and EXDTR.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ #307113.

[ r13211 was also implemented by Maran. ]


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13212
2012-12-27 20:17:32 +00:00
Florian Krohm
8f42be9d61 valgrind-side support for Iop_ExtractSigD64 and Iop_ExtractSigD128.
See also companion patch VEX r2621.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13211
2012-12-27 20:06:18 +00:00