Commit Graph

4722 Commits

Author SHA1 Message Date
Julian Seward
548a64bfef * add a logging mechanism to show repeated messages at exponentially
declining rates, so as to reduce the amount of junk spewed out by
  the various support functions for the MacOS syscall wrappers.

* add a couple more cases to the resync filter for Yosemite.  This
  is working pretty well now.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14725
2014-11-15 10:29:57 +00:00
Florian Krohm
ff08422233 Pass buffer size to VG_(elapsed_wallclock_time) so the function
can check it's large enough.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14724
2014-11-14 22:34:40 +00:00
Florian Krohm
e7020c5a7e Minor non-functional cleanups.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14723
2014-11-14 19:25:08 +00:00
Florian Krohm
8293498c84 m_compiler.c was added to noinst_HEADERS but should of course
be added to COREGRIND_SOURCES_COMMON. Now fixed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14722
2014-11-14 14:47:12 +00:00
Florian Krohm
ac3b22e6af Merge revisions 14445 and 14446 from the BUF_REMOVAL branch to trunk.
Two things:
- remove the buffer argument from VG_(DebugInfo_sect_kind)
- allocate AddrInfo::SectKind::objname dynamically


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14719
2014-11-13 21:41:28 +00:00
Julian Seward
2b9da24a5c * add syscall wrappers for some new OSX 10.10 specific calls
necp_match_policy
    sysctlbyname
      getattrlistbulk (kludged)

* add initial entries for the resync-filter on OSX 10.10.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14718
2014-11-13 16:30:09 +00:00
Mark Wielaard
560e558b88 Bug 340922 arm64: unhandled getgroups/setgroups syscalls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14716
2014-11-13 13:03:25 +00:00
Philippe Waroquiers
4c0e46ecd8 Follow up 14714: use a real malloc cost centre instead of an empty string
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14715
2014-11-12 21:10:37 +00:00
Philippe Waroquiers
77f136cef4 Implement Option --error-markers=<begin>,<end>
* This option can be used to mark the begin/end of errors in textual
output mode, to facilitate searching/extracting errors in output files
mixing valgrind errors with program output.

* Use the new option in various existing regtests to test the various
  possible usage.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14714
2014-11-12 19:43:29 +00:00
Julian Seward
cf3f0c09cb PRE(mach_msg) on OSX 10.10 64-bit: replace failing assertion
vg_assert(! (mh->msgh_bits & MACH_SEND_TRAILER));
with a warning message, but let it continue.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14711
2014-11-11 12:46:19 +00:00
Tom Hughes
b8308dd756 Add support for the getrandom system call. BZ#340788.
Requires r14705 for updated system call lists.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14709
2014-11-10 09:55:59 +00:00
Julian Seward
013876996a MacOSX 10.10: Resolve "UNKNOWN attrlist flags 0:0x10000000. Fixes
#340722.  Patch from Rhys Kidd (rhyskidd@gmail.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14708
2014-11-10 07:26:43 +00:00
Florian Krohm
479e0e5b54 Fix a bug spotted by IBM's BEAM checker in VG_(describe_IP).
In the non-XML part buf_dirname was read without observing the
know_dirinfo guard. Now fixed. Initialise buf_dirname nevertheless.
Also remove a dead assignment.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14707
2014-11-09 21:57:23 +00:00
Florian Krohm
ab2599f4cf Change VG_(mkstemp) such that
(a) the 2nd argument must not be NULL
    This was true anyhow and requiring it allows us to simplify the function
    by eliminating the local buffer.
(b) the memory pointed to by the 2nd argument is always initialised
    In the past the output file name was not initialised in case VG_(open)
    failed 10 times in a row. The call sites in m_main.c and m_gdbserver/target.c
    were reading the uninitialised filename unconditionally. This was spotted
    by IBM's BEAM checker.
Fix call sites, eliminate some magic constants along the way.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14706
2014-11-09 16:15:23 +00:00
Philippe Waroquiers
993eded14d Comment only changes.
* Clarify in the dedup pool comments that all bytes of elements are compared.
* pub_core_options.h : remove old/misplaced comment for clo_trace_children
                       and replace by a more clear comment (matching the --help)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14704
