22 Commits

Author SHA1 Message Date
Julian Seward
ed20eaa97a Change memcheck's (client) realloc implementation so that it copies
and moves the block even when the new size is smaller or the same.
This increases the chance that it can detect buggy code which assumes
that realloc-smaller doesn't cause the block to move.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8454
2008-07-22 18:23:16 +00:00
Bart Van Assche
8e96150945 Merged FORMATCHECK branch (r8368) to trunk.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8369
2008-07-07 06:49:24 +00:00
Julian Seward
4cae5c3ed5 Merge branches/OTRACK_BY_INSTRUMENTATION into the trunk. This adds
support to Memcheck for tracking the origin of uninitialised values,
if you use the --track-origins=yes flag.

This currently causes some Memcheck regression tests to fail, because
they now print an extra line of advisory text in their output.  This
will be fixed.

The core-tool interface is slightly changed.  The version number for
the interface needs to be incremented.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7982
2008-05-01 20:24:26 +00:00
Bart Van Assche
2497cadb85 Refined mallinfo() implementation (contributed by Eugene Toder).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7901
2008-04-21 17:28:50 +00:00
Julian Seward
14af4957fc Merge in the DATASYMS branch.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7540
2008-03-03 01:35:41 +00:00
Julian Seward
5679a22410 Update copyright dates ("200X-2007" --> "200X-2008").
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7398
2008-02-11 11:34:59 +00:00
Julian Seward
9ad4d494fa New options for Memcheck, --malloc-fill=<hexnumber> and
--fill-free=<hexnumber>, which cause malloc'd(etc) and free'd(etc)
blocks to be filled with the specified value.  This can apparently be
useful for shaking out hard-to-track-down memory corruption.  The
definedness/addressability of said areas is not affected -- only the
contents.  Documentation to follow.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7259
2007-11-30 21:41:40 +00:00
Julian Seward
755bc0ea22 Make the freed-block-queue volume metrics 64-bit throughout, to avoid
any wierdness on very large machines in the future.  Also, double the
default size from 5MB to 10MB, on the basis that programs are now on
average twice as lardy as they were when it was set to 5MB, whenever
that was.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7256
2007-11-30 17:19:36 +00:00
Julian Seward
75fd9878c9 Merge (from branches/THRCHECK) the following amd64-linux stack unwind
kludges^H^H^H^H^H^H^Henhancements:

r6802: For VG_(record_ExeContext) et al, add a new parameter
(first_ip_delta) which is added to the initial IP value before the
stack is unwound.  A safe value to pass is zero, which causes the
existing behaviour to be unchanged.  This is a kludge needed to work
around the incomplete amd64 stack unwind info in glibc-2.5's clone()
routine.

r7059: Add a last-ditch heuristic-hack to the amd64-linux stack
unwinder, which is used when all other methods fail.  Seems like GDB
has something similar.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7118
2007-11-09 23:02:28 +00:00
Julian Seward
5338c831db Don't print warnings about silly args to malloc/calloc in XML mode.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7111
2007-11-09 11:33:02 +00:00
Nicholas Nethercote
3f2e579afa Change an Int to a SSizeT to avoid overflows. Fixed bug 148174.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6855
2007-09-17 22:46:45 +00:00
Julian Seward
0e70d01bdd Changes to m_hashtable:
Allow hashtables to dynamically resize (patch from Christoph
Bartoschek).  Results in the following interface changes:

* HT_construct: no need to supply an initial table size.
  Instead, supply a text string used to "name" the table, so
  that debugging messages ("resizing the table") can say which
  one they are resizing.

* Remove VG_(HT_get_node).  This exposes the chain structure to 
  callers (via the next_ptr parameter), which is a problem since
  callers could get some info about the chain structure which then
  changes when the table is resized.  Fortunately is not used.

* Remove VG_(HT_first_match) and VG_(HT_apply_to_all_nodes) as
  they are unused.

* Make the iteration mechanism more paranoid, so any adding or
  deleting of nodes part way through an iteration causes VG_(HT_next)
  to assert.

* Fix the comment on VG_(HT_to_array) so it no longer speaks 
  specifically about MC's leak detector.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6778
2007-08-25 07:19:08 +00:00
Julian Seward
458d626be4 Use a 64-bit counter to keep track of the total number of bytes
allocated, rather than SizeT which is word-sized.  Your average C++
lardware can easily turn over more than 4G in total in a half hour run
on a 32-bit machine, in which case the counter wraps around.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6649
2007-03-14 11:57:37 +00:00
Nicholas Nethercote
ace4f264b9 wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6639
2007-03-10 02:27:44 +00:00
Julian Seward
172505c978 Update copyright dates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6488
2007-01-08 06:01:59 +00:00
Nicholas Nethercote
d162731a2c Completely overhauled the internals of Memcheck's error handling. All the
different error kinds were reusing the same struct for storing their
details.  Each one used some but not all the fields, and the AddrInfo was
similar, and it was very confusing.

So I changed MC_Error and AddrInfo to be tagged unions, like Vex's IRExpr and
IRStmt types.  The resulting code is a little more verbose but much easier
to understand.  I also split up several error kinds, which also made things
simpler.  The user-visible behaviour is identical except for a couple of
very minor things that I've documented in the NEWS file for the 3.3.0
release.

Ideally I'd get rid of the Addr and Char* fields in the core Error type,
which are not always used, and do them similarly within tools.  But that
would require changing the core/tool interface, so I'm leaving it for the
moment.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6402
2006-12-16 00:54:12 +00:00
Julian Seward
a81be9f483 A memory pool update from Graydon Hoare.
Here's an update to the mempool move / change client requests and sanity 
checking. The following changes are present:

   - Added one more (hopefully last) client request, a predicate to
     test whether a mempool anchor address is currently tracked.
     It turns out mozilla's arena-using code is sufficiently inconsistent
     in its assumptions that it's very difficult to phrase the valgrind
     client-request annotations without this request. Namely: sometime
     arena-init and arena-free operations are assumed to be idempotent.

   - Fixed a very rapid tool-memory leak in the mempool sanity check
     routine. The previous version of the patch I posted would use all
     memory even on my Very Beefy Test Machine within ~15 minutes of
     browsing with firefox.

   - Added a little logging code to print the counts of pools and chunks
     active every ~10000 sanity checks, when running with -v.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6197
2006-10-05 17:59:23 +00:00
Julian Seward
ce55e7ecf3 A small fix to the "mempool trim" client request; the previous version
didn't cope with zero-sized chunks properly.  (from Graydon Hoare).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6006
2006-08-16 17:51:28 +00:00
Julian Seward
7586467ab5 Add a mempool-trimming client request (Graydon Hoare).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5992
2006-07-28 00:06:37 +00:00
Julian Seward
ad67fd79fe Update copyright dates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5954
2006-06-05 23:21:15 +00:00
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
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