779 Commits

Author SHA1 Message Date
Julian Seward
742df20540 Turn no-op versions of INNER_REQUEST into statements, not values,
since gcc complains about "statement with no effect" or some such for
the simple "0" version.  Also, make the formal parameter names a bit
more unique.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12426
2012-03-07 17:11:44 +00:00
Tom Hughes
1e1da9ff38 Add support for the HCIINQUIRY ioctl.
Patch from Andrew Brampton to fix BZ#283961.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12421
2012-03-07 11:22:42 +00:00
Tom Hughes
137aace5a3 Add support for the I2C_RDWR ioctl.
Patch from arnaud mouiche to fix BZ#286261.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12420
2012-03-07 10:21:33 +00:00
Philippe Waroquiers
74d44d1764 * README_DEVELOPERS : complete/enhance the section about outer/inner
* manual-core.xml : fix a typo
* include/pub_tool_inner.h : new file, defining macros for inner annotation
  include/Makefile.am : reference this new file.
* syswrap-linux.c : when ENABLE_INNER, register the stacks for the outer.
   (otherwise, nothing works properly).
* m_redir.c : avoid inner interpreting the outer vgpreload instructions.
* sema.c : annotate the semaphore with RWLOCK annotations for helgrind
* ticket-lock-linux.c : similar.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12414
2012-03-03 12:01:48 +00:00
Tom Hughes
baec53c5f1 Add support for the sendmmsg and recvmmsg system calls. Fixes BZ#277779.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12376
2012-02-10 11:30:09 +00:00
Tom Hughes
dc42e147f5 Add support for some SCSI ioctls. Patch from Jakub Jelinek on BZ#292627.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12375
2012-02-10 10:41:07 +00:00
Tom Hughes
7104ded0a5 Add support for the F_GETOWN_EX and F_SETOWN_EX fcntl calls.
Patch from Jakub Jelinek to fix BZ#292626.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12373
2012-02-09 12:21:47 +00:00
Tom Hughes
f65fa07cc9 Update linux system call lists.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12370
2012-02-09 11:38:10 +00:00
Bart Van Assche
6153849464 <valgrind/valgrind.h>: Fix for Intel C/C++ compiler in MSVC compatibility mode.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12361
2012-01-31 10:13:51 +00:00
Philippe Waroquiers
ce806ed31f (fixes bug 289939 wish: complete monitor cmd 'leak_check' with details
about leaked or reachable blocks)

This patch implements two new memcheck gdbserver monitor commands:
  block_list <loss_record_nr>
        after a leak search, shows the list of blocks of <loss_record_nr>
  who_points_at <addr> [<len>]
        shows places pointing inside <len> (default 1) bytes at <addr>
        (with len 1, only shows "start pointers" pointing exactly to <addr>,
         with len > 1, will also show "interior pointers")


Compiled and reg-tested on f12/x86, deb5/amd64, f16/ppc64.

The 'block_list' command is implemented on top of the 
lr_array/lc_chunks/lc_extras arrays used during the last leak search.
NB: no impact on the memory for the typical Valgrind usage where a leak
search is only done at the end of the run.
Printing the block_list of a loss record simply consists in scanning the
lc_chunks to find back the chunks corresponding to the loss record for which
block lists is requested.

The 'who_points_at' command is implemented by doing a scan similar to 
(but simpler than) the leak search scan.
lc_scan_memory has been enhanced to have a mode to search for a specific
address, rather than to search for all allocated blocks.
VG_(apply_to_GP_regs) has been enhanced to also provide the ThreadId and
register name in the callback function.

The patch touches multiple files (but most changes are easy/trivial or factorise
existing code).

