Commit Graph

4122 Commits

Author SHA1 Message Date
Julian Seward
5bbaebd031 Ignore ELF sections that have zero size. Fixes #309600.
(Dragos Tatulea, dragos.tatulea@gmail.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13109
2012-11-08 15:45:16 +00:00
Philippe Waroquiers
d7eae8afe5 fix n-i-bz same as 303624 (fixed in 3.8.0), but for x86 android
(note: this might be a candidate if a 3.8.2 is done).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13105
2012-11-06 22:47:00 +00:00
Philippe Waroquiers
88d11f08b4 factorise sys_socketcall
sys_socketcall was duplicated in syswrap-{ppc64|ppc32|arm|mips32|s390x}-linux.c
=>
* Similarly for what was done for sys_ipc, factorise the code in syswrap-linux.c
* re-enabled PRE_MEM_READ for VKI_SYS_SENDMSG and VKI_SYS_RECVMSG 
  (PRE_MEM_READ calls were commented out around 2003, for what
   was supposed a glibc bug.
   The PRE_MEM_READ calls were already re-enabled in s390x)
* s390x also had some more checking to verify the addressibility of
  the args and fail the syscall with EFAULT if not addressable
  => same checks are now done for all platforms.

(tested on x86/amd64/mips32/s390x/ppc32/ppc64, 
 compiled for arm-android-emulator)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13104
2012-11-04 20:40:33 +00:00
Florian Krohm
5de39dd72a Fix Char/HChar mixups and constness in m_scheduler.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13103
2012-11-03 19:32:28 +00:00
Florian Krohm
b906e8df12 Fix Char/HChar mixups and constness in m_initimg.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13102
2012-11-03 19:18:10 +00:00
Florian Krohm
eec3191320 Char/HChar and constness fixes in m_ume
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13101
2012-11-03 18:28:20 +00:00
Florian Krohm
5a27187a2a s390: Autodetect cache info. These are the final bits to fix BZ 275800.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13100
2012-11-02 22:00:59 +00:00
Florian Krohm
505661509e Tweak VG_(machine_get_cache_info).
Better messages. Always write cache info when in debug mode.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13099
2012-11-02 21:36:39 +00:00
Philippe Waroquiers
3e427a3bff Ensure vgdb.c is warningless with -Wpointer-sign
* use normal 'char' (when possible) rather than 'unsigned char'
* fix bug in case a character val >= 128 is given in a -c command



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13098
2012-11-01 17:00:12 +00:00
Philippe Waroquiers
418dc54963 fix arena size wrongly printed in debugmsg on 32 bits platforms when > 2Gb.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13097
2012-10-31 22:10:47 +00:00
Philippe Waroquiers
cd8e4e9bde for debuglevel >=2, ensure write_buf debug output only writes the req nr of char
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13096
2012-10-31 15:07:39 +00:00
Florian Krohm
25b18b0aa1 Char/HChar and constness fixes. Mostly cost center
on allocators which is always a const HChar *


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13089
2012-10-27 23:07:42 +00:00
Florian Krohm
5337376bf2 More Char/HChar fixes and constification.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13088
2012-10-27 18:39:11 +00:00
Petar Jovanovic
d75506405e Additional refinement in PRE(sys_ipc).
Additional refinement in PRE(sys_ipc) on which arguments to check for the call.
This is still a simplistic check, yet it should resolve additional cases.
One of the resolved cases is memcheck/tests/sem on MIPS.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13084
2012-10-26 16:16:43 +00:00
Philippe Waroquiers
85947ee43b fix 123837 semctl system call: 4rth argument is optional, depending on cmd
Depending on the semctl command (arg3), arg4 might or might not be needed.
The PRE(sys_ipc) multiplexed syscall for semctl was always checking
all 4 args.

The fix consists in dereferencing the 4th arg (which in sys_ipc is ARG5)
only if the semctl syscall cmd implies 4 arguments.
This avoids the false positive on linux x86.

Note that PRE(sys_ipc) is still too simplistic as it assumes
that 6 args are always read, which is not the case.
This seems to cause false positive on mips:
  memcheck on none/tests/sem gives:
     Syscall param ipc(fifth) contains uninitialised byte(s)

It would be nice to implement the multiplexed PRE(sys_ipc) by
calling the PRE(sys_xxxx) similar PRE, depending on ARG1 of sys_ipc.
This would then avoid the simplistic PRE(sys_ipc) logic without duplicating
the logic in PRE(sys_semctl) (and all other sys_ipc multiplexed syscalls).
However, I found no easy way to do that.

With the current fix, some logic about semctl is partially duplicated between
the PRE(sys_ipc) (for platforms such as x86 having a multiplexed sys call)
and PRE(sys_semctl) (for platforms such as amd64, having a direct sys call)
to fix the false positive encountered on x86.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13082
2012-10-23 21:38:52 +00:00
Bart Van Assche
3fd464fbf3 Remove build dependency on Xen header files - closes #308495
From: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13081
2012-10-23 18:03:28 +00:00
Petar Jovanovic
eab0663602 Reserve space for frame header in disp_run_translations for MIPS.
Reserve space for frame header in disp_run_translations, as some optimizations
may decide to use it. This should fix issue #307141.

Related link:
https://bugs.kde.org/show_bug.cgi?id=307141


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13080
2012-10-22 17:43:57 +00:00
Philippe Waroquiers
e344ae06dd Follow-up to sys_ipc restructuration
Rev 13078 removed a PRE call (for SEMCTL) in the POST(sys_ipc).
This commit adds the correct POST call for SEMCTL in POST(sys_ipc).
(note: some tests are missing in this area, as removing PRE
and adding POST did not cause any test result to change).

This is the last patch to restructure the sys_ipc code.

After this patch, should be able to do the real fix
for 23837 (semctl GETVAL false positive)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13079
2012-10-21 21:49:33 +00:00
Philippe Waroquiers
78966742aa Follow-up to sys_ipc restructuration
Now that the PRE/POS(sys_ipc) code is not duplicated anymore,
fix two strange things in this code:

* PRE(sys_ipc) : add missing ; after the call PRE_REG_READ6
  (strange that this was compiling without it ???)

* POST(sys_ipc) : it seems there was a copy/paste of
  the  PRE(sys_ipc) code for VKI_SEMCTL.
  Cannot understand why we would need to call again
  deref_Addr and ML_(generic_PRE_sys_semctl) in the POST(sys_ipc).




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13078
2012-10-21 21:13:39 +00:00
Philippe Waroquiers
6c471293d4 Fix 308711 - give more info about aspacemgr and arenas in out_of_memory
In case of out of memory, Valgrind will output
the state of the address space manager and of the arena.
Then it will output a message to inform the user about the out of memory.

In case out of memory happens again while outputting the aspacemgr
or arena info, then another trial is done to only output the user msg.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13077
2012-10-21 21:03:11 +00:00
Philippe Waroquiers
b83003a1e0 restructure code for future fixing of 123837 (semctl GETVAL false positive)
Regrouped identical code (except for indentation)
from syswrap-ppc64-linux.c, syswrap-ppc32-linux.c,syswrap-mips32-linux.c
  syswrap-x86-linux.c, syswrap-s390x-linux.c
into
  syswrap-linux.c

(compiled/regtested on x86, amd64, ppc64, mips32, s390x)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13076
2012-10-21 20:21:17 +00:00
Florian Krohm
79b79d6388 First round of Char/HChar fixups for coregrind and memcheck.
Little bit of ripple in tools, too.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13074
2012-10-21 19:43:43 +00:00
Philippe Waroquiers
0df0a2725c Fix 308644 vgdb command for having the info for the track-fds option
(allows to have the list of opened fds and the associated info
on request from GDB or from the shell, using vgdb)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13072
2012-10-21 14:37:14 +00:00
Florian Krohm
51ea2ef441 Fix a few compiler warnings.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13067
2012-10-21 02:30:18 +00:00
Florian Krohm
4c9f59671e Followup to constification of VEX's external interface (VEX r2555).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13066
2012-10-21 02:19:35 +00:00
Florian Krohm
2d248fcd2e Add a FIXME
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13064
2012-10-20 19:52:14 +00:00
Petar Jovanovic
d38c7c3e17 Add a proper support for several MIPS instructions that generate SigFPE.
Add support to properly handle TEQ, ADD and SUB instructions that generate
exceptions on MIPS platforms. A SignalException test for MIPS32 has also been
added, so we can cover more cases.

This resolves:

none/tests/faultstatus
gdbserver_tests/mcsignopass
gdbserver_tests/mcsigpass


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13059
2012-10-19 14:45:17 +00:00
Florian Krohm
792e08a5ce Fix VG_(cpuid) invocations.
Also call cache_info_is_sensible. I forgot to do that in r13053.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13055
2012-10-18 03:33:05 +00:00
Florian Krohm
5371dd0942 Fix some prototypes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13054
2012-10-18 03:17:32 +00:00
Florian Krohm
52cb6c14fa Change cache detection for x86/amd64 to fill in VexCacheInfo directly.
New function write_cache_info to dump what was detected for debugging
purposes. 
New function cache_info_is_sensible to ensure that autodetected
cache info lives up to the promises made in libvex.h.
Moved the trace-cache related kludgery to cachegrind where it belongs.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13053
2012-10-18 03:16:45 +00:00
Philippe Waroquiers
aff39b640c Fix 308341 vgdb should report process exit (or fatal signal)
patch from Mark Wielaard.
(with small modifications).
Also clarified some comments related to the resume reply.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13052
2012-10-17 21:32:03 +00:00
Bart Van Assche
109e687afd xen: include arg struct field names when marking memory as read.
Makes it easier to figure out what was not initialised.

Thanks, once again, to Julien Grall.

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


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13050
2012-10-15 18:46:08 +00:00
Bart Van Assche
af89e2e88a xen: Remove cast of ARG* to unsigned int before pointer conversion.
This is pretty dodgy on 64 bit systems.

Thanks to Julien Grall.

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


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13049
2012-10-15 18:45:28 +00:00
Bart Van Assche
c38ab89684 xen: adding missing break.
Thanks to Julien Grall.

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


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13048
2012-10-15 18:44:59 +00:00
Bart Van Assche
9a26cdcfce xen: Useful messages for sys/domctl interface_version mismatch
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13047
2012-10-15 18:44:18 +00:00
Florian Krohm
a5928d2ac8 Fix some more Char / HChar mixups
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13042
2012-10-14 16:45:23 +00:00
Florian Krohm
786e11050a Char/ HChar cleanup: The various panic and printf-like functions
all take const HChar * arguments.
__FILE__ and __func__ expand into string literals (or character 
arrays initialised by them), as do strings created by the preprocessor 
e.g. #stuff.
This change reduces the number of warnings from 17000+ to ~5500


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13039
2012-10-14 00:16:28 +00:00
Philippe Waroquiers
3d14e1d1d7 Some wrong options silently ignored if starting with same letters as valid option
For example, options below are silently "accepted"+ignored:
  valgrind --profile-heaps=yes --max-stackframes=35 memcheck/tests/trivialleak
  valgrind --profile-heaps=oui --max-stackframes=3.141592654 memcheck/tests/trivialleak

Also fixed the on-line --help output for option --core-redzone-size



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13037
2012-10-12 21:46:55 +00:00
Christian Borntraeger
9a8022279b fix parent and child tid pointer mixup:
The linux kernel has parent tid pointer first.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13034
2012-10-08 20:26:48 +00:00
Florian Krohm
7d59048401 This is the 2nd installment of the cache info reorganisation.
The host's VexArchInfo is passed to the tool instrumentation
functions. Purely mechanic patch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13031
2012-10-07 21:59:42 +00:00
Florian Krohm
0d5a9a3523 Fix compile error on ppc. Followup to r13028
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13029
2012-10-07 20:27:38 +00:00
Florian Krohm
a9b2103cf2 This patch is the first installment of the cache info reorganisation.
It's reorg only. No new cache autodetection stuff has been added.

coregrind
pub_tool_cpuid.h is removed as it is no longer exposed to tools.
Its contents has moved to pub_core_cpuid.h.
New file: coregrind/m_cache.c to contain the autodetect code for
cache configurations and define other cache characteristics that
cannot be autodetected (i.e. icaches_maintain_coherence). Most of 
cg-arch/x86-amd64.c was moved here. The cache detection code for
x86-64 needs to be fixed to properly initialise VexCacheInfo. It
currently has cachegrind bias.
m_cache.c exports a single function (to coregrind): 
   VG_(machine_get_cache_info)(VexArchInfo *vai)
This function is called from VG_(machine_get_hwcaps) after hwcaps have
been detected.

cachegrind
Remove cachegrind/cg-{ppc32,ppc43,arm,mips32,s390x,x86-amd64}.c
With the exception of x86/mamd64 those were only establishing a
default cache configuration and that is so small a code snippet that
a separate file is no longer warranted. So, the code was moved to
cg-arch.c. Code was added to extract the relevant info from 
x86-amd64.
New function maybe_tweak_LLc which captures the code to massage the
LLc cache configuration into something the simulator can handle. This
was originally in cg-x86-amd64.c but should be used to all architectures.
Changed warning message about missing cache auto-detect feature
to be more useful. Adapted filter-stderr scripts accordingly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13028
2012-10-07 19:47:04 +00:00
Tom Hughes
b387dedac0 Allow a null pointer as the second argument to capget.
Patch from Mark Wielaard to fix BZ#307101.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13021
2012-10-04 21:38:27 +00:00
Tom Hughes
f74befe896 Implement a fake /proc/self/auxv file for linux systems.
Patch from Mark Wielaard to fix BZ#253519.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13019
2012-10-04 20:27:38 +00:00
Philippe Waroquiers
fef0367e6e Unbreak build on ppc64 (error: ‘EmWarn_PPC64_redir_underflow’ undeclared)
coregrind/m_translate.c does not compile on ppc64 (ppc32 maybe also?)
due to missing include file.
Note: libvex_emnote.h is unconditionally included, even if only
useful for ppc. I suppose we do not want #ifdef for that.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13017
2012-10-02 20:35:21 +00:00
Florian Krohm
7d6ff1f425 Add include file.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13016
2012-09-30 20:30:40 +00:00
Tom Hughes
2ba34ab159 Implement some extra DW_OPs - more constants and some unary operators.
Patch from Mark Wielaard on BZ#307038.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13010
2012-09-21 09:12:30 +00:00
Tom Hughes
106fc73f9c Rename CfiOp to CfiBinop in preparation for adding unary operators.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13009
2012-09-21 09:04:27 +00:00
Tom Hughes
68757c25a3 When processing DW_OP_plus_uconst make sure we record an add, not
whatever binary operation we happened to see last.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13008
2012-09-21 08:57:46 +00:00
Petar Jovanovic
c27f3e1b76 Enable wrappers for sys_settimeofday and sys_stime on MIPS.
Enable wrappers for MIPS for the following two system calls:

- sys_settimeofday, and
- sys_stime.

Resolves https://bugs.kde.org/show_bug.cgi?id=306783
Patch contributed bederic M. <dark_footix@yahoo.fr>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12995
2012-09-18 17:19:36 +00:00