Commit Graph

5275 Commits

Author SHA1 Message Date
Ivo Raisr
02a02e7bf9 Use NULL_STK_ID consistently throughout whole Valgrind.
Follow up to SVN r16159, BZ#373046. 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16160
2016-11-28 21:41:28 +00:00
Philippe Waroquiers
260f165999 Fix 373046 - Stacks registered by core are never deregistered
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16159
2016-11-28 19:34:06 +00:00
Philippe Waroquiers
d280a9f9a5 Ensure the 'too early msg to use vgdb stop at valgrind abnormal exit' is produced
For this, we must directly check the command line option, as
the VG_(gdbserver_stop_at) function returns False if the gdbserver
is not yet initialised



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16157
2016-11-27 10:25:15 +00:00
Julian Seward
cad347059e Bug 348616 - Wine/valgrind: Warning: noted but unhandled ioctl 0x5390
with no size/direction hints. (DVD_READ_STRUCT)

Patch from Austin English (austinenglish@gmail.com).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16153
2016-11-23 13:26:23 +00:00
Julian Seward
15f0421b15 Bug 352767 - Wine/valgrind: Warning: noted but unhandled ioctl 0x5307
with no size/direction hints. (CDROMSTOP).

Patch from Austin English (austinenglish@gmail.com).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16152
2016-11-23 13:15:22 +00:00
Philippe Waroquiers
d513fcfe77 xtree: some documentation and --help-debug fine tuning
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16146
2016-11-20 11:41:25 +00:00
Ivo Raisr
8f6ff4a27b Solaris: Add syscall wrapper for sigsendsys(108)
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16145
2016-11-20 05:19:02 +00:00
Ivo Raisr
8e08fc91ec Solaris: Add syscall wrapper for sigsuspend(95)
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16144
2016-11-20 00:20:34 +00:00
Philippe Waroquiers
d208bc934b Fix 372504 Hanging on exit_group
Note that it is unclear if the PRE syscall for rt_sigsuspend
is properly setting up a temporary mask in the thread state
tmp_sig_mask:  if an handler is called while a thread is
calling sigsuspend, the mask during the handler run must be
the temporary mask set by sigsuspend.
It is not clear if/where the valgrind sigframe builder/handler
sets the tmp_sig_mask to the value as expected by the user
(i.e. the value of the temporary mask which was given to
the sigsuspend syscall)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16141
2016-11-19 14:54:44 +00:00
Philippe Waroquiers
4e139bdead Fix Bug 372600 - process loops forever when fatal signals are arriving quickly
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16140
2016-11-19 13:51:41 +00:00
Philippe Waroquiers
39c197ef4d Improve the outer/inner setup: have the outer reporting the inner guest stacktrace
Note: the outer now unconditionally report the inner guest stacktrace.
If that would be a problem, we might add a sim-hint no-inner-guest-stacktrace
to optionally disable such outer behaviour.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16139
2016-11-19 13:24:13 +00:00
Philippe Waroquiers
471900460d Add typedef Alloc_Fn_t/Free_Fn_t in pub_tool_basics.h, use them everywhere
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16138
2016-11-18 21:54:09 +00:00
Philippe Waroquiers
7646bee8ed Fix sym name cache: handles the difference between text and data, + match in symbol
* sym name cache to cache the 'isText' characteristic of the cached sym_name
* implement the match anywhere also in the cache
Not handling matchAnywhere has bad performance effect on callgrind, as almost many
IPs were considered as a fn entry, while they were not.
* use the same convention to name the findText argument



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16136
2016-11-12 22:55:35 +00:00
Philippe Waroquiers
5a340ec0c6 When --show-below-main=no, search main from the outermost stackframe
* main is more likely to be an outermost frame rather than an innermost
  frame. So, searching from the outermost frame will more quickly find it.