Most significant changes are in memcheck/mc_leakcheck.c :
    * changed the LC_Extra struct to remember the clique for indirect leaks
      (size of structure not changed).
    * made lr_array a static global
    * changed lc_scan_memory:
        to have a search mode for a specific address (for who_points_at)
        (for leak search) to pass a 'current clique' in addition to the clique
         leader
         so as to have a proper clique hierarchy for indirectly leaked blocks.
    * print_results: reset values at the beginning of the print_result of the
      next leak search, rather than at the end of print_results of the previous
       leak search.
      This allows to continue showing the same info for loss records till a new
      leak search is done.
    * new function print_clique which recursively prints a group of leaked
      blocks, starting from the clique leader.
    * new function MC_(print_block_list) : calls print_clique for each clique
      leader found for the given loss record.
    * static void scan_memory_root_set : code extracted from
      MC_(detect_memory_leaks) (no relevant change)
    * void MC_(who_points_at) : calls scan_memory_root_set, lc_scan_memory
        and VG_(apply_to_GP_regs)(search_address_in_GP_reg) to search 
        pointers to the given address.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12357
2012-01-26 23:13:52 +00:00
Bart Van Assche
deb44ff6f0 Pool allocator: change the semantics of VG_(releasePA)() according to comment http://bugs.kde.org/show_bug.cgi?id=282230#c50.
This change also makes the semantics of releasePA match the semantics of
other release functions, e.g. those in XPCOM (see also http://developer.mozilla.org/en/XPCOM_Interface_Reference/nsISupports#Release%28%29).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12343
2012-01-18 08:12:16 +00:00
Philippe Waroquiers
be97cddd7a Fixes 282230 group allocator for small fixed size, use it for MC_Chunk/SEc vbit
* new files include/pub_tool_groupalloc.h and coregrind/m_groupalloc.c
  implementing a group allocator (based on helgrind group alloc).
* include/Makefile.am coregrind/Makefile.am : added pub_tool_groupalloc.h
  and m_groupalloc.c
* helgrind/libhb_core.c : use pub_tool_groupalloc.h/m_groupalloc.c
  instead  of the local implementation.
* include/pub_tool_oset.h coregrind/m_oset.c : new function
  allowing to create an oset that will use a pool allocator.
  new function allowing to clone an oset (so as to share the pool alloc)
* memcheck/tests/unit_oset.c drd/tests/unit_bitmap.c : modified
  so that it compiles with the new m_oset.c
* memcheck/mc_main.c : use group alloc for MC_Chunk
  memcheck/mc_include.h : declare the MC_Chunk group alloc
* memcheck/mc_main.c : use group alloc for the nodes of the secVBitTable OSet
* include/pub_tool_hashtable.h coregrind/m_hashtable.c : pass the free node
  function in the VG_(HT_destruct).
  (needed as the hashtable user can allocate a node with its own alloc,
  the hash table destroy must be able to free the nodes with the user
  own free).
* coregrind/m_gdbserver/m_gdbserver.c : pass free function to VG_(HT_destruct)
* memcheck/mc_replace_strmem.c memcheck/mc_machine.c
  memcheck/mc_malloc_wrappers.c memcheck/mc_leakcheck.c
  memcheck/mc_errors.c memcheck/mc_translate.c : new include needed
  due to group alloc.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12341
2012-01-17 21:16:30 +00:00
Florian Krohm
b8466723cd Beef up VG_(strerror) to provide correct messages for the
errno codes in asm-generic/errno-base.h (on linux). 
The error strings were obtained by calling strerror natively in
Linux. 
Extend vki-linux.h accordingly. vki-darwin.h already had
those errno codes.
Add testcase. This fixes #287858.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12316
2011-12-24 21:50:53 +00:00
Julian Seward
084b7cb10b Fix #284384 (clang 3.1 -Wunused-value warnings in valgrind.h,
memcheck.h) by changing a bunch of VALGRIND_DO_CLIENT_REQUEST_EXPR
into VALGRIND_DO_CLIENT_REQUEST_STMT for cases where the return value
of the former would be unused.  (Bart Van Assche, bart.vanassche@gmail.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12226
2011-10-24 13:21:57 +00:00
Julian Seward
0d7caa744f Get a bunch more copyright dates in the right format, 20xx-2011,
so the auto-update script will handle them correctly in future.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12207
2011-10-23 07:49:30 +00:00
Julian Seward
c96096ab24 Update all copyright dates, from 20xy-2010 to 20xy-2011.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12206
2011-10-23 07:32:08 +00:00
Florian Krohm
92388bd248 Make VALGRIND_DO_CLIENT_REQUEST more user friendly by wrapping
its replacement in do .. while (0).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12199
2011-10-22 15:04:05 +00:00
Julian Seward
58d0ead76e Enable sys_epoll_pwait on arm-linux. #283427. Derived from
larger patch by John Reiser (jreiser@bitwagon.com).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12177
2011-10-20 13:00:32 +00:00
Josef Weidendorfer
d08c246e3f Fix callgrind part of bug 280757.
For this, we make VG_(tmpdir) available to tools.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12163
2011-10-17 18:12:48 +00:00
Bart Van Assche
c11090abde include/vki/vki-linux.h: Remove __attribute_const__ definition since it
isn't used anywhere inside the Valgrind project.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12111
2011-10-07 09:41:14 +00:00
Bart Van Assche
7dab1bd66a Avoid that using any of the VALGRIND_DISABLE_ERROR_REPORTING,
VALGRIND_ENABLE_ERROR_REPORTING, VALGRIND_DO_ADDED_LEAK_CHECK,
VALGRIND_DO_CHANGED_LEAK_CHECK macros causes gcc 4.6 to print
a warning message about assigning a value to an unused variable.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12110
2011-10-07 09:39:56 +00:00
Bart Van Assche
71a513f01a Format functions: change format specifier %t into %pS. Remove the _no_f_c formatting function variants.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12108
2011-10-06 19:08:37 +00:00
Julian Seward
0eef127a30 ppc64-linux only: fix incorrect line number reports in client requests
that create stack traces.  Fixes #283243.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12101
2011-10-05 07:39:07 +00:00
Julian Seward
fc16ea6412 Make {amd64,x86}-darwin use the direct implementations of
VG_MINIMAL_SETJMP and VG_MINIMAL_LONGJMP introduced in r12067.

With this commit, it should be possible to build a working 64 bit
Valgrind using the default gcc as supplied with Xcode 4.1 on OSX 10.7.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12070
2011-09-29 18:29:41 +00:00
Julian Seward
fee9cdc61e x86-linux, amd64-linux: Implement VG_MINIMAL_SETJMP and
VG_MINIMAL_LONGJMP directly, rather than using __builtin_setjmp
and __builtin_longjmp, since clang-2.9 miscompiles the latter
(by completely ignoring it.)

Also, add comment about the return type for VG_MINIMAL_SETJMP.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12067
2011-09-29 17:33:58 +00:00
Julian Seward
cea6601bf2 Android: add wrappers for ashmem and binder ioctls. From the AOSP
port of Valgrind.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12059
2011-09-27 10:26:52 +00:00
Julian Seward
8885c4e740 Add initial support for Mac OS X 10.7 (Lion). Tracked by bug #275168.
* configure.in support

* new supp file darwin11.supp

* comment out many intercepts in mc_replace_strmem.c and
  vg_replace_malloc.c that are apparently unnecessary for Darwin

* add minimal handling for the following new syscalls and mach traps:
    mach_port_set_context
    task_get_exception_ports
    getaudit_addr
    psynch_mutexwait
    psynch_mutexdrop
    psynch_cvbroad
    psynch_cvsignal
    psynch_cvwait
    psynch_rw_rdlock
    psynch_rw_wrlock
    psynch_rw_unlock
    psynch_cvclrprepost

* wqthread_hijack on amd64-darwin: deal with
  tst->os_state.pthread having an apparently different offset,
  which caused an assertion failure

* m_debuginfo: for 32 bit processes on Lion, use the DebugInfoFSM
  cleanup added in r12041/12042 to handle apparently new dyld
  behaviour, which is to map text areas r-- first and only
  vm_protect them later to r-x.



The following cleanups remain to be done

* remove apparently pointless, commented out wrapper macro
  invokations in mc_replace_strmem.c, eg

  //MEMMOVE(VG_Z_DYLD,        memmove)

  (or determine that they are still necessary, and uncomment)


* ditto in vg_replace_malloc.c, plus general VGO_darwin cleanups
  there


* write proper syscall wrappers for
    mach_port_set_context
    task_get_exception_ports
    getaudit_addr
    psynch_mutexwait
    psynch_mutexdrop
    psynch_cvbroad
    psynch_cvsignal
    psynch_cvwait
    psynch_rw_rdlock
    psynch_rw_wrlock
    psynch_rw_unlock
    psynch_cvclrprepost
  These are currently just no-ops and may be causing Memcheck to
  report false undef-value errors


* figure out why it doesn't work properly unless built with gcc-4.2 on
  Lion.

  gcc-4.2 is the "normal" gcc (i686-apple-darwin11-gcc-4.2.1).  Plain
  gcc is the hybrid gcc-front-end clang-back-end thing
  (i686-apple-darwin11-llvm-gcc-4.2).  Whereas on Snow Leopard, plain
  gcc is the normal gcc.

  The symptoms of the failure are that wqthread_hijack in
  syswrap-amd64-linux.c hits this /*NOTREACHED*/ vg_assert(0); right
  at the end (you need a pretty complex threaded app to trigger this),
  which makes me think that either ML_(wqthread_continue_NORETURN) or
  call_on_new_stack_0_1 do return, which they are not expected to.


* figure out if some of the uninitialised value errors reported in
  system libraries on are caused by Memcheck being confused by LLVM
  generated code, as per bug #242137



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12043
2011-09-21 08:43:08 +00:00
Julian Seward
e1567da7c5 Extend the behavioural-equivalence-class mechanism for redirection
functions to include the ability to give a priority to each function,
as well as a tag indicating its behavioural class.  Add logic in
m_redir.c to resolve conflicting redirections with the same eclass but
different priorities by preferring the redirection with the higher
priority.  Use all of the above in mc_replace_strmem.c, to cause a
conflict between redirections for "memcpy" and "memcpy@GLIBC_2.2.5" to
be resolved in favour of the latter (the non-overlap-checking
version).

This is all related to the massive swamp that is #275284.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11991
2011-08-18 13:09:55 +00:00
Julian Seward
be517f6178 Add more infrastructure to be used for fixing #275284 (Valgrind
memcpy/memmove redirection stopped working in glibc 2.14/x86_64), but
don't fix the problem yet.  Should be no end-user visible change.

