3385 Commits

Author SHA1 Message Date
Julian Seward
e7dde85a24 Merge coregrind/ changes from branches/MESSAGING_TIDYUP r10464.
This commit tidies up and rationalises what could be called the
"messaging" system -- that part of V to do with presenting output to
the user.  In particular it brings significant improvements to XML
output.

Changes are:

* XML and normal text output now have separate file descriptors,
  which solves longstanding problems for XML consumers caused by
  the XML output getting polluted by unexpected non-XML output.

* This also means that we no longer have to hardwire all manner
  of output settings (verbosity, etc) when XML is requested.

* The XML output format has been revised, cleaned up, and made
  more suitable for use by error detecting tools in general
  (various Memcheck-specific features have been removed).  XML
  output is enabled for Ptrcheck and Helgrind, and Memcheck is
  updated to the new format.

* One side effect is that the behaviour of VG_(message) has been
  made to be consistent with printf: it no longer automatically
  adds a newline at the end of the output.  This means multiple
  calls to it can be used to build up a single line message; or a
  single call can write a multi-line message.  The ==pid==
  preamble is automatically inserted at each newline.

* VG_(message)(Vg_UserMsg, ..args..) now has the abbreviated form
  VG_(UMSG)(..args..); ditto VG_(DMSG) for Vg_DebugMsg and
  VG_(EMSG) for Vg_DebugExtraMsg.  A couple of other useful
  printf derivatives have been added to pub_tool_libcprint.h,
  most particularly VG_(vcbprintf).

* There's a small change in the core-tool interface to do with
  error handling: VG_(needs_tool_errors) has a new method
  void (*before_pp_Error)(Error* err)  which, if non-NULL, is
  called just before  void (*pp_Error)(Error* err).  This is to
  give tools the chance to look at errors before any part of them
  is printed, so they can print any XML preamble they like.

* coregrind/m_errormgr.c has been overhauled and cleaned up, and
  is a bit simpler and more commented.  In particular pp_Error
  and VG_(maybe_record_error) are significantly changed.

The diff is huge, but mostly very boring.  Most of the changes
are of the form

-   VG_(message)(Vg_UserMsg, "this is a message %d", n);
+   VG_(message)(Vg_UserMsg, "this is a message %d\n", n);

Unfortunately as a result of this, it touches a large number
of source files.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10465
2009-07-15 14:48:32 +00:00
Tom Hughes
d9a6e3b3f7 Validate the file descriptor argument to fallocate.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10463
2009-07-15 07:47:49 +00:00
Nicholas Nethercote
9ca3448218 Add support on Darwin for mount(). Finishes off bug 198624.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10461
2009-07-15 06:39:15 +00:00
Nicholas Nethercote
c5310baaff Added support for getfsstat64() on Darwin. This partly fixes bug 198624.
Fixed a couple of other minor things too.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10460
2009-07-15 06:24:57 +00:00
Nicholas Nethercote
ef7925e7bc Add support on Darwin for fstat_extended() and fstat64_extended(). Partly
addresses bug 198624.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10458
2009-07-15 06:01:45 +00:00
Nicholas Nethercote
705bcf4d73 Handle setpgid(). Partly addresses bug 198624.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10457
2009-07-15 05:46:43 +00:00
Nicholas Nethercote
f00335141b Handle fallocate() on 64-bit platforms. Fixes bug 185794.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10456
2009-07-15 03:08:35 +00:00
Nicholas Nethercote
2a7a73345f Ignore MALLOCLIKE_BLOCK/FREELIKE_BLOCK if addr==0. Fixes bug 137073. DRD
now has its own copy of custom_alloc.c which is a little different to
Memcheck's;  making them both work with the same version was too difficult.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10455
2009-07-15 02:31:45 +00:00
Bart Van Assche
37252cc26c Fixed recently introduced compiler warnings.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10453
2009-07-14 16:36:40 +00:00
Nicholas Nethercote
75b92a2ec9 Shorten the preamble by moving some of it into the --help output. This
partly fixes bug 197933.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10451
2009-07-14 06:55:05 +00:00
Nicholas Nethercote
9398df7628 Don't put the Vex SVN revision number in the preamble -- it achieves little
and is an enormous pain.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10447
2009-07-14 04:49:18 +00:00
Nicholas Nethercote
00057df2c4 Some ioctls don't look at ARG3 at all. Based on patches from Clemens
Ladisch.  Fixes bug 159501.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10441
2009-07-14 00:06:00 +00:00
Nicholas Nethercote
230d940241 Fix wrapper for ioctl(VT_GETSTATE). Patch from Garrett D'Amore. Fixes bug
139076.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10437
2009-07-13 06:43:19 +00:00
Julian Seward
8e1b7a5bd5 Fix identification of sse3 on amd64s. Previously it was identifying
ssse3, not sse3 (sigh).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10434
2009-07-12 13:19:04 +00:00
Nicholas Nethercote
400b917577 Handle epoll_create1. Patch from Sam Varshavchik. Fixes bug 188427.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10427
2009-07-10 12:02:03 +00:00
Nicholas Nethercote
4fc7d06fcc Back out r10402 because it completely breaks things on Ubuntu 9.04 and
OpenSUSE 11.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10404
2009-07-02 20:47:53 +00:00
Tom Hughes
3ddeb03e5b Replace strlen on amd64-linux with a simple version that doesn't
generate false positives.

Patch from Jakub Jelinek <jakub@redhat.com>. Fixes #190429.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10402
2009-07-02 13:02:12 +00:00
Tom Hughes
839cf6c974 When looking for the text section in a PE executable ignore any
code section which is marked as uninitialised.

