Commit Graph

9957 Commits

Author SHA1 Message Date
Philippe Waroquiers
247d18674e Bypass warning reported by gcc
gcc reports a warning:
m_stacktrace.c:183: warning: ‘xip_verified’ may be used uninitialized in this function

This warning is a false positive:
xip_verified is assigned in the following branch:
      if (UNLIKELY(xip_verif >= CFUNWIND)) {
         if (xip_verif == CFUNWIND) {
            ...
         } else {
           <<<< here xip_verified is initialised >>>>
         }
      }


xip_verified is then used only if xip_verif > CFUNWIND.

Assign a rubish value to xip_verified to silence gcc.

(??? there are GCC pragmas that can be used to
disable a warning only on a specific line e.g.
something like:

   #pragma GCC diagnostic ignored "-Wuninitialized"
   Addr xip_verified; // xip for which we have calculated fpverif_uregs
   #pragma GCC diagnostic warning "-Wuninitialized"

instead of
   Addr xip_verified = 0; // xip for which we have calculated fpverif_uregs
   // 0 assigned to silence false positive -Wuninitialized warning

but the #pragma technique seems not used currently.

So, using the bypass by assigning a rubbish value




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13282
2013-01-30 23:53:59 +00:00
Philippe Waroquiers
b466dd954a better handle and better document the case of multi-locks cycles
In case a lock order violation is detected in a multi lock cycle,
then the current code cannot produce the set of locks and the
stack traces involved in the cycle.
However, it is still possible to produce the stack trace of
the new lock and the other lock between which a cycle was discovered.

Also, add a comment in the code clarifying why the set of locks
establishing the required order cannot (currently) be produced.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13281
2013-01-30 23:21:34 +00:00
Philippe Waroquiers
352b1d384c Improves stacktrace unwinding on x86
* other platforms (e.g. amd64) are first trying to unwind
  with cfi info, then with the fp chain.
* fp unwind when code is compiled without frame pointer can
  fail and give incomplete stack traces (often terminating
  with a random program counter, causing a huge amount of
  recorded stack traces).

This patch improves unwinding on x86 by:
* first time an IP is unwound, do the unwind both with
  CFI technique and with fp technique.
  If results are identical, IP is inserted in a cache of
  'fp unwindable' IP
* following unwind of the same IP are then done directly
  either with fp unwind or with cfi, depending on the
  cached result of the check done during first unwind.

The cache is needed so as to avoid as much as possible cfi unwind,
as this is significantly slower than fp unwind.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13280
2013-01-30 23:18:11 +00:00
Julian Seward
ac5abb76ac test_reservation(), test_double_pair_instrs(): Fix broken inline assembly
causing segfaults with gcc-4.7.  The inline assembly still isn't right,
but it's better than it was before.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13279
2013-01-29 22:14:01 +00:00
Julian Seward
dbf3bf279d Increase maximum usable memory amount from 32GB to 64GB on 64-bit Linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13278
2013-01-29 21:14:46 +00:00
Julian Seward
d120d46f76 get_otrack_shadow_offset_wrk: amd64: add a (very rare) missing case.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13277
2013-01-29 21:13:00 +00:00
Julian Seward
0fe8fb34cf Non functional change (formatting, comments) related to newly created
Iex_ITE.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13276
2013-01-29 21:11:55 +00:00
Julian Seward
875aed56c4 Fix the mkLazy3 case for I32 x I8 x I128 -> I128.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13275
2013-01-29 17:18:56 +00:00
Florian Krohm
1161672315 Fix a buffer overflow in VG_(assert_fail).
Patch by Matthias Schwarzott (zzam@gentoo.org) with some minor mods.
Fixes BZ 313811


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13274
2013-01-29 04:25:45 +00:00
Florian Krohm
ed4825e88e Infrastructure cleanup part 2. valgrind side changes.
Replace Iex_Mux0X with Iex_ITE (if-then-else).
Companion patch to VEX r2668.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13273
2013-01-29 03:57:40 +00:00
Julian Seward
e084ec0459 Initialise a local variable, so as to stop gcc-4.7.2 complaining that
some part of it is used uninitialised.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13272
2013-01-28 15:17:52 +00:00
Bart Van Assche
0ab171e889 drd: Make --trace-addr trace all loads for the specified address
Thanks to Florian for reporting this.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13271
2013-01-27 10:58:47 +00:00
Bart Van Assche
9816dee903 drd: Avoid that Coverity complains about a dead assignment
Thanks to Florian for reporting this.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13270
2013-01-27 10:56:04 +00:00
Philippe Waroquiers
a24644d175 Fix warning (missing #include file)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13269
2013-01-26 16:45:01 +00:00
Florian Krohm
00d3fbd9dc Avoid copying a string coming from argv[] into a fixed size buffer.
Pointed out by Coverity's checker.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13268
2013-01-26 16:32:18 +00:00
Julian Seward
45bb2fab08 Changes to track r2664, which changed the type of the condition field
of Mux0X from Ity_I8 to Ity_I1.  Patch from Florian Krohm.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13267
2013-01-26 11:49:15 +00:00
Florian Krohm
e50359ee42 Improve help message.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13266
2013-01-24 21:32:32 +00:00
Florian Krohm
248f590c8e Update list of ignored files.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13265
2013-01-24 03:26:48 +00:00
Florian Krohm
24b5658c60 Tweak script; ignore some more opcodes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13264
2013-01-24 03:21:12 +00:00
Philippe Waroquiers
dbc1a5d2d6 Avoid doing a useless system call in scheduler sanity check
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13263
2013-01-23 22:19:36 +00:00
Philippe Waroquiers
d9a9aa9786 Implement the gdbsrv monitor command v.do expensive_sanity_check_general
(useful to check the sanity of valgrind on request and/or from GDB,
when an error is reported by the tool).
Also re-order the NEWS entries to put the internals things after
the user level new functions.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13262
2013-01-23 22:10:28 +00:00
Philippe Waroquiers
e6ced88776 ensure nightly reports the GDB version
Useful to investigate the behaviour of gdbsrv tests


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13261
2013-01-23 21:46:22 +00:00
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