2014-11-07 22:16:27 +00:00
Julian Seward
6f2d1b4dd5 Add a no-op wrapper for a new-in-10.10 syscall: getattrlistbulk
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14701
2014-11-07 00:05:56 +00:00
Julian Seward
a2ca87cf7b Adds initial support for new syscalls on MacOS X 10.10, including new
syscall numbers, and dummy wrappers for bsdthread_ctl and
sysctlbyname.  Mash up of patches from fxcoudert@gcc.gnu.org and Rhys
Kidd (rhyskidd@gmail.com).  Part of bug 339045.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14698
2014-11-06 20:29:01 +00:00
Julian Seward
b08260a158 On MacOS X 10.10, when postprocessing tool executables, set the SVMA
of __PAGEZERO to zero.  Without this, the 10.10 kernel refuses to
start these executables.  Based on investigations and a
proof-of-concept implementation by Rhys Kidd (rhyskidd@gmail.com).
Part of bug 339045.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14697
2014-11-06 20:23:22 +00:00
Julian Seward
ba74ff2302 On MacOS X 10.10, provide a dummy definition for voucher_mach_msg_set.
Not sure why this is necessary, but without it, the tool executables
don't link.  Part of bug 339045.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14696
2014-11-06 20:20:01 +00:00
Josef Weidendorfer
b30ac05feb Compile (arm). Fix typo from r14664
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14693
2014-11-05 19:46:21 +00:00
Julian Seward
627046a073 Back out the darwin-specific part of r14683, since darwin doesn't
appear to have SHM_HUGETLB, and it causes build failures.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14692
2014-11-05 15:54:21 +00:00
Philippe Waroquiers
559955c15d Unmask all signals in vgdb, as the process that launches vgdb
might have masked some.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14691
2014-11-04 20:28:36 +00:00
Julian Seward
b519f73307 Adds initial support for AArch64 (arm64) on Android. Small programs
(/system/bin/ls, /system/bin/date) run.  Still to do:

* enable more malloc/free intercepts

* enable wrappers for ashmem and binder syscalls

* check to see if any special ioctl support is required for ARM Mali GPUs



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14690
2014-11-04 17:44:21 +00:00
Julian Seward
59b90d186c PRE(sys_openat): when checking whether ARG1 == VKI_AT_FDCWD, be sure
only to check the lowest 32 bits, since that arg is a file descriptor
-- hence "int" -- and checking all 64 bits fails unexpectedly if ARG1
and VKI_AT_FDCWD are not both zero- or sign- extended.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14689
2014-11-04 17:35:04 +00:00
Mark Wielaard
a83732ca72 Bug 340630 arm64: fchmod (52) and fchown (55) syscalls not recognized.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14686
2014-11-04 13:43:21 +00:00
Florian Krohm
d2723ddc9b Merge r14308 from the BUF_REMOVAL branch to trunk
Changes VG_(describe_IP) to return the untruncated result in a statically
allocated local buffer. Fix call sites and update two .exp files who had
truncated names.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14685
2014-11-03 22:43:42 +00:00
Philippe Waroquiers
80ae5a2395 fix 338995 shmat with hugepages (SHM_HUGETLB) fails with EINVAL
Bug is not really fixed, instead the SHM_HUGETLB flag is ignored.
Note that it is not straightforward to properly fix this,
as this implies either to learn aspacemgr what huge pages are.
Also, the trick used in the fix for 333051 cannot be used easily,
because the SHM_HUGETLB flag is given in shmget, while the mmap
is done in shmat.

So, the easiest is to just ignore the SHM_HUGETLB flag.

SHM_HUGETLB is supposed to only give a performance impact.
Ignoring it should be benign.
Theoretically, the caller might expect a sucessful shmget(SHM_HUGETLB)+shmat
to give pages aligned on e.g. 1MB.
In this case, bad luck, the program will misbehave under valgrind.
To warn of this, a warning is given (once) when SHM_HUGETLB is seen.

