171 Commits

Author SHA1 Message Date
Tom Hughes
3561ea08ca Added VG_(cpuid) to replace the various bits of inline assembler used
to query the CPU characteristics as the use of four implicit registers
causes havoc when GCC tries to inline and optimise the assembler.

Fix to bug #79696.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2421
2004-06-16 20:51:45 +00:00
Nicholas Nethercote
2fc96dcc06 Add a "delete:" line to the regression test .vgtest files, to clean up any file
created by the test.  Added appropriate lines to the Cachegrind and Massif
tests.  Should prevent large numbers of files clogging up directories.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2372
2004-04-17 17:25:08 +00:00
Tom Hughes
91e78b3482 Added more floating point instruction tests.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2347
2004-03-31 22:47:52 +00:00
Tom Hughes
3330a9f65b Added more floating point instruction tests.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2343
2004-03-28 10:33:51 +00:00
Tom Hughes
2f1fb3e5f9 Added tests for floating point multiple and divide instructions.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2340
2004-03-28 00:30:57 +00:00
Tom Hughes
cd101bf7b2 Extended instruction test system to handle x87 floating point instructions
and started working on adding tests for the x87 instruction set.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2338
2004-03-27 18:02:37 +00:00
Tom Hughes
57b01439e0 Move the handling of PSHUFW from the SSE code to the MMX code so that
it will work on older Athlons which only have MMXEXT support.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2319
2004-03-15 16:43:58 +00:00
Jeremy Fitzhardinge
82aaa16ef9 Fix "make distcheck", and also make sure that the generated archive
contains everything needed to "make regtest".  Bump the version.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2308
2004-03-12 10:51:39 +00:00
Tom Hughes
5c5cc2d261 Fix expected standard error output for mmxext tests to resolve
differences in the amount of whitespace left with different skins.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2303
2004-03-09 08:50:02 +00:00
Jeremy Fitzhardinge
5c00880d69 Use Tom's instruction set tests on all tools which do instrumentation, so
we can make it's OK for all instructions.  Helgrind is badly broken in this
test (bug 69856).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2301
2004-03-09 01:44:11 +00:00
Nicholas Nethercote
32b992d36a Fix a bug in Cachegrind: when invalidating BBs, the lookup in the BBCC_table
sometimes failed, causing an assertion failure.  This is because the debug
info for the code address, which is used in the lookup,
can change -- eg. "myprint.c:myprint()" is found at instrumentation, but by the
time the invalidation occurs, it's changed to "myprint.c:???".  So it now falls
back to a slow exhaustive search of the table.

This was causing cachegrind/tests/dlclose to fail, and should hopefully fix
bug #72781.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2218
2004-01-21 16:12:55 +00:00
Nicholas Nethercote
c756c590cf Convert "skin" to "tool" in various places; almost entirely within comments,
nothing that will affect code.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2217
2004-01-21 15:08:04 +00:00
Nicholas Nethercote
5630025b84 Patch from Tom Hughes, for bug 72643:
Patch to improve SSE/SS2 support

  This patch should implement most of the missing SSE/SSE2 opcodes. About
  the only ones it doesn't do are the MASKMOVxxx ones as they are quite
  horrible and involved an implicit reference to EDI so I need to think
  about them a bit more.

  The patch also includes a set of tests for the MMX/SSE/SSE2 opcodes to
  validate that they have the same effect under valgrind as they do when
  run normally. In one or two cases this wasn't actually the case even
  for some of the implemented opcodes, so I fixed those as well ;-)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2202
2004-01-19 19:14:18 +00:00
Nicholas Nethercote
30427d2857 Removed files I meant to with the last commit.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2189
2004-01-06 16:08:31 +00:00
Julian Seward
cafeef8e48 Support for FXSAVE/FXRSTOR (Tom Hughes). Fixes #71180.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2183
2004-01-04 23:30:55 +00:00
Nicholas Nethercote
a2ce0a19a6 Folded cg_sim_{gen,I1,D1,L2}.c into cg_sim.c, which makes a lot more sense and
is shorter.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2178
2004-01-04 16:56:57 +00:00
Nicholas Nethercote
07b8e3438b Updated copyright dates for 2004. Also added a couple of missing headers and
footers to some new files.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2177
2004-01-04 16:43:23 +00:00
Jeremy Fitzhardinge
918c3a7b7e This jumbo-checkin is the Full Virtualization checkin. This eliminates
Valgrind's dependency on the dynamic linker for getting started, and
instead takes things into its own hands.

