56 Commits

Author SHA1 Message Date
Nicholas Nethercote
07045477ca Merge the DARWIN branch onto the trunk.
I tried using 'svn merge' to do the merge but it did a terrible job and
there were bazillions of conflicts.  So instead I just took the diff between
the branch and trunk  at r10155, applied the diff to the trunk, 'svn add'ed
the added files (no files needed to be 'svn remove'd) and committed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10156
2009-05-28 01:53:07 +00:00
Nicholas Nethercote
131ab00744 Merged non-Darwin-specific parts of r9397,r9423,r9490, 9461, 9462 from the
DARWIN branch.  A big ugly DARWIN/trunk sync commit, mostly to do with
changing the representation of SysRes and vki_sigset_t.  Functionality of
the trunk shouldn't be changed by it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9876
2009-05-18 02:12:08 +00:00
Nicholas Nethercote
57a42692d9 Don't compile Linux-only redirects on non-Linux platforms.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9745
2009-05-04 04:20:02 +00:00
Nicholas Nethercote
32bd1a00c2 Merge r9610 (AM_CCASFLAGS tweaks for test Makefiles) from the DARWIN branch.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9611
2009-04-24 20:17:07 +00:00
Nicholas Nethercote
f3f801ed48 Merge r9533..9536 (add tests/{asm.h,sys_mman.h,malloc.h} from the DARWIN
branch.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9537
2009-04-15 03:12:43 +00:00
Julian Seward
e3ef0cf4e7 Handle accesses to new pseudo-register IP_AT_SYSCALL. Related to, but
not actually the cause or fix for, #188161.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9498
2009-03-30 02:34:29 +00:00
Julian Seward
563511a64e Track renaming of guest_CIA_AT_SC to guest_IP_AT_SYSCALL (vex r1886).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9468
2009-03-20 00:28:50 +00:00
Nicholas Nethercote
b15e3d9a45 Fix all the non-VEX problems identified with the Clang Static Analyzer.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9416
2009-03-15 23:25:38 +00:00
Nicholas Nethercote
cdbb3360ff Tweak exp-ptrcheck .exp files.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9391
2009-03-13 03:27:40 +00:00
Nicholas Nethercote
091aee15fe Fix a .exp file.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9374
2009-03-12 05:20:46 +00:00
Nicholas Nethercote
0c4d4b5d1a Test fixes for systems that have debug info installed for libc and
libpthread.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9353
2009-03-10 23:39:12 +00:00
Nicholas Nethercote
2001629c3f Updated copyright years.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9344
2009-03-10 22:02:09 +00:00
Nicholas Nethercote
1d75b1ac58 Some tweaks to make more tests pass, or get closer to passing, on
--enable-only32bit builds on my Ubuntu box:

- For all tests, replace all operator new/new[]/delete/delete[] variants
  with a common form, eg. "...operator new...".  This makes
  exp-ptrcheck/tests/ccc and memcheck/tests/mismatches pass.

- For Helgrind tests, replace all libpthread paths with "/...libpthread...",
  as is done for libc paths.  This avoids problems when /lib32/libpthread.so
  is the path.  No extra tests pass, but many of them get a lot closer to
  passing.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9333
2009-03-10 03:34:00 +00:00
Nicholas Nethercote
da695aa41a atoll() is a terrible function -- you can't do any error checking with it.
Some of our option processing code uses it.  This means that eg.
'--log-fd=9xxx' logs to fd 9, and '--log-fd=blahblahblah' logs to 0 (because
atoll() returns 0 if the string doesn't contain a number!)

It turns out that most of our option processing uses VG_(strtoll*) instead
of VG_(atoll).  The reason that not all of it does is that the
option-processing macros are underpowered -- they currently work well if you
just want to assign the value to a variable, eg:

        VG_BOOL_CLO(arg, "--heap",   clo_heap)
   else VG_BOOL_CLO(arg, "--stacks", clo_stacks)

   else VG_NUM_CLO(arg, "--heap-admin", clo_heap_admin)
   else VG_NUM_CLO(arg, "--depth",      clo_depth)

(This works because they are actually an if-statement, but it looks odd.)

VG_NUM_CLO uses VG_(stroll10).  But if you want to do any checking or
processing, you can't use those macros, leading to code like this:

      else if (VG_CLO_STREQN(9,  arg, "--log-fd=")) {
         log_to            = VgLogTo_Fd;
         VG_(clo_log_name) = NULL;
         tmp_log_fd        = (Int)VG_(atoll)(&arg[9]);
      }

So this commit:
- Improves the *_CLO_* macros so that they can be used in all circumstances.
  They're now just expressions (albeit ones with side-effects, setting the
  named variable appropriately).  Thus they can be used as if-conditions,
  and any post-checking or processing can occur in the then-statement.  And
  malformed numeric arguments (eg. --log-fd=foo) aren't accepted.  This also
  means you don't have to specify the lengths of any option strings anywhere
  (eg.  the 9 in the --log-fd example above).  The use of a wrong number
  caused at least one bug, in Massif.
- Updates all places where the macros were used.
- Updates Helgrind to use the *_CLO_* macros (it didn't use them).
- Updates Callgrind to use the *_CLO_* macros (it didn't use them), except
  for the more esoteric option names (those with numbers in the option
  name).  This allowed getUInt() and getUWord() to be removed.
- Improves the cache option parsing in Cachegrind and Callgrind -- now uses
  VG_(strtoll10)(), detects overflow, and is shorter.
- Uses INT instead of NUM in the macro names, to distinguish better vs. the
  DBL macro.
- Removes VG_(atoll*) and the few remaining uses -- they're wretched
  functions and VG_(strtoll*) should be used instead.
- Adds the VG_STREQN macro.
- Changes VG_BINT_CLO and VG_BHEX_CLO to abort if the given value is outside
  the range -- the current silent truncation is likely to cause confusion as
  much as anything.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9255
2009-02-25 01:01:05 +00:00
Julian Seward
b9ab0bb0b0 - handle a couple more syscalls, sys_fallocate and sys_getresuid32
- make suppressions for ld.so be a bit more aggressive 



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9243
2009-02-23 16:56:15 +00:00
Nicholas Nethercote
2ae89cee5d Get rid of all "make check" compile warnings, except for the ones from
fxtract.c.

Also, gets rid of some of the warnings that -Wextra finds in Massif.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9237
2009-02-23 06:44:51 +00:00
Nicholas Nethercote
7b65c22fbc Some more test/build cleanups missed in prior commits.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9227
2009-02-23 01:18:06 +00:00
Nicholas Nethercote
a6448a3006 Test files were being passed multiple arch options (eg. "-m32 -m64") when
built.  This worked fine on the x86/Linux and AMD64/Linux but broke
ppc*/Linux.  This commit fixes the problem.  Thanks to Bart for spotting it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9222
2009-02-22 23:38:10 +00:00
Nicholas Nethercote
c8d150dbaa Various build system clean-ups and simplifications:
- Created Makefile.tool-tests.am, put standard AM_CFLAGS et al for tests in
  it.
- A number of tests are shared between Helgrind and DRD.  They used to be
  built in both directories.  Now they are only built in helgrind/tests/,
  and the DRD .vgtest files just point to the executable in helgrind/tests/.
  Most of these (about 30) had the source files in helgrind/tests/;  I moved
  the three that were in drd/tests/ into helgrind/tests/ for consistency.
- Fixed rwlock_test, which was failing to run due to a wrong name in the
  .vgtest file.
- Removed remnants of unused 'hello' test for Memcheck.
- Avoided redundant flag specification in various places, esp.
  memcheck/tests/Makefile.am.
- Removed unnecessary _AIX guards in some Linux-only tests.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9202
2009-02-19 09:52:05 +00:00
Nicholas Nethercote
3ed4532cde In the core, include malloc_usable_size() as one of the functions that must
be replaced if malloc() et al are replaced by a tool.  This is because
different tools implement the function in different ways.

Add an appropriate malloc_usable_size() replacement to each of Memcheck,
Helgrind, DRD, Ptrcheck, Massif.

Update memcheck/tests/malloc_usable and add massif/tests/malloc_usable.

Merged from the DARWIN branch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9193
2009-02-17 04:31:18 +00:00
Nicholas Nethercote
cf6cd2bb31 Stack traces for Memcheck's syscall param errors are terribly unreliable, so
I changed it to just filter the entire stack trace out for these errors (both
normal and XML cases).  The syscall name is still present in the error
string.  This allows a one or more alternative expected output files to be
removed for several tests, which is A Very Good Thing.

Also, I killed filter_test_paths because it was weird and clumsy and the
above change obviated most of its use and the remaining effects could be
achieved in other ways.

Also, I fixed up the scalar* tests a little and they now pass on my machine,
(and hopefully at least some other machines) for the first time ever!


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9178
2009-02-16 05:11:49 +00:00
Nicholas Nethercote
947f9faaba Merge part of r9129 (factor out duplicated Z-encodings of names) from the
DARWIN branch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9130
2009-02-10 04:23:41 +00:00
Julian Seward
bcf0bf5eb2 * get_Seg_containing_addr: fix incorrect test guarding assertion
(which then failed)

* support some more syscalls



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9083
2009-01-29 08:44:49 +00:00
Julian Seward
a735fd2483 Remove function that was made redundant by r9059.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9062
2009-01-26 01:22:23 +00:00
Julian Seward
a0bf8f8271 Minor refinements:
* h_main.c: handle a few more syscalls

* exp-ptrcheck.supp: ignore errors in glibc's getenv -- is highly optimised

* pc_common.c: fix small error in error message printing

--> 3_4_BRANCH



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9061
2009-01-26 00:09:08 +00:00
Julian Seward
98c1569aff Intercept and replace calls to calls to strnlen in glibc, for the
usual reasons.  Also update an expected output (lines numbers in
h_intercepts.c should be removed by the regtest system, really).

--> 3_4_BRANCH



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9060
2009-01-26 00:06:43 +00:00
Julian Seward
59e2a184ae Prior to this commit, exp-ptrcheck would assert if the DWARF3 data for
global or stack blocks described overlapping blocks (which are
nonsensical).  Unfortunately it is naive to assume compilers will
always produce correct debug info.  This commit makes exp-ptrcheck
much more robust against such (inevitable) anomalies: stack and global
blocks which overlap are simply ignored.

--> 3_4_BRANCH



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9059
2009-01-25 23:59:24 +00:00
Julian Seward
00e807b701 Handle a few more syscalls, as per #179618.
MERGE TO 3_4_BRANCH.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9056
2009-01-24 10:52:32 +00:00
Nicholas Nethercote
ed322feb84 Rename all the arch/OS/platform-related variables in configure.in to make it
clearer what they mean:
- They all have VGCONF_ prefixes now, to indicate they come out of
  configure.in (and are clearly distinguished from the VGA_/VGO_/VGP_
  #defines passed in to C files).
- The ones that refer to the primary *or* secondary platform have _INCLUDES_
  in them.
- The ones that are in all-caps have a _CAPS suffix.

So, for example, what was VGP_X86_LINUX is now
VGCONF_PLATFORMS_INCLUDE_X86_LINUX, which is more verbose but also a lot
clearer.  The names of the #defines used in the C files (VGA_x86, VGO_linux,
etc) are unchanged.

cputest.c: changed to reflect the Valgrind installation's capabilities,
rather than the machine's capabilities.  In particular, if
--enable-only32bit is used on a 64-bit machine, then this program will claim
to only support 32-bits.  Also use the VGA/VGO/VGP macros which are clearer
than the __i386__ ones.  (This is partially merged from the DARWIN branch.)

configure.in: clean up the comments, distinguish different sections more
clearly, and generally make it more readable.

valgrind.pc.in: try to make this more accurate.  I doubt anyone's using it.
It doesn't appear to be set up to handle dual-architecture builds.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9031
2009-01-22 21:56:32 +00:00
Nicholas Nethercote
cace8b55cd - No longer using VG_ARCH_ALL to determine the DIST_SUBDIRS used for
arch/OS/platform-specific tool test dirs, instead writing it by hand.
  This is important because up until now if we had any arch-specific test
  dirs, we needed such dirs for all archs.  Now that we also have
  OS-specific and platform-specific test dirs, we don't want to have
  (mostly) empty dirs for every arch/OS/platform.

- Correspondingly, removed several empty directories under memcheck/tests/
  and cachegrind/tests that are no longer needed.

- Also removed VG_ARCH_ALL from configure.in.

- Also used an arch-specific guard rather than a platform-specific one where
  appropriate in cachegrind/tests/Makefile.am.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9017
2009-01-22 01:13:16 +00:00
Nicholas Nethercote
23accaf007 Remove an unnecessary #include that breaks the test on Darwin, and update
the expected output line numbers accordingly.  MERGED FROM DARWIN BRANCH.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8965
2009-01-16 07:04:26 +00:00
Nicholas Nethercote
5ad1dd61f9 Introduce a new type, PtrdiffT. Replace lots of uses of OffT (all those
that are memory offsets) with PtrdiffT;  OffT should only be used for file
sizes and offsets.

Change Off64T from a ULong to a Long, as it should be.  Replace some uses
of ULong in the address space manager with Off64T to match.

Also add a comment explaining the meanings of the basic types like Addr,
OffT, SizeT, etc.

Also fix the prototype for VG_(pread) -- the last arg is an OffT, not an
Int.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8959
2009-01-15 21:29:24 +00:00
Julian Seward
23778a2e0c Handle __NR_socketpair in Ptrcheck.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8917
2009-01-07 09:35:10 +00:00
Tom Hughes
d65423b2fb Add some more system calls to ptrcheck.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8908
2009-01-05 12:16:21 +00:00
Julian Seward
5221680195 Comment out unused code so as to get a warning free build.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8868
2008-12-23 02:31:22 +00:00
Julian Seward
fed86a60cb Handle a couple of syscalls needed to make Ptrcheck run bash.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8716
2008-10-30 01:44:03 +00:00
Julian Seward
581844c930 Remove old text-mode only version of the documentation.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8703
2008-10-23 22:16:41 +00:00
Julian Seward
a11c045d49 XML-ise exp-ptrcheck's documentation.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8702
2008-10-23 13:15:23 +00:00
Julian Seward
81d54faef4 Updated expected output following changes in r8689.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8694
2008-10-22 08:51:37 +00:00
Julian Seward
a73c4edc89 Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8691
2008-10-21 23:15:39 +00:00
Julian Seward
6e5ef25c74 * intercept stpcpy
* reorder declarations to make them be the same as in mc_replace_strmem.c.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8689
2008-10-21 23:11:38 +00:00
Julian Seward
6c6bd828ac Handle ppc32/64 VRSAVE accesses.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8688
2008-10-21 23:10:18 +00:00
Julian Seward
25445f9819 On ppc32/64 we don't have a reliable way to detect function entries
and exits at the moment.  So disable stack array bounds checking for
ppc32/64 platforms.  Also (unnecessarily) disables global array bounds
checking on those platforms.

Add a flag --enable-sg-checks=no|yes [yes] so that stack and global
checking can be optionally disabled on any platform.  This is useful
because stack and global checking is much more expensive than heap
checking, and so it may be desirable to disable it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8686
2008-10-20 23:33:49 +00:00
Julian Seward
69d4400c74 Futz with debug printing.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8685
2008-10-20 22:27:52 +00:00
Julian Seward
fe266da253 Adjust line spacing following r8645, so that .stderr output is
as expected once again.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8682
2008-10-20 11:29:51 +00:00
Julian Seward
cae30c83c2 Add a not very good test pertaining to the preening of global Invars
upon unmapping of a shared object, in sg_main.c.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8681
2008-10-20 11:14:50 +00:00
Julian Seward
587966f5ef Support a couple more syscalls needed for running KDE4 stuff on amd64-linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8680
2008-10-20 10:30:08 +00:00
Julian Seward
427eb60340 Re-enable preening of global invariants. (This happens when a .so is
unmapped, and that .so contains global variables that were accessed
while it was mapped in.)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8679
2008-10-20 10:25:16 +00:00
Julian Seward
26e4f5fac5 Set average translation size plausibly, so as to avoid excessive
retranslations caused by the default size.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8678
2008-10-20 10:23:46 +00:00
Julian Seward
c50d12960e get_Seg_containing_addr() (in h_main.c): remove naive algorithm that
searches through all live Segs and replace it with one which is O(log
N) in the number of live Segs.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8676
2008-10-18 19:55:31 +00:00