The map_unmap.c test has been restructured somewaht to allow
TEST_SHM_HUGETLB to be tested independently (or not) of the TEST_MAP_HUGETLB.

Note also that by default, testing  MAP_HUGETLB and SHM_HUGETLB
is disabled as usually, huge pages are not enabled.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14683
2014-11-01 22:00:50 +00:00
Philippe Waroquiers
41610f34c2 Fix 333051 mmap of huge pages fails due to incorrect alignment
Learning aspacemgr to handle huge page is too difficult.
So, huge page requests that fails due to bad advice by aspacemgr
will (we hope) succeed if a mmap retry is done with the kernel,
without any constraints.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14682
2014-11-01 21:02:13 +00:00
Florian Krohm
645563670a Merge revisions 14222, 14268, and 14270 from the BUF_REMOVAL branch to trunk.
Assorted fixes in exp-bbv to eliminate a few buffers.
Implement a suggestion found in the massif source, namely to add the
equivalent of fprintf to m_libcprint. Good suggestion. Thusly
- VgFile: similar to FILE; buffered output, 8k buffer
- VG_(fopen): similar to fopen, but with arguments as in VG_(open)
- VG_(fprintf) and VG_(vfprintf): like [v]fprintf with VgFile 1at argument
- VG_(fclose)
Change massif, exp-bbv and cachegrind to use this functionality.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14678
2014-10-30 22:17:56 +00:00
Julian Seward
2bf85a3929 Bug 340236 - 4 unhandled syscalls on aarch64/arm64:
mknodat (33), fchdir (50), chroot (51), fchownat (54)
Patch from Miroslav Franc (mfranc@redhat.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14677
2014-10-30 14:28:14 +00:00
Julian Seward
9d5584da64 Bug 340028 - unhandled syscalls for arm64 (msync, pread64, setreuid
and setregid)
Patch from dimitry@google.com.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14676
2014-10-30 14:11:32 +00:00
Julian Seward
640fd43da7 Bug 339940 - (arm64/aarch64) unhandled syscall: 83 (sys_fdatasync) + patch
Patch from David Abdurachmanov <davidlt@cern.ch>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14675
2014-10-30 13:54:24 +00:00
Florian Krohm
b21985c758 Configury and Makefile tweaks to support compilation with Intel's
ICC Compiler. Patch mostly by Gregory Czajkowski <gregczajkowski@yahoo.com>.
Fixes BZ #339542.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14674
2014-10-29 13:57:49 +00:00
Florian Krohm
489cc7d5e0 New file m_compiler.c
Provides implementations of __builtin_popcount/clz/ctz which some
older GCCs do not provide.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14673
2014-10-29 08:21:18 +00:00
Florian Krohm
d7cc7eac99 Merge revisions 14255, 14293, and 14294 from the BUF_REMOVAL branch to trunk.
The functions VG_(get_filename) and VG_(get_filename_lineno) now return
a pointer to filename and directory name instead of copying them into
buffers passed in from the caller.
The returned strings are persistent as long as the DebugInfo to which
they belong is not discarded. The caller therefore needs to stash them
away as needed.
Function VG_(strncpy_safely) has been removed as it is no longer needed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14668
2014-10-27 12:06:35 +00:00
Florian Krohm
665280aeaf Merge r14202 from the BUF_REMOVAL branch to trunk.
This patch changes the interface and behaviour of VG_(demangle) and
VG_(maybe_Z_demangle). Instead of copying the demangled name into a
fixed sized buffer that is passed in from the caller (HChar *buf, Int n_buf),
the demangling functions will now return a pointer to the full-length
demangled name (HChar **result). It is the caller's responsiblilty to
make a copy if needed. 

This change in function parameters ripples upward
- first: to get_sym_name
- then to the convenience wrappers
  - VG_(get_fnname)
  - VG_(get_fnname_w_offset)
  - VG_(get_fnname_if_entry)
  - VG_(get_fnname_raw)
  - VG_(get_fnname_no_cxx_demangle)
  - VG_(get_datasym_and_offset)

The changes in foComplete then forces the arguments of
  - VG_(get_objname) to be changed as well

There are some issues regarding the ownership and persistence of
character strings to consider.
In general, the returned character string is owned by "somebody else"
which means the caller must not free it. Also, the caller must not 
modify the returned string as it possibly points to read only memory.
Additionally, the returned string is not necessarily persistent. Here are
the scenarios:
- the returned string is a demangled function name in which case the
  memory holding the string will be freed when the demangler is called again.
- the returned string hangs off of a DebugInfo structure in which case
  it will be freed when the DebugInfo is discarded
- the returned string hangs off of a segment in the address space manager
  in which case it may be overwritten when the segment is merged with
  another segment
So the rule of thunb here is: if in doubt strdup the string.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14664
2014-10-25 19:20:38 +00:00
Julian Seward
9b30a092c4 Add --resync-filter to the --help output.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14662
2014-10-23 21:49:58 +00:00
Julian Seward
e6f2f12879 Darwin only: add a filter mechanism that aims to remove pointless
memory-map resync operations.  Without the filter, such operations
come to dominate the running time of complex apps with thousands of
memory segments (eg Firefox) and it becomes unusably slow.  With
the filter in place, the huge performance loss is mostly avoided.

Has no meaning and no effect on non-Darwin targets.  Controlled by
flag --resync-filter=no|yes|verbose [yes].  Filter is currently only
set up for Mac OS X 10.9 (Mavericks) 64 bit and will not produce
any performance benefit on any other configuration.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14661
2014-10-23 19:48:01 +00:00
Julian Seward
17c050916e Enable reading of Dwarf2 frame-unwind info on MacOS. It seems
as if more recent XCodes rely on it.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14660
2014-10-23 19:44:21 +00:00
Florian Krohm
aa6abf5a1d 2 pints later: more coregrind constification.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14659
2014-10-23 17:47:15 +00:00
Julian Seward
e762d15d5f Add a bit of casting to avoid a compiler warning following recent
const-ification.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14658
2014-10-23 14:14:49 +00:00
Florian Krohm
1f8a4084b9 Followup to r14656. Fix compile problem on Darwin.
Patch by Rhys Kidd <rhyskidd@gmail.com>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14657
2014-10-23 11:38:12 +00:00
Florian Krohm
a3a57c92df Constify coregrind.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14656
2014-10-22 22:25:30 +00:00
Florian Krohm
8f0654600d Constify a variable.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14655
2014-10-22 20:35:27 +00:00
Florian Krohm
d0dd4cbf30 Change VG_(allocEltDedupPA) to return a pointer to const. The reason is
that once an element has been allocated and added to the pool it must
not be modified afterwards. See the documentation in pub_tool_deduppoolalloc.h
The rest of the patch is ripple.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14654
2014-10-22 17:42:37 +00:00
Florian Krohm
070ad41c3b Enable -Wcast-qual when compiling the valgrind source.
Testcases are not compiled with -Wcast-qual.
Introduce CONST_CAST macro to work around in the few spots
where a cast that drops type qualifiers is needed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14652
2014-10-22 12:53:16 +00:00
Florian Krohm
20859ce978 Change the initialisation of the newly allocated struct sched_lock
object. Just memset the whole thing to 0. That avoids a cast that
drops type qualifiction.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14650
2014-10-22 09:44:34 +00:00
Florian Krohm
17fe8c0a09 Add support for ioctl(fd, TIOCSIG, signal_number) which used
to issue a false complaint. Fixes BZ #339706
Source patch by David Herrmann (dh.herrmann@gmail.com).
Testcase by myself.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14646
2014-10-21 07:20:20 +00:00
Florian Krohm
9d16aabb17 Constify the tool interface.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14642
2014-10-20 19:02:38 +00:00
Florian Krohm
aa351c61c1 Constify.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14641
2014-10-18 20:56:13 +00:00