This checkin doesn't add much in the way of new functionality, but it
is the basis for all future work on Valgrind.  It allows us much more
flexibility in implementation, and well as increasing the reliability
of Valgrind by protecting it more from its clients.

This patch requires some changes to tools to update them to the changes
in the tool API, but they are straightforward.  See the posting "Heads
up: Full Virtualization" on valgrind-developers for a more complete
description of this change and its effects on you.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2118
2003-12-16 02:05:15 +00:00
Nicholas Nethercote
d6d804d382 Updated all "report bugs to..." messages to point to valgrind.kde.org; also
updated the docs to refer to valgrind.kde.org instead of the old website.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2055
2003-11-20 16:20:55 +00:00
Nicholas Nethercote
095472ed9c Fix regtest for change of error message.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2045
2003-11-19 20:09:53 +00:00
Nicholas Nethercote
fb2d543ee8 Started to rescind the name "skin", replacing it with "tool". Did this in all
the places that normal users will see:

  - command line: --tool=foo (although --skin=foo still works)
  - docs: removed all traces (included renaming coregrind_skins.html to
    coregrind_tools.html)
  - in the usage messages
  - in error messages

Also did in in some places that I judged were unlikely to cause clashes with
existing workspaces:

  - in the header comments of many files (eg. "This file is part of Memcheck, a
    Valgrind tool for...")
  - in the regtests script
  - in the .supp files
  - in AUTHORS
  - in README_MISSING_SYSCALL_OR_IOCTL

Also update the AUTHORS file to mention Jeremy.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2027
2003-11-14 17:47:54 +00:00
Julian Seward
4201614f47 More SSE support for cachegrind.
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2003
2003-11-04 22:54:28 +00:00
Nicholas Nethercote
c639f03452 Fix cachegrind to deal with VG_(open)() returning any negative number on error,
not just -1.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1968
2003-10-30 10:33:30 +00:00
Julian Seward
b820f69079 Delete some "inline" directives on functions that gcc-3.3.1 declined
to inline.  This is needed to get a warning-free compilation on 3.3.1.
It seems we had "inline" on some pretty huge functions in places.
Also it appears gcc-3.3.1 won't inline a function call in a tail call
position, reasonably enough.  I assume in that case it prefers to
create a tailcall to the callee, rather than inlining it.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1907
2003-10-12 10:27:06 +00:00
Julian Seward
4bb8f8e794 Rudimentary, kludgy, incomplete and probably just plain wrong support
for vendor_id "CentaurHauls", which is the VIA string (reflecting its
design heritage).  Currently pretend to be something like a VIA Nehemiah.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1897
2003-10-07 00:18:16 +00:00
Nicholas Nethercote
2507f022ce Added a new flag ',' to printf() format specifications. When specified in a
number, will print it with commas delimiting it.  Very useful when printing
large numbers.

Using it, was able to remove the wretched commify() function from Cachegrind.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1869
2003-09-30 14:15:44 +00:00
Nicholas Nethercote
4e147a4eaf Added VG_(getcwd_alloc)(), which is much easier to use than VG_(getcwd)().
(getcwd() is really a pretty stupid syscall)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1867
2003-09-30 13:51:23 +00:00
Nicholas Nethercote
af067e5375 Add a couple more CPUID-auto-detect cases for Intel CPUs to Cachegrind, thanks
to Josef Weidendorfer.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1858
2003-09-29 15:55:44 +00:00
Dirk Mueller
34af4d4549 fix compiler warning
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1822
2003-09-18 01:15:32 +00:00
Nicholas Nethercote
9b074f685f Teach Cachegrind about SSE instructions, courtesy of Josef Weidendorfer.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1805
2003-08-25 16:15:40 +00:00
Nicholas Nethercote
9a5e615c4b Truncate the cachegrind.out.<pid> file, if it already exists. It wasn't doing
this, which meant that if a shorter file of the same name was written, the old
contents past the new end would remain, which would be bad.  Had (probably)
never happened because the <pid> suffix makes it very unlikely for filenames to
be reused.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1777
2003-07-22 20:45:11 +00:00
Julian Seward
a22d206634 Make sure all the regression tests get included in the tarball created
by 'make dist'.  Being the release dude is so exciting!


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1761
2003-07-16 19:03:10 +00:00
Nicholas Nethercote
7dede6c740 Operator change. No difference in behaviour, but avoids a warning with Perl
5.8.0.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1713
2003-07-04 15:59:49 +00:00
Nicholas Nethercote
07682a21ed wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1712
2003-07-04 11:44:39 +00:00
Nicholas Nethercote
83ef1ca2ed Some Makefile.am changes. Lots of them affected:
- changed deprecated INCLUDES variable to AM_CPPFLAGS

- moved the -DVG_LIBDIR definition from AM_CFLAGS into AM_CPPFLAGS

- generally neatened them up a bit -- removed old commented out stuff, fixed a
  couple of other minor things

Everything works for me, hopefully it won't break things for anyone else...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1680
2003-06-12 14:13:05 +00:00
Dirk Mueller
7607301e2e some ignores
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1658
2003-05-28 01:02:46 +00:00
Nicholas Nethercote
009b8db7bb wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1648
2003-05-21 10:13:39 +00:00
Julian Seward
07258f73de gcc-3.3 as supplied with SuSE 8.2 ("gcc version 3.3 20030226
(prerelease) (SuSE Linux)") seems to complain about signed-vs-unsigned
comparisons, when -Wall is on.  This commit fixes (most of) those
complaints.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1638
2003-05-18 10:05:38 +00:00
Julian Seward
46aa527659 Fixed problems with reg tests for frames below main(), which were different
under some setups.

Also fixed problem with Cachegrind tests, by filtering out P4s'
warning message.

Also fixed 'mismatches'.

------------------------------------------------------------


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1616
2003-05-05 16:18:51 +00:00
Nicholas Nethercote
8dd1a0138c Fixed a bug in Cachegrind -- if the profiled program changes working directory,
the output file wouldn't get written.  No longer creating the file at startup
and then writing it at the end;  just writing it at the end.  Also recording
the start directory at the start so that the output ends up in it even if the
program does change directory.

Had to add VG_(getcwd)() to vg_mylibc.c for this.

Added a regression test for it too.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1576
2003-04-30 20:23:58 +00:00
Nicholas Nethercote
fe1f67595b Couple of minor fixes:
- don't keel over if run on an empty file
  - abort if the "summary:" line is missing;  previously it gave a warning
    and tried to keep going but then other things broke.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1572
2003-04-29 11:16:46 +00:00
Nicholas Nethercote
092c9b944b Added "Int exitcode" argument to SK_(fini)(), because it could be useful
for skins.

Changed lackey to print out the exit code.

Changed AUTOMAKE_OPTIONS back to 1.5 (whoops)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1538
2003-04-22 21:41:40 +00:00
Dirk Mueller
02b63b3ba8 reapply automake fixes. make check will now generate the binaries which
are only required for regression testing.

If this breaks something, please mail me first instead of reverting.
Thank you.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1530
2003-04-17 17:00:43 +00:00
Nicholas Nethercote
ac7027c441 Updated copyright notices for 2003. Only 4 months late.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1526
2003-04-15 14:58:06 +00:00
Nicholas Nethercote
7a03be02b3 Namespace police
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1525
2003-04-15 14:09:58 +00:00
Nicholas Nethercote
982fa6481a -----------------------------------------------------------------------------
overview
-----------------------------------------------------------------------------
Previously Valgrind had its own versions of malloc() et al that replaced
glibc's.  This is necessary for various reasons for Memcheck, but isn't needed,
and was actually detrimental, to some other skins.  I never managed to treat
this satisfactorily w.r.t the core/skin split.

Now I have.  If a skin needs to know about malloc() et al, it must provide its
own replacements.  But because this is not uncommon, the core provides a module
vg_replace_malloc.c which a skin can link with, which provides skeleton
definitions, to reduce the amount of work a skin must do.  The skeletons handle
the transfer of control from the simd CPU to the real CPU, and also the
--alignment, --sloppy-malloc and --trace-malloc options.  These skeleton
definitions subsequently call functions SK_(malloc), SK_(free), etc, which the
skin must define;  in these functions the skin can do the things it needs to do
about tracking heap blocks.

For skins that track extra info about malloc'd blocks -- previously done with
ShadowChunks -- there is a new file vg_hashtable.c that implements a
generic-ish hash table (using dodgy C-style inheritance using struct overlays)
which allows skins to continue doing this fairly easily.

Skins can also replace other functions too, eg. Memcheck has its own versions
of strcpy(), memcpy(), etc.

Overall, it's slightly more work now for skins that need to replace malloc(),
but other skins don't have to use Valgrind's malloc(), so they're getting a
"purer" program run, which is good, and most of the remaining rough edges from
the core/skin split have been removed.

-----------------------------------------------------------------------------
details
-----------------------------------------------------------------------------
Moved malloc() et al intercepts from vg_clientfuncs.c into vg_replace_malloc.c.
Skins can link to it if they want to replace malloc() and friends;  it does
some stuff then passes control to SK_(malloc)() et al which the skin must
define.  They can call VG_(cli_malloc)() and VG_(cli_free)() to do the actual
allocation/deallocation.  Redzone size for the client (the CLIENT arena) is
specified by the static variable VG_(vg_malloc_redzone_szB).
vg_replace_malloc.c thus represents a kind of "mantle" level service.

To get automake to build vg_replace_malloc.o, had to resort to a similar trick
as used for the demangler -- ask for a "no install" library (which is never
used) to be built from it.

Note that all malloc, calloc, realloc, builtin_new, builtin_vec_new, memalign
are now aware of --alignment, when running on simd CPU or real CPU.

This means the new_mem_heap, die_mem_heap, copy_mem_heap and ban_mem_heap
events no longer exist, since the core doesn't control malloc() any more, and
skins can watch for these events themselves.

This required moving all the ShadowChunk stuff out of the core, which meant
the sizeof_shadow_block ``need'' could be removed, yay -- it was a horrible
hack.  Now ShadowChunks are done with a generic HashTable type, in
vg_hashtable.c, which skins can "inherit from" (in a dodgy C-only fashion by
using structs with similar layouts).  Also, the free_list stuff was all moved
as a part of this.  Also, VgAllocKind was moved out of core into
Memcheck/Addrcheck and renamed MAC_AllocKind.

Moved these options out of core into vg_replace_malloc.c:
    --trace-malloc
    --sloppy-malloc
    --alignment

The alternative_free ``need'' could go, too, since Memcheck is now in complete
control of free(), yay -- another horribility.

The bad_free and free_mismatch events could go too, since they're now not
detected by core, yay -- yet another horribility.

Moved malloc() et al wrappers for Memcheck out of vg_clientmalloc.c into
mac_malloc_wrappers.c.  Helgrind has its own wrappers now too.

Introduced VG_USERREQ__CLIENT_CALL[123] client requests.  When a skin function
is operating on the simd CPU, this will call a given function and run it on the
real CPU.  The macros VG_NON_SIMD_CALL[123] in valgrind.h present a cleaner
interface to actually use.  Also introduce analogues of these that pass 'tst'
from the scheduler as the first arg to the called function -- needed for
MC_(client_malloc)() et al.

Fiddled with USERREQ_{MALLOC,FREE} etc. in vg_scheduler.c; they call
SK_({malloc,free})() which by default call VG_(cli_malloc)() -- can't call
glibc's malloc() here.  All the other default SK_(calloc)() etc. instantly
panic; there's a lock variable to ensure that the default SK_({malloc,free})()
are only called from the scheduler, which prevents a skin from forgetting to
override SK_({malloc,free})().  Got rid of the unused USERREQ_CALLOC,
USERREQ_BUILTIN_NEW, etc.

Moved special versions of strcpy/strlen, etc, memcpy() and memchr() into
mac_replace_strmem.c -- they are only necessary for memcheck, because the
hyper-optimised normal glibc versions confuse it, and for memcpy() etc. overlap
checking.

Also added dst/src overlap checks to strcpy(), memcpy(), strcat().  They are
reported not as proper errors, but just with single line warnings, as for silly
args to malloc() et al;  this is mainly because they're on the simulated CPU
and proper error handling would be a pain;  hopefully they're rare enough to
not be a problem.  The strcpy check is done after the copy, because it would
require counting the length of the string beforehand.  Also added strncpy() and
strncat(), which have overlap checks too.  Note that addrcheck doesn't do
overlap checking.

Put USERREQ__LOGMESSAGE in vg_skin.h to do the overlap check error messages.

After removing malloc() et al and strcpy() et al out of vg_clientfuncs.c, moved
the remaining three things (sigsuspend, VG_(__libc_freeres_wrapper),
__errno_location) into vg_intercept.c, since it contains things that run on the
simulated CPU too.  Removed vg_clientfuncs.c altogether.

Moved regression test "malloc3" out of corecheck into memcheck, since corecheck
no longer looks for silly (eg. negative) args to malloc().

Removed the m_eip, m_esp, m_ebp fields from the `Error' type.  They were being
set up, and then read immediately only once, only if GDB attachment was done.
So now they're just being held in local variables.  This saves 12 bytes per
Error.

Made replacement calloc() check for --sloppy-malloc;  previously it didn't.

Added "silly" negative size arg check to realloc(), it didn't have one.

Changed VG_(read_selfprocmaps)() so it can parse the file directly, or from a
previously read buffer.  Buffer can be filled with the new
VG_(read_selfprocmaps_contents)().  Using this at start-up to snapshot
/proc/self/maps before the skins do anything, and then parsing it once they
have done their setup stuff.  Skins can now safely call VG_(malloc)() in
SK_({pre,post}_clo_init)() without the mmap'd superblock erroneously being
identified as client memory.

Changed the --help usage message slightly, now divided into four sections: core
normal, skin normal, core debugging, skin debugging.  Changed the interface for
the command_line_options need slightly -- now two functions, VG_(print_usage)()
and VG_(print_debug_usage)(), and they do the printing themselves, instead of
just returning a string -- that's more flexible.

Removed DEBUG_CLIENTMALLOC code, it wasn't being used and was a pain.

Added a regression test testing leak suppressions (nanoleak_supp), and another
testing strcpy/memcpy/etc overlap warnings (overlap).

Also changed Addrcheck to link with the files shared with Memcheck, rather than
#including the .c files directly.

Commoned up a little more shared Addrcheck/Memcheck code, for the usage
message, and initialisation/finalisation.

Added a Bool param to VG_(unique_error)() dictating whether it should allow
GDB to be attached; for leak checks, because we don't want to attach GDB on
leak errors (causes seg faults).  A bit hacky, but it will do.

Had to change lots of the expected outputs from regression files now that
malloc() et al are in vg_replace_malloc.c rather than vg_clientfuncs.c.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1524
2003-04-15 13:03:23 +00:00
Nicholas Nethercote
3cc0c8f8fa Minor HTML fixes in docs, thanks to Arnaud Desitter.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1522
2003-04-08 11:08:45 +00:00
Nicholas Nethercote
cf23760994 Fixed minor printf bogons.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1519
2003-04-08 00:56:14 +00:00
Nicholas Nethercote
0756a50bc3 Removed support for the 1.0.X series from the regression test suite -- this
was present from before the core/skin split, which is now dead.  Means the
script is slightly simpler, and we can dispense with lots of expected
foo.stderr.hd files.

Also undid accidental change to required Automake version in main Makefile.am
from my last commit, whoops.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1518
2003-04-08 00:47:05 +00:00
Julian Seward
82660df5b5 Rationalise ucode generation for 4-byte moves into the MMX unit (movd).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1506
2003-04-04 00:21:58 +00:00