* Also, in case the stacktrace contains twice the main functionn, this
  ensures we only removes the functions below the outermost main.
  Having 2 mains in a stacktrace does not happen normally.
  However, this prepares for some future commit that improves
  the outer/inner setup: the outer will append the inner guest stack trace.
  The inner stack trace sometimes already contains main.
  Searching from outermost frame main allows to keep the interesting
  part of the stacktrace.
  


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16135
2016-11-12 20:11:25 +00:00
Ivo Raisr
7a3b6b860f Provide Solaris specifics in coregrind/m_gdbserver/README_DEVELOPERS
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16130
2016-11-11 14:47:33 +00:00
Philippe Waroquiers
907b31a9e0 Addition of the options --xtree-memory and --xtree-memory-file
Option is added, parsed, explained in --help
but is not used yet by any other code.
So, apart of the --help, no functional effect.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16124
2016-11-11 14:15:45 +00:00
Philippe Waroquiers
f9386afa89 Addition of the pub_tool_xtree.h and pub_tool_xtmemory.h modules, and of the --xtree-memory* options
This commit is the bulk of the new code.
There is however no functional impact yet : the new modules are not used by anybody.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16123
2016-11-11 14:07:03 +00:00
Philippe Waroquiers
b86956b6b9 Add VG_(strIsMemberXA) in pub_tool_xarray.h
This allows to search more efficiently a string in an xarray of string.
(support work for xtree)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16122
2016-11-11 13:55:07 +00:00
Philippe Waroquiers
72160b3fef Implement a cache 'address -> symbol name' in m_debuginfo.c
Support work for xtree: as xtree implementation makes a high
nr of calls to get_sym_name, this cache improves the performance
as usually, stacktraces are repeatitively querying the same
addresses.
The cache follows the same principle as the cfsi_m_cache.
In particular, cache is cleared together with the cfsi_m cache.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16121
2016-11-11 13:38:18 +00:00
Philippe Waroquiers
599a062f61 Support pool of unique string in pub_tool_deduppoolalloc.h
This is support code for the xtree implementation.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16120
2016-11-11 13:30:08 +00:00
Mark Wielaard
696a45f8c9 Bug #372120 - c++ demangler demangles symbols which are not c++.
Explicitly check that the symbol starts with "_Z" to only demangle
modern style (gnu_v3) mangled C++ (and Rust) symbols.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16118
2016-11-07 14:24:26 +00:00
Petar Jovanovic
464c172041 mips: Add redir for index function in ld.so.1
Redirect index function in ld.so.1.
Optimize the existing strlen function implementations.
This removes warnings coming from optimized index and strlen functions
in ld.so.1.

Patch by Aleksandar Rikalo.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16117
2016-11-04 18:21:22 +00:00
Rhys Kidd
ccc8f80b4f Fix compile error on macOS introduced in r16111. n-i-bz.
m_syswrap/syswrap-generic.c:4148:26: error: use of undeclared identifier 'PID_EXEPATH'
      VG_(sprintf)(name, PID_EXEPATH, VG_(getpid)());
                         ^