* in m_redir.c, when processing redirection specifications, consider
  all the names associated with an address, not just the primary name.

* add plumbing to support the notion of "behavioural equivalence class
  tags" of redirect/wrap functions.  These can be used by m_redir to
  resolve some situations in which the available set of redirect
  specifications causes some address to get redirected to two
  different functions.  (Framework is in place, but such resolution is
  not implemented yet.)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11984
2011-08-16 09:54:00 +00:00
Julian Seward
a043f0a060 Remove the assumption, in m_debuginfo, that each address is associated
with only one symbol.  Instead, allow an address to have arbitrarily
many names.  This reflects reality better, particularly for systemy
libraries such as glibc and ld.so, and is background work needed for
fixing #275284.  This is not in itself a fix for #275284.  A followup
commit to un-break compilation on OSX will follow shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11981
2011-08-15 09:42:34 +00:00
Tom Hughes
d3a38c3b6a Add support for FBIOPUT_VSCREENINFO and FBIOPAN_DISPLAY ioctls.
Patch from Pauli Nieminen <ext-pauli.nieminen@nokia.com> on #263648.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11980
2011-08-15 08:47:29 +00:00
Tom Hughes
ea5e1b6a5e Fix VKI_FIOQSIZE definition on ppc platforms.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11973
2011-08-13 15:14:58 +00:00
Tom Hughes
4a7707d8be Add support for the FIOQSIZE ioctl. Fixes #270320.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11963
2011-08-10 14:25:06 +00:00
Bart Van Assche
167922d29b valgrind.h: Remove a superfluous cast. See also #278454.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11913
2011-07-25 08:45:45 +00:00
Julian Seward
42ada29286 Add a new client request and pair of macros,
VALGRIND_{DISABLE,ENABLE}_ERROR_REPORTING, which allow a thread to
temporarily disable reporting of errors it makes.  This is useful for
making Memcheck behave sanely in the presence of some MPI
implementations.  Also mark up libmpiwrap.c accordingly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11910
2011-07-24 16:02:33 +00:00
Tom Hughes
a7524aa184 Allow core dumps on 32 bit architectures to go over 2Gb in size. BZ#277610.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11893
2011-07-13 09:02:14 +00:00
Florian Krohm
bc494507f2 Synch s390x system call list with linux 2.6.39.2.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11845
2011-06-28 23:37:01 +00:00
Julian Seward
ad7de5b336 Delete the AIX5 port. The last release this worked for is 3.4.1,
and then only on AIX 5.2 and 5.3.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11842
2011-06-28 07:25:29 +00:00
Julian Seward
b4e2ade329 Fix 'make dist' following recent gdbserver commits.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11841
2011-06-27 23:31:07 +00:00
Julian Seward
2acd297ebe Fix #undefs that are inconsistent with those further up the file,
as spotted by Michael Meeks.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11829
2011-06-24 18:26:11 +00:00
Julian Seward
3e9f7836c5 Merge the contents of the HGDEV2 branch into trunk:
* performance and scalability improvements
* show locks held by both threads in a race
* show all 4 locks involved in a lock order violation
* better delimited error messages



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11824
2011-06-24 10:09:41 +00:00
Julian Seward
46d08c579d Minor GDBserver source tidying. Also a small usability fix: if
--vgdb-error=N is specified, print a bit of text telling the user the
magic commands to give GDB in order to attach to the process.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11822
2011-06-18 08:28:04 +00:00
Julian Seward
a12e858c35 Try to handle LL caches which are of size 50% above a power of 2 (eg,
6MB, 12MB) and have a non-power-of-2 number of sets.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11812
2011-06-13 13:14:00 +00:00
Tom Hughes
c5931781bc Teach cachegrind/callgrind how to parse the cache description
in the CPUID data on recent Intel processors.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11810
2011-06-10 15:04:22 +00:00
Tom Hughes
42bc84e869 Add support for prlimit64 on x86 and amd64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11806
2011-06-08 09:55:54 +00:00
Tom Hughes
8bc495c8d7 Update system call lists to match current kernel source.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11805
2011-06-08 09:12:07 +00:00
Tom Hughes
912fe51553 It seems that the perf_counter_open system call was renamed to
perf_event_open some time after we added it, so correct the name
wherever it appears to match the current kernel source.

Also fixup the PRE handler to do the check correctly, using the
size field of the structure to work out how much data there is.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11804
2011-06-08 09:10:40 +00:00
Julian Seward
b1a67076a2 Better checking for command line options that should be either 'yes'
or 'no'.  Fixes #269144.  (a125246@prtnx.com, Florian Krohm
<britzel@acm.org>)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11767
2011-05-17 16:29:29 +00:00
Bart Van Assche
9a36fe677e Get rid of the remaining "set but not used" warnings reported by gcc 4.6 by
swapping the roles of the VALGRIND_DO_CLIENT_REQUEST() and
VALGRIND_DO_CLIENT_REQUEST_EXPR() macros. Also, many __attribute__((unused))
declarations on variables have been eliminated. Closes #269778.

Note: so far this patch has been tested on x86/Linux, amd64/Linux and
ppc64/Linux but not yet on any other supported CPU/OS combination.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11755
2011-05-15 07:04:03 +00:00
Julian Seward
e22276cef0 Tidying up of branch-predict hint macros LIKELY/UNLIKELY. Fixes
#271504.  (Florian Krohm, britzel@acm.org)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11736
2011-05-09 21:54:44 +00:00