149 Commits

Author SHA1 Message Date
Nicholas Nethercote
3d12e0e9db Terminology change: previously in Memcheck we had the four states:
noaccess, writable, readable, other

Now they are:

   noaccess, undefined, defined, partdefined

As a result, the following names:

   make_writable, make_readable,
   check_writable, check_readable, check_defined

have become:

   make_mem_undefined, make_mem_defined,
   check_mem_is_addressable, check_mem_is_defined, check_value_is_defined

(and likewise for the upper-case versions for client request macros).
The old MAKE_* and CHECK_* macros still work for backwards compatibility.

This is much better, because the old names were subtly misleading.  For
example:

  - "readable" really meant "readable and writable".
  - "writable" really meant "writable and maybe readable, depending on how
    the read value is used".
  - "check_writable" really meant "check writable or readable"

The new names avoid these problems.

The recently-added macro which was called MAKE_DEFINED is now
MAKE_MEM_DEFINED_IF_ADDRESSABLE.

I also corrected the spelling of "addressable" in numerous places in
memcheck.h.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5802
2006-03-31 11:57:59 +00:00
Nicholas Nethercote
e6abeb8b0a Change to some better function names.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5797
2006-03-28 12:51:02 +00:00
Nicholas Nethercote
ad92170332 Change some uses of bytes to bits for consistency.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5796
2006-03-28 12:35:08 +00:00
Nicholas Nethercote
991367c922 Merge in the COMPVBITS branch to the trunk. This is a big change to
Memcheck, replacing the 9-bits-per-byte shadow memory representation to a
2-bits-per-byte representation (with possibly a little more on the side) by
taking advantage of the fact that extremely few memory bytes are partially
defined.

For the SPEC2k benchmarks with "test" inputs, this speeds up Memcheck by a
(geometric mean) factor of 1.20, and reduces the size of shadow memory by a
(geometric mean) factor of 4.26.

At the same time, Addrcheck is removed.  It hadn't worked for quite some
time, and with these improvements in Memcheck its raisons-d'etre have
shrivelled so much that it's not worth the effort to keep around.  Hooray!

Nb: this code hasn't been tested on PPC.  If things go wrong, look first in
the fast stack-handling functions (eg. mc_new_mem_stack_160,
MC_(helperc_MAKE_STACK_UNINIT)).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5791
2006-03-27 11:37:07 +00:00
Julian Seward
522cf5944f Add a new kind of memory-painting primitive, which is: 'make_defined'.
For each byte in the range, if the byte is addressible, make it be
initialised, but if it isn't addressible, leave it alone.  So it's
like a version of make_readable which doesn't alter addressibility.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5736
2006-03-10 13:41:58 +00:00
Julian Seward
aee8146a06 Reinstate the SET/GET_VBITS client requests.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5723
2006-03-08 13:20:09 +00:00
Julian Seward
eedadc5fb3 get_abit_and_vbyte/get_abit can be a significant bottleneck when
painting/checking huge numbers of bytes resulting from client check
requests.  Inlining them helps significantly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5710
2006-03-03 21:02:18 +00:00
Julian Seward
aa35c50723 Extend stack-permissions-change fast-case machinery to handle +/- 112,
128, 144 and 160.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5640
2006-02-12 15:42:20 +00:00
Julian Seward
6af183ac21 Changes to make function wrapping work better on ppc64-linux:
- when recording the non-redirected address in guest_NRADDR, also
  snapshot the current R2 value, as that will be needed to run the
  original safely

- As a consequence, the original-function information extracted by
  VALGRIND_GET_ORIG_FN is different on ppc64-linux (2 words) from
  all other platforms (1 word).  So change the type of it from
  void* to a new type OrigFn which can be defined differently for
  each platform.

- Change the CALL_FN_* macros for ppc64-linux to save/restore
  R2 values appropriately.

- ppc64-linux: detect overflow/underflow of the redirect stack
  and bring Valgrind to a halt if this happens

- Update VG_CLREQ_SZB for ppc32/64 (was out of date).





