999 Commits

Author SHA1 Message Date
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
eb219c4398 Fix symbol name typo (correct: DARWIN_VERS wrong: DARWIN_VERSION).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14694
2014-11-05 21:27:36 +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
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
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
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
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
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
Florian Krohm
9959f9acb0 Constify m_oset, m_sparsewa, and m_wordfm.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14640
2014-10-18 16:17:13 +00:00
Florian Krohm
f5e2bdbddc Change the definition of VgHashTable to not have pointer type.
This is (a) consistent with how the other containers are defined
and, more importantly, (b) allows the constification of the hash table API.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14639
2014-10-18 10:58:05 +00:00
Julian Seward
f015e52c05 -Wmissing-enum seems to have arrived at the MacOS builds for some
reason, and complains about missing cases in sr_isError, sr_Res,
sr_ResHI, sr_Err.  Add cases to keep it happy.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14634
2014-10-17 15:05:01 +00:00
Florian Krohm
77c3a4ef7c Merge revisions 14210 and 14626 from the BUF_REMOVAL branch to trunk.
Change VG_(resolve_filename) to not truncate the result which is returned
in a static buffer now. Fix callsites.
Simplify VG_(di_notify_pdb_debuginfo) to use VG_(resolve_filename).
Fix VG_(readlink) prototype.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14628
2014-10-14 21:01:33 +00:00
Florian Krohm
5929994d48 Merge revisions 14230, 14602, and 14604 from the BUF_REMOVAL branch to trunk.
The change eliminates the fixed size buffers in gen_suppression and
show_used_suppressions. This is achieved by changing the return type from
VG_TDICT_CALL(tool_get_extra_suppression_info and
VG_TDICT_CALL(tool_print_extra_suppression_use from Bool to SizeT.
A return value of 0 indicates that nothing (except the terminating '\0'
which is always inserted) was written to the buffer. This corresponds to the
previous False return value. A return value which is equal to the buffer
size (that was passed in as function argument) indicates that the buffer was
not large enough. The caller then resizes the buffer and retries.
Otherwise, the buffer was large enough.
Regtested with a resize value of 1.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14606
2014-10-07 14:28:52 +00:00
Florian Krohm
2891e3ceaa Followup to r14600. Copy the contents of pub_core_guest.h to pub_tool_guest.h
to make it available to tools. This allows to remove quite a bit of
ifdeffery from memcheck's mc_machine.c


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14601
2014-10-06 21:04:14 +00:00
Florian Krohm
76575e29cf Merge 14206,14207,14261,14577,14578 from BUF_REMOVAL branch to trunk.
This changes VG_(record_startup_wd) to dynamically allocate a large
enough buffer for the directory name. As the dynamic memory manager has
started up a while ago, this is quite safe. Also rewrite VG_(get_startup_wd)
to simply return the directory name. No more messing with copying it
around. Adapt call sites.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14579
2014-09-27 17:42:07 +00:00
Christian Borntraeger
3b8b96e924 implement KVM_KVMCLOCK_CTRL. Interestingly, the kernel does not check
the parameter. QEMU does pass 0 nevertheless as parameter.

bugzilla:  [Bug 339424] Full support of KVM ioctl


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14569
2014-09-26 18:44:40 +00:00
Florian Krohm
e383c673dd Ripple from constifying parameters of instrumentation functions and
callbacks from VexTranslateArgs. See VEX r2958.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14564
2014-09-24 12:06:55 +00:00
Philippe Waroquiers
80f3d4e69a Handle explicitely all enum values in 'switch' on AddrInfo tag
(reported by Florian)

Note that Addr_Undescribed will cause an assert if such
an undescribed addrinfo is pretty printed, as normally
such addrinfo should always be described before being pretty printed.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14558
2014-09-19 18:58:18 +00:00
Florian Krohm
16a796694c Remove a comment that is no longer valid. The real reason we (now)
don't provide strtoll etc is that we don't need the flexibility and
are too lazy to implement the general case :) But that does not
warrant a comment in the code.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14540
2014-09-15 20:18:39 +00:00
Florian Krohm
c88dc7f039 Tidy up m_xarray.c.
VG_(newXA) and VG_(cloneXA) never return NULL. Remove pointless asserts.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14539
2014-09-15 18:50:17 +00:00
Florian Krohm
bbc6e90d5b Document NULL-ness of the return value of the dedup allocation functions.
Avoid conflict with reserved name 'free'.
Remove a few pointless asserts.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14538
2014-09-15 07:21:36 +00:00
Florian Krohm
1e6ce59bc5 Document that VG_(newPA) and VG_(allocEltPA) never return NULL.
Remove a few pointless asserts.
Avoid conflict with reserved name 'free'.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14537
2014-09-14 22:44:53 +00:00
Florian Krohm
17f4960a2c Document that VG_(newRangeMap) never returns NULL.
Remove pointless asserts.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14536
2014-09-14 22:19:52 +00:00
Florian Krohm
66a167b4c4 Tidy up m_wordfm.
First, as the allocator function does not fail, there is no need
to assert its return value.
Second, remove commented out (since r8765) function VG_(isEmptyFM).
Third, remove VG_(getNodeSizeFM) from the API. The details of the
implementation do not need to be exposed.
Fourth, for consistency require that the copy functions for keys and
values in VG_(dopyFM) (which are essentially like allocators) return
non-NULL values for non-NULL arguments if they return.
Fifth, document NULL-ness of return values for VG_(newFM), VG_(dopyFM),
and VG_(newBag). Remove pointless asserts at call sites.
Six, change avl_dopy to assert that the node the function is
supposed to copy is not NULL. It is called that way anyhow. With 
that change the function never returns NULL which allows us to
simplify the call sites. Checking the return value is no longer needed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14535
2014-09-14 22:11:44 +00:00
Florian Krohm
6790a772de Document that VG_(newSWA) never returns NULL (because its
allocation function does not). Audit call sites.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14533
2014-09-13 22:39:31 +00:00
Florian Krohm
a51a7bb1db Document the NULL-ness of the return values of HT_construct and HT_to_array.
Audit call sites.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14532
2014-09-13 22:31:13 +00:00
Florian Krohm
2aa67544d6 Tidy up m_oset.c
- Document that the allocation function must ot return NULL.
- As a conequence of the previous requirement the various Create and AllocNode
  functions cannot return NULL. Remove pointless asserts at call sites.
- Remove documentation of undefined function  CreateWithCmp.
- Names of library functions (such as 'free') are reserved as a are names
  beginning with underscores. Don't use those.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14531
2014-09-13 22:04:33 +00:00
Florian Krohm
3b95ad549a Use wrapper functions VG_(malloc) and friends consistently across the
board (instead of e.g. VG_(arena_malloc)(VG_AR_CORE,...). This change
also benefits static analysers. We can tell tools that VG_(malloc) allocates
and VG_(free) deallocates and that they are a pair. But we cannot do that for 
arena_malloc/free.
Also provide a wrapper VG_(realloc_shrink).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14517
2014-09-11 21:19:17 +00:00
Florian Krohm
4754dd70f2 Rename VG_(malloc_usable_size) to VG_(cli_malloc_usable_size)
because it operates on the CLIENT arena. Given that VG_(malloc)
operates on the CORE arena, it was unexpected for VG_(mallos_usable_size)
to use a different arena. 
Move function definition to the proper place (next to VG_(cli_malloc))
and fix call sites.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14516
2014-09-11 20:15:23 +00:00
Mark Wielaard
5633e22712 Bug 338974 glibc 2.20 changed size of struct sigaction sa_flags on s390
To track POSIX glibc and the kernel agreed to change the type of the
sa_flags field in struct sigaction to an int. There is now a int
__glibc_reserved0 padding field that can be passed undefined.
See https://sourceware.org/ml/libc-alpha/2014-09/msg00161.html

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14508
2014-09-10 12:08:15 +00:00
Julian Seward
50618eb024 Improved argument checking for sys_kcmp. Derived from patch from
Christian Borntraeger.  Followup to r14451.  Pertains to #338106.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14473
2014-09-05 21:11:18 +00:00
Christian Borntraeger
4952a40890 add more system call numbers for s390. While we are at it
also wire up the common linux kcmp system call.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14461
2014-09-04 19:57:17 +00:00
Julian Seward
775ae0473b Patch adding support for V4L2/media ioctls. Patch from Hans Verkuil
(hverkuil@xs4all.nl).  Fixes #338023.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14455
2014-09-04 11:08:45 +00:00
Julian Seward
29797aa4c0 Add Xen 4.4 evtchn ioctl wrappers. Patch from Antony Saba
(antony.saba@fireeye.com).  Second of two patches from #337740.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14454
2014-09-04 11:02:24 +00:00
Julian Seward
a4830754d0 Add support for Xen hypercalls used by libvmi. Patch from Antony Saba
(antony.saba@fireeye.com).  First of two patches from #337740.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14453
2014-09-04 10:59:50 +00:00
Julian Seward
8f579dba61 Add support for sys_kcmp. Patch from Chris Jones
(cjones.bugs@gmail.com).  Fixes #338106.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14451
2014-09-04 10:17:08 +00:00
Julian Seward
7e3f04874a Improvements for Android:
* All Linux targets: add minimal ioctl support for the ION_IOC family

* Android targets: change proprietary-ioctl support for GPUs from
  being a build-time #define kludge to being controlled by --kernel-variant,
  as it should be.  Update documentation accordingly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14440
2014-09-03 15:19:25 +00:00
Tom Hughes
612c18619d Add support for some more tun/tap ioctls. BZ#315952.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14432
2014-09-02 12:54:29 +00:00
Julian Seward
506af73036 VG_(getdents64) is only needed on Linux, and causes build problems
on Darwin, so make it exist only on Linux.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14421
2014-09-01 22:26:18 +00:00
Julian Seward
fd963d5022 Add a missing VKI_ prefix. No functional change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14417
2014-09-01 21:25:03 +00:00
Florian Krohm
5f03bb301d Followup to r13469. lineno has already been asserted to be != NULL.
No need to check it again.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14413
2014-09-01 21:03:54 +00:00
Julian Seward
0b41710542 Rename a bunch of __unused fields to __unused0, since some Android
NDK's appear to #define __unused to __attribute__((__unused__)),
causing the build to fail in bizarre ways.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14412
2014-09-01 20:50:56 +00:00
Petar Jovanovic
27823080d3 mips64: add missing system call numbers
r14384 introduced use of getdents64 syscall and we missed a system call
value for MIPS64, so it broke the build for it. Add missing values now.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14409
2014-09-01 16:47:34 +00:00