m_syswrap/syswrap-generic.c:4150:56: error: use of undeclared identifier 'SELF_EXEPATH'
          && (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, SELF_EXEPATH))) {
                                                       ^
m_syswrap/syswrap-generic.c:4150:56: error: use of undeclared identifier 'SELF_EXEPATH'
m_syswrap/syswrap-generic.c:4151:29: error: use of undeclared identifier 'SELF_EXEFD'
         VG_(sprintf)(name, SELF_EXEFD, VG_(cl_exec_fd));
                            ^

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16116
2016-11-04 03:43:28 +00:00
Julian Seward
4aefde3b13 Add demangling support for Rust symbols. Derived from a patch by
David Tolnay <dtolnay@gmail.com>.  n-i-bz.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16115
2016-11-03 10:50:42 +00:00
Ivo Raisr
7708e249b8 Support '%' in symbol Z-encoding.
Fixes BZ #371869.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16112
2016-11-02 21:50:19 +00:00
Philippe Waroquiers
46f6a5f92d Some small optimisation+some code reformatting
* Use stack arrays instead of malloc/free
* ensure  msghdr_foreachfield does one single call to foreach_func
  for consecutive fields
* some small code reformatting or factorisation

Tested on linux, hoping it also works on solaris



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16111
2016-11-02 20:59:51 +00:00
Petar Jovanovic
5fba00cd1f mips: add POST function to sys_prctl
Add missing POST wrapper for sys_prctl.
This fixes regressions from r15934 (on MIPS32 platforms) and r16003
(on MIPS64 platforms).

Related test: memcheck/tests/threadname


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16110
2016-11-01 18:28:26 +00:00
Philippe Waroquiers
54a1e7856d 371412 Rename wrap_sys_shmat to sys_shmat like other wrappers
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16109
2016-11-01 15:00:45 +00:00
Philippe Waroquiers
3553ac9aad Add some more comments in pub_tool_debuginfo.h about memory persistence/ownership
and have m_debuginfo.c referencing these comments.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16106
2016-10-25 20:46:00 +00:00
Ivo Raisr
a32762d529 Solaris: Add wrapper for fcntl(F_DUPFD_CLOEXEC)
n-i-bz



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16105
2016-10-25 04:55:35 +00:00
Rhys Kidd
f6d7adf7e9 bzero is non-POSIX (deprecated), accordingly __bzero template required for all macOS versions. n-i-bz.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16103
2016-10-23 21:31:16 +00:00
Julian Seward
0661bc7e60 Merge from branches/VALGRIND_3_12_BRANCH:
16095 Build fixes for MacOS X 10.10.5.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16099
2016-10-23 05:56:27 +00:00
Petar Jovanovic
5645228957 mips: fix coredump creation in Valgrind
Coredumps created for MIPS are not valid today. Update the list of
registers that have to be saved, and use the structure defined in
kernel.

Patch by Aleksandar Rikalo.
It fixes BZ#351692.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16080
2016-10-19 17:49:06 +00:00
Julian Seward
1f48abf565 "You need libc6-dbg" help message could be more helpful. Fixes #359645.
Patch from Sami Liedes (sami.liedes@iki.fi)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16078
2016-10-19 16:13:29 +00:00
Julian Seward
71b25c5da3 Add support for Linux perf-events ioctls. Fixes #368419.
Patch from Keno Fischer (keno@juliacomputing.com).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16077
2016-10-19 16:08:25 +00:00
Julian Seward
33b32326e0 Bug 368120 - x86_linux asm _start functions do not keep 16-byte
aligned stack pointer.  Patch from chh@google.com.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16075
2016-10-19 06:00:32 +00:00
Julian Seward
01492a3544 Fix run_a_thread_NORETURN assembly code typo for VGP_arm64_linux target.
Fixes #368823.  Patch from chh@google.com.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16074
2016-10-18 17:31:53 +00:00
Julian Seward
766292973d Add to Memcheck a flag --ignore-range-below-sp=<offset>-<offset>, for
ignoring accesses on the stack below SP.  Serves as a more modern
replacement for --workaround-gcc296-bugs, which is now deprecated.
Fixes #360571.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16073
2016-10-18 17:16:11 +00:00
Ivo Raisr
073273ce50 Follow up for r16044.
Fix compilation problem on Solaris.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16045
2016-10-16 21:09:40 +00:00
Philippe Waroquiers
450928f8aa Further fixes following fix of leak in 16033
Rerunning valgrind under valgrind shows that interp_name and interp_args
memory was freed twice.
=> reworked the way interp_name and interp_args are freed:
* free them in VG_(ii_create_image) (linux/darwin/solaris)
* everywhere else, when overriden, first free the current value
* everywhere where interp_name or interp_args are freed, set them to NULL

With this, re-selfhosting valgrind shows no leak and no corruption
for interp_name and interp_args.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16044
2016-10-16 17:20:53 +00:00
Philippe Waroquiers
7ac00163a3 fix 369468 Remove quadratic metapool alg. using VG_(HT_remove_at_Iter)(VgHashTable *table)
Based on a patch from Ruurd Beerstra
but reworked VG_(HT_remove_at_Iter) so that
the function is implemented without touching the rest of m_hashtable.c
to ensure no performance impact on other hash table usages.

Testing with
for f in 1 2 3 4 5 6 7 8 9; do echo $f;  time ./vg-in-place -q ./memcheck/tests/leak-autofreepool 2 $(expr $f \* 100000); done|&grep user

With the patch :
user	0m0.524s
user	0m0.660s
user	0m0.784s
user	0m0.916s
user	0m1.064s
user	0m1.192s
user	0m1.316s
user	0m1.496s
user	0m1.632s

Without the patch, the same gives:
user	0m4.464s
user	0m16.776s
user	0m24.472s
user	1m5.544s
user	1m21.168s
user	1m40.500s
user	1m54.884s
user	4m58.308s
user	5m34.060s



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16041
2016-10-15 09:30:39 +00:00
Petar Jovanovic
ed74dc8a27 mips: allow Valgrind to be compiled for soft-float
Force "hardfloat" mode for inline assembly that uses FPU instructions,
but pop original mode at the end of the assembly. Unhandled FPU
instructions will be handled by the signal handler (env_unsup_insn).

Skip MIPS specific tests for FPU if the code gets compiled for soft-
float.

This should allow Valgrind to be compiled as a soft-float binary, but
that executable should be used for soft-float systems only.

Related VEX change - r3261.
Related issue - BZ#351282.

Patch by Aleksandar Rikalo.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16039
2016-10-12 15:13:27 +00:00
Philippe Waroquiers
f8b9c86a6a Fix corruption introduced by revision 16033
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16036
2016-10-10 19:33:38 +00:00
Philippe Waroquiers
bf71990613 Fix some (small) leaks found by self-hosting valgrind
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16033
2016-10-09 20:27:48 +00:00
Petar Jovanovic
6e45ce45ac mips32: add pselect6 to the list of supported syscalls
Add pselect6 to the list of supported syscalls on MIPS32.
It fixes:

none/tests/pselect_alarm                 (stderr)
none/tests/pselect_sigmask_null          (stderr)

on mips32 platforms.

Patch by Aleksandra Karadzic.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16031
2016-10-07 17:04:33 +00:00
Petar Jovanovic
296bd45ae0 mips32: fix the wrong offset for mmap2()
The offset for mmap2 is specified in 4096-byte units, not page size
units.

Patch by Duncan Palmer <dpalmer@digisoft.tv>.

It fixes BZ#352197.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16026
2016-10-06 17:46:14 +00:00
Mark Wielaard
dc24612c87 Add a warning to the get/set_thread_area wrapper for bad info pointers.
Also adjust the scalar.stderr.exp to catch the new warnings.

Patch by Julian Seward <jseward@acm.org>

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16025
2016-10-05 19:51:53 +00:00
Petar Jovanovic
ddc3b67f41 mips: replace use of (d)addi with (d)addiu
Replace use of daddi/addi with daddiu/addiu.
This is more R6-friendly and we actually want to use the instructions
that do not cause integer overflow exception.

Patch by Vicente Olivert Riera.

Related issue - BZ#356112.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16018
2016-10-05 14:16:25 +00:00
Petar Jovanovic
fb8ddbf24a mips64: support for prctl(GET/SET_FP_MODE) syscalls
Add MIPS specific wrapper for prctl(GET/SET_FP_MODE) syscalls to
support FP32/FP64 mode switch.

Patch by Aleksandar Rikalo.

Related VEX change r3253.

Related bug - BZ #366079.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16003
2016-10-04 15:19:10 +00:00
Philippe Waroquiers
ff149206f5 Well, 5 seconds is too short for me to type a attach pid command
so increase to 8 seconds.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16000
2016-10-01 14:10:59 +00:00