git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5569
2006-01-20 14:31:57 +00:00
Julian Seward
b4628a7314 Valgrind-side handling (fast case) for the ppc64 ELF stack redzone.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5545
2006-01-18 04:16:27 +00:00
Julian Seward
6c04df88c8 Increase size of the largest guest state handled.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5532
2006-01-17 01:58:24 +00:00
Julian Seward
cc9a4e788c Fix a casting bug in the LOADV8 slow (misaligned) case spotted by Nick.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5500
2006-01-05 14:09:46 +00:00
Nicholas Nethercote
798fba1991 Remove remaining profiling gunk from Memcheck.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5387
2005-12-19 22:48:06 +00:00
Nicholas Nethercote
c2e79c35e4 Remove the old profiling stuff from Memcheck.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5385
2005-12-19 22:23:35 +00:00
Tom Hughes
9a850246f9 Fixed to check whether __builtin_expect is supported before using it.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5372
2005-12-19 12:40:13 +00:00
Cerion Armour-Brown
b714685c63 Take ppc64 startup further along the road
- fixed launcher.c to recognise ppc32/64-linux platforms properly
 - lots of assembly fixes to handle func descriptors, toc references, 64bit regs.
 - fixed var types in vki-ppc64-linux

Now gets as far as VG_(translate), but dies from a case of invalid orig_addr.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5299
2005-12-06 19:07:08 +00:00
Julian Seward
0a24c03427 Fix obscure memcheck bug found by Nick. This could cause false
negatives, but only in the following unlikely circumstances: for an
8-byte store, which is handled by by the slow path (due to
misalignment or incomplete addressibility).  In this case, the bug
caused the top 32 of the written V bits to be forced to zero
("defined").  This would not have affected the vast majority of 8-byte
stores since almost all of them would either have been handled by the
fast case or would have the top 32 V bits as zero anyway (almost
certainly both).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5222
2005-11-20 19:08:08 +00:00
Nicholas Nethercote
a26bd07b31 Remove horribly out-of-date comment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5132
2005-11-15 02:24:57 +00:00
Julian Seward
57e70cee23 Get rid of old flags that memcheck no longer has.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5039
2005-11-08 14:10:24 +00:00
Julian Seward
7f31b1528f memcheck: make --partial-loads-ok=yes work again, but now make it
the non-default (it's a hack after all).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5035
2005-11-08 02:25:37 +00:00
Nicholas Nethercote
f2ec4febfe Make the usage message a little neater and more self-consistent.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4948
2005-10-19 22:39:40 +00:00
Julian Seward
00c09f8f0d Build fixes for gcc-2.96. The system now builds and regtests with the
default gcc-2.96 on Red Hat 7.3.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4911
2005-10-12 12:53:20 +00:00
Nicholas Nethercote
2349f41c86 Add a comment about Memcheck not doing anything for mprotect.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4886
2005-10-07 04:48:37 +00:00
Julian Seward
75d5c9fbd4 %u -> %lu
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4813
2005-09-28 20:00:30 +00:00
Julian Seward
40f6598ba4 Increase some sizes to deal better with the new multigigabyte world:
- on 64-bit platforms, double the size of the supported address
  space to 32G.

- Increase the size of the ExeContext table 6 times.  Some very
  large apps have been observed to have been doing a lot of 
  searching in the old 4999 entry table.  This table may be
  OSetified in the fullness of time.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4808
2005-09-28 11:50:20 +00:00
Nicholas Nethercote
60aae81ae6 Remove now-unused "shadow_memory" need.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4797
2005-09-27 21:35:01 +00:00
Julian Seward
cc8ccbbfb4 This commit merges in changes from branches/ASPACEM (specifically,
changes from r4341 through r4787 inclusive).  That branch is now dead.
Please do not commit anything else to it.

For the most part the merge was not troublesome.  The main areas of
uncertainty are:

- build system: I had to import by hand Makefile.core-AM_CPPFLAGS.am
  and include it in a couple of places.  Building etc seems to still
  work, but I haven't tried building the documentation.

- syscall wrappers: Following analysis by Greg & Nick, a whole lot of
  stuff was moved from -generic to -linux after the branch was created.
  I think that is satisfactorily glued back together now.

- Regtests: although this appears to work, no .out files appear, which
  is strange, and makes it hard to diagnose regtest failures.  In
  particular memcheck/tests/x86/scalar.stderr.exp remains in a 
  conflicted state.

- amd64 is broken (slightly), and ppc32 will be unbuildable.  I'll
  attend to the former shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4789
2005-09-27 19:20:21 +00:00
Nicholas Nethercote
e009050880 Whoops... I guess the regtests don't exercise that code...
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4416
2005-08-15 01:54:05 +00:00
Nicholas Nethercote
fcdc60441e Something I realised recently: in C, iterators are much better than
higher-order functions for traversing data structures.  The higher-order
approach is too clumsy due to the lack of polymorphism and closures;  you
have to use void* too much and it is more verbose than it should be.

Hence, I replaced all the uses of HT_first_match() and
HT_apply_to_all_nodes() with equivalent uses of the hashtable iterator.
Also replaced higher-order traversal functions for Memcheck's freed-list
and the thread stacks with iterators.  That last change changes the
core/tool interface, so I've increased the version number.







git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4415
2005-08-15 01:52:02 +00:00
Nicholas Nethercote
7062ca6bc7 Remove more now-unnecessary casts, thanks to the recent VgHashTable changes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4409
2005-08-14 18:32:16 +00:00
Nicholas Nethercote
8515143ce8 Get rid of some stupidity:
- Added some useful hash table functions (vanilla lookup() and remove()).
  [Actually, I accidentally added them with my previous commit]
  
  Replaced various simple uses of VG_(HT_get_node) with these new functions. 

- Passing record_freemismatch_error() the MAC_Chunk of the freed heap block.
  So now we don't need to call describe_addr() to re-find that block, which
  means that we can remove the MAC_Chunk from the malloc_list earlier, rather
  than having to do a lookup and then later remove it with the stupid removal
  handle returned by VG_(HT_get_node)().


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4379
2005-08-11 00:47:10 +00:00
Julian Seward
87b4da1f0b Create and use bigendian versions of MC_(helperc_{LOAD,STORE}V{2,4,8}).
This involved some serious nastyness from the Department of Cpp Abuse.

Memcheck still bombs on ppc32 for unknown reasons.

There are still endianness issues within these functions, I think.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4129
2005-07-08 01:29:33 +00:00
Julian Seward
1cfc0e7971 Track Vex API change (r1239, introduction of endianness-indications in
IR loads and stores.)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4072
2005-06-30 23:33:37 +00:00
Nicholas Nethercote
d463dd2292 Removed the VGA_/VGO_/VGP_ prefixes for arch/OS/platform-specific
things.  These made sense when the arch/OS/platform-specific code was in
one module, but as that code got mixed in with generic code the boundary
between generic and non-generic blurred, and the distinction made less
sense.  So let's get rid of them.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4002
2005-06-23 03:27:57 +00:00
Nicholas Nethercote
35fc371349 Malloc replacement worked very much like a 'need', but wasn't one.
I've changed it so it now is, which makes it consistent with the
other 'needs'.  Because of this, I was also able to invert the dependence
between m_mallocfree and m_tooliface, which is related to setting
the redzone size for client heap blocks.  As a result, m_tooliface
now doesn't depend on anything except pub_core_basics.h, hooray!
 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3979
2005-06-21 03:20:17 +00:00
Nicholas Nethercote
f174930b23 Final commit for the initial modularisation pass:
- Broke part of m_scheduler off into a new module m_threadstate.  It
  contains ThreadState, VG_(threads)[] and some basic operations on the
  thread table.  All simple stuff, the complex stuff stays in m_scheduler.
  This avoids lots of circular dependencies between m_scheduler and other
  modules.

- Managed to finally remove core.h and tool.h, double hurrah!

- Introduced pub_tool_basics.h and pub_core_basics.h, one of which is
  include by every single C file.

- Lots of little cleanups and changes related to the above.

- I even did a small amount of documentation updating.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3944
2005-06-19 01:24:32 +00:00
Julian Seward
66755d61e5 Be quieter when outputting XML.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3910
2005-06-13 18:22:17 +00:00
Nicholas Nethercote
1d0e2e6e41 Created m_machine, for various machine-related things.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3903
2005-06-13 04:21:38 +00:00
Nicholas Nethercote
3ae647fa4e Move some decls out of tool.h into the new file pub_tool_aspacemgr.h.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3885
2005-06-11 04:58:29 +00:00
Julian Seward
6669e7b013 Increase the number of auxmaps from 500 to 20000. This should be
enough to cover 1.25GB of auxiliary address space.  This is all still
a hack until such time as the address space manager is rewritten, but
should make things work more reliably on amd64-linux for now.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3859
2005-06-09 13:56:07 +00:00
Nicholas Nethercote
eb2d0a7d06 Modularised assertions and panics in m_libcassert.
As part of this, killed the VG_STRINGIFY macro, which was used to expand
out names like "VG_(foo)" and "vgPlain_foo" in assertion failure
messages.  This is good since we actually want the "VG_(foo)" form used
in these messages.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3842
2005-06-04 19:16:06 +00:00
Nicholas Nethercote
dbc8c6d99c Modularise printing functions in m_libcprint.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3840
2005-06-03 03:08:39 +00:00
Nicholas Nethercote
09980587a9 Started modularising vg_mylibc. Put all the standalone stuff -- ie. not
relying on any other modules -- in m_libcbase.

Also converted the 'size' parameters to functions like VG_(memcpy) and
VG_(strncpy) from Int to SizeT, as they should be.

Also removed VG_(atoll16) and VG_(toupper), which weren't being used.

Also made VG_(atoll36) less flexible -- it now only does base-36 numbers
instead of any base in the range 2..36, since base-36 is the only one we
need.  As part of that, I fixed a horrible bug in it which caused it to
return incorrect answers for any number containing the digits 'A'..'I'!
(Eg. for "A; it would return 17 instead of 10!)

Had to disable the assertions in VG_(string_match), since this module can't
see vg_assert, which wasn't ideal but also isn't a disaster.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3838
2005-06-02 03:39:33 +00:00
Julian Seward
08cd9e5085 Dither
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3780
2005-05-20 02:45:15 +00:00
Julian Seward
161cfde150 First pass at adding ability for Memcheck to print all output in XML
form.  The relevant flag is --xml=yes.  Currently this only works with
Memcheck.

Specifying this flag fixes various other options relating to verbosity
and behaviour of the leak checker, so that the resulting output is in
a relatively fixed form suitable for parsing by GUIs.

Still to do:

* Add mechanism to show error counts
* Add regression test
* Document the resulting format



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3773
2005-05-19 00:25:45 +00:00
Nicholas Nethercote
92c61a5fd1 Don't mix backticks and apostrophes when quoting words -- eg. use 'foo'
rather than `foo', as www.cl.cam.ac.uk/~mgk25/ucs/quotes.html explains
we should (in more detail than you'd imagine was possible).  I did this
both in output messages and in some comments, for consistency.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3723
2005-05-15 17:28:26 +00:00
Julian Seward
2b81a24365 Create a fast version of MC_(helperc_MAKE_STACK_UNINIT), so as not to
slow down call-return intensive amd64 programs too much.  Revised
version is approximately 8 times faster than the naive version.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3689
2005-05-12 23:25:43 +00:00
Julian Seward
a2b0b088db Use the new IRStmt_AbiHints created by the amd64 front end. This
finally makes memcheck able to reliably track the definedness of the
stack on amd64.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3686
2005-05-12 18:05:00 +00:00
Nicholas Nethercote
eb32bc7045 Modularised the malloc/free stuff into two modules: m_mallocfree for the
malloc/free implementation, and m_replacemalloc with the stuff for the tools
that replace malloc with their own version.  Previously these two areas of
functionality were mixed up somewhat.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3648
2005-05-10 02:47:21 +00:00
Nicholas Nethercote
a08662c48c Big clean-up: changed the core/tool interface to be mediated entirely
through the VG_(tdict) function dictionary, rather than using TL_(foo)
functions.

This facilitated the following changes:

- Removed the "TL_" prefix, which is no longer needed.

- Removed the auto-generated files vg_toolint.[ch], which were no longer
  needed, which simplifies the build a great deal.  Their (greatly
  streamlined) contents went into core.h and vg_needs.h (and will soon
  go into a new module defining the core/tool interface).  
  
  This also meant that tool.h.base reverted to tool.h (so no more
  accidentally editing tool.h and not having the changes go into the
  repo, hooray!)  And gen_toolint.pl was removed.  And toolfuncs.def was
  removed.

- Removed VG_(missing_tool_func)(), no longer used.

- Bumped the core/tool interface major version number to 8.  And I
  killed the minor version number, which was never used.  The layout
  of the ToolInfo struct is such that this should not cause problems.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3644
2005-05-09 01:02:08 +00:00