This can happen if you have incremental linking enabled in Visual
Studio, which causes a .textbss section to be added before the real
text section. We were picking up that .textbss section and using it to
compute the avma and bias for the code which was giving completely the
wrong results.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10394
2009-07-01 11:59:20 +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
d1f8801998 Just whitespace and comment changes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10388
2009-07-01 02:39:26 +00:00
Nicholas Nethercote
97b2ffd409 Fix a problem with r10384: it was failing to read the ELF header if the
executable was less than 4096 bytes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10387
2009-06-30 06:06:14 +00:00
Josef Weidendorfer
1191ffa0eb Change demangler to not use excessive space from stack
Replaces alloca with xmalloc calls.
This should fix bug 197988.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10385
2009-06-29 16:13:25 +00:00
Nicholas Nethercote
07a1251a20 Make the Linux launcher more like the Darwin one in how it reads the
executable headers.  This means it no longer crashes on an empty executable.
Fixes bug 156065.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10384
2009-06-29 06:57:30 +00:00
Nicholas Nethercote
a95af1babe Add a comment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10383
2009-06-29 05:19:15 +00:00
Nicholas Nethercote
04e9b16dea An fd in the Darwin launcher wasn't being closed.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10379
2009-06-26 04:35:51 +00:00
Nicholas Nethercote
26daa53d28 In VG_(get_changed_segments) use dynamic memory allocation rather than
static memory allocation to avoid hardwiring an upper limit on CSS_SIZE.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10374
2009-06-24 08:32:42 +00:00
Nicholas Nethercote
5e7562af08 Add support for various aio_*() syscalls on Darwin. With them, Quicktime
runs, albeit incredibly slowly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10371
2009-06-24 06:25:36 +00:00
Nicholas Nethercote
7eb329d028 Support and test mincore() on Darwin.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10368
2009-06-24 04:15:29 +00:00
Nicholas Nethercote
03e20d86b7 Enable mincore() on AMD64/Linux. Hopefully fixes bug 197591.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10367
2009-06-24 04:02:19 +00:00
Nicholas Nethercote
de25e03eed Abort if a dir is given to --suppressions. Fixes bug 197456.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10366
2009-06-24 03:49:19 +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
e4cbc57ed9 Make the sys_newlstat wrapper more like those of similar *stat() syscalls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10339
2009-06-15 07:43:50 +00:00
Nicholas Nethercote
d48af010b9 Add wrappers for shmat() and shmdt() on Darwin. Fixes bug 191271.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10297
2009-06-10 23:26:13 +00:00
Nicholas Nethercote
7a095f31f3 Added a wrapper and test for exchangedata() on Darwin. Fixes bug 195860.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10295
2009-06-10 22:58:27 +00:00
Nicholas Nethercote
a048647a9a Implement and test wrappers for lstat_extended, stat64_extended,
lstat64_extended, and improve the existing wrapper for stat_extended.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10291
2009-06-10 06:13:34 +00:00
Nicholas Nethercote
aa21ae3de1 Darwin syscall wrapper cleanups:
- Put Darwin syscall DECL_TEMPLATEs in syscall order.
- Removed the "sys_" prefix from Darwin-specific wrappers, it's not
  necessary.  Renamed a couple of other wrappers similarly.
- Removed the sys_fcntl64 Darwin wrapper, it was unused.
- Improved some code layout.
Overall this removes 6 "DDD"/"GrP" fixme comments.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10290
2009-06-10 04:11:56 +00:00
Nicholas Nethercote
ae530719e6 Add wrappers for sem_wait and sem_trywait on Darwin. Also change the layout
of some Darwin syscall stuff.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10288
2009-06-10 01:23:26 +00:00
Nicholas Nethercote
2a9e26c733 Handle shmctl on Darwin. From bug 191271.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10287
2009-06-09 23:44:42 +00:00
Nicholas Nethercote
4ddfee7723 Fix URB ioctl handling. Patch from Hector Martin (bug 191095).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10286
2009-06-09 23:03:02 +00:00
Nicholas Nethercote
17ae73a356 Avoid recursion in VG_(exit).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10285
2009-06-09 22:46:32 +00:00
Nicholas Nethercote
a01f086879 Handle another Linux ioctl. Patch from Jay Foad.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10284
2009-06-09 22:31:00 +00:00
Nicholas Nethercote
a4a24f0c4f Abort if a --log-file filename begins with a '~'.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10281
2009-06-09 00:50:45 +00:00
Julian Seward
4ece7c2449 x86-linux: sys_set_thread_area: don't allocate GDT entry number zero,
and reject attempts to use it.  This is because the hardware does not
allow entry zero to be used, and apparently doing so confuses some
code (perhaps Windows apps running on Wine).  Derived from a patch by
John Reiser.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10251
2009-06-05 13:17:31 +00:00
Nicholas Nethercote
3829cffbcf Increase a hard limit that was reached in the wild.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10250
2009-06-05 05:28:17 +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
5f8f34f8c0 Don't print stack traces by default for unhandled syscalls -- it's not that
useful but screws up the 'scalar' tests.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10219
2009-06-03 07:17:07 +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
8c3b7ff600 Back out r10197--r10200 and r10202--r10203. I'm going to put them, and
further, related changes, on a branch instead.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10204
2009-06-02 06:54:57 +00:00
Nicholas Nethercote
1f9f4f8562 Move some stuff around; no functional change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10203
2009-06-02 05:27:07 +00:00
Nicholas Nethercote
139e8dcd17 Avoid repetitive cut+paste code for libreplacemalloc_toolpreload.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10202
2009-06-02 05:19:54 +00:00