65 Commits

Author SHA1 Message Date
Julian Seward
e3c61c642f Fix breakage on ppc{32,64}-linux in post_reg_write_nonptr following
r10084 and also update a comment.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10439
2009-07-13 10:00:06 +00:00
Julian Seward
d8898802fc Track vex r1907 (introduce Iop_CmpCas{EQ,NE}{8,16,32,64} and use them
for CAS-success? tests).

Detailed background and rationale in memcheck/mc_translate, comment
"COMMENT_ON_CasCmpEQ".

This commit changes the Memcheck instrumentation of IRCAS so as not to
do a definedness check on the success/failure indication.  Also, by
being able to identify via the Iop_CasCmpEQ primitives any such checks
independently created by front ends, it can avoid instrumenting these
too.

All this is to avoid reporting new false positives observed on Fedora 7
(x86?) and openSUSE 10.2 (x86) following the recent merge of branches/DCAS.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10432
2009-07-12 13:00:17 +00:00
Julian Seward
4b19c85350 Add support for IRStmt_CAS to the h_ instrumenter. This should stop
exp-ptrcheck asserting on threaded programs on x86 and amd64.  Vast
amounts of fiddly complication that makes my head hurt.  Urr.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10418
2009-07-09 10:52:03 +00:00
Julian Seward
338cd1a59a Liberalise IRTemp bookkeeping in the h_ instrumenter, so as to allow
addition of non-shadow IRTemps without causing it to collapse into
assertion failures.  This changes is a simplified version of what was
committed in
svn://svn.valgrind.org/valgrind/branches/DCAS/memcheck/mc_translate.c
r10109.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10417
2009-07-09 10:45:11 +00:00
Julian Seward
3109865279 Merge in branches/DCAS.
This branch adds proper support for atomic instructions, proper in the
sense that the atomicity is preserved through the compilation
pipeline, and thus in the instrumented code.

These changes track the IR changes added by vex r1901.  They primarily
update the instrumentation functions in all tools to handle the
changes, with the exception of exp-ptrcheck, which needs some further
work in order to be able to run threaded code.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10392
2009-07-01 08:10:49 +00:00
Nicholas Nethercote
512909dd91 Fix 'make check' for automake-1.7. Fixes bugs 197898 and 197901.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10378
2009-06-25 23:46:23 +00:00
Nicholas Nethercote
b05a2a18d7 This commit merges the BUILD_TWEAKS branch onto the trunk. It has the
following improvements:

- Arch/OS/platform-specific files are now included/excluded via the
  preprocessor, rather than via the build system.  This is more consistent
  (we use the pre-processor for small arch/OS/platform-specific chunks
  within files) and makes the build system much simpler, as the sources for
  all programs are the same on all platforms.

- Vast amounts of cut+paste Makefile.am code has been factored out.  If a
  new platform is implemented, you need to add 11 extra Makefile.am lines.
  Previously it was over 100 lines.

- Vex has been autotoolised.  Dependency checking now works in Vex (no more
  incomplete builds).  Parallel builds now also work.  --with-vex no longer
  works;  it's little use and a pain to support.  VEX/Makefile is still in
  the Vex repository and gets overwritten at configure-time;  it should
  probably be renamed Makefile-gcc to avoid possible problems, such as
  accidentally committing a generated Makefile.  There's a bunch of hacky
  copying to deal with the fact that autotools don't handle same-named files
  in different directories.  Julian plans to rename the files to avoid this
  problem.

- Various small Makefile.am things have been made more standard automake
  style, eg. the use of pkginclude/pkglib prefixes instead of rolling our
  own.

- The existing five top-level Makefile.am include files have been
  consolidated into three.

- Most Makefile.am files now are structured more clearly, with comment
  headers separating sections, declarations relating to the same things next
  to each other, better spacing and layout, etc.

- Removed the unused exp-ptrcheck/tests/x86 directory.

- Renamed some XML files.

- Factored out some duplicated dSYM handling code.

- Split auxprogs/ into auxprogs/ and mpi/, which allowed the resulting
  Makefile.am files to be much more standard.

- Cleaned up m_coredump by merging a bunch of files that had been
  overzealously separated.

The net result is 630 fewer lines of Makefile.am code, or 897 if you exclude
the added Makefile.vex.am, or 997 once the hacky file copying for Vex is
removed.  And the build system is much simpler.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10364
2009-06-24 00:37:09 +00:00
Nicholas Nethercote
2314fe1acc For no apparent reason, the machine-dependent syscall
thread_fast_set_cthread_self was being called pthread_set_self.  This commit
fixes this.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10249
2009-06-05 01:33:16 +00:00
Nicholas Nethercote
2a7d944c27 A number of changes relating to syscall numbering:
- Introduced VG_SYSNUM_STRING and VG_SYSNUM_STRING_EXTRA which factor out
  differences in the way syscall numbers are printed on different platforms.
  This gets rid of seven "DDD" fixme-style comments.

- This also meant that Darwin syscall numbers are now printed in a
  non-ambiguous way -- previously Unix, machine-dependent and diagnostic
  syscalls were all printed the same way, even though their numbers overlap.
  Now each number is prefixed with "unix", "mdep", etc.  And Mach trap
  numbers aren't printed as negative numbers now that they have a "mach"
  prefix.

- Split each of pub_core_vkiscnums.h and pub_tool_vkiscnums.h into two
  parts, one suitable for inclusion in asm files, one suitable for inclusion
  in C files;  in both cases the latter includes the former.  This makes
  this module more like other modules that have asm-only components (eg.
  m_transtab);  it also allows the hacky VG_IN_ASSEMBLY_SOURCE macros and
  tests to be removed.

- Removed some of the VG_DARWIN_SYSNO_* macros that were no longer needed,
  and renamed some of the existing ones to make their meanings clearer.

- Added comments on the encoding of Darwin syscall numbers so it's
  possible for mortals to understand without reading the kernel code..



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10218
2009-06-03 06:50:06 +00:00
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