598 Commits

Author SHA1 Message Date
Nicholas Nethercote
a8c9970a34 Cleaned up the mess that was the treatment of "below main" functions such as
'__libc_start_main', in Massif, m_debuginfo and m_stacktrace.  As part of
this, --show-below-main is now visible to tools, and Massif pays attention
to it.

Improved the description of --show-below-main=yes in the manual.

Replaced some instances of "__libc_start_main" in the test *.exp files with
"(below main)", which is what will actually be seen.  Also updated
scalar.stderr.exp*, which should make it get closer to actually passing.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9131
2009-02-10 06:48:00 +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
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
0707edc9a5 Unbreak the build on aix5.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8867
2008-12-23 02:09:17 +00:00
Julian Seward
ba2ece03b8 This commit subtly changes the meaning of the values obtained via the
stack unwind mechanism (the function VG_(record_ExeContext) et al),
clears up some associated kludges, and makes suppression matching work
more reliably.

Prior to this commit, a stack snapshot contained, at [0], the IP of
the relevant thread, and at all positions [1] and above, the return
addresses for the open calls.

When showing a snapshot to the user (in VG_(apply_StackTrace)), and
searching the stack for stack blocks (in VG_(get_data_description)), 1
is subtracted from positions [1] and above, so as to move these return
addresses back to the last byte of the calling instruction.  This
subtraction is also done even in VG_(get_StackTrace_wrk) itself, in
order to make the stack unwinding work at all.

It turns out that suppression-vs-function-name matching requires the
same hack, and sometimes failed to match suppressions that should
match, because of this self-same problem.

So the commit changes the stack unwinder itself, so that entries [1]
and above point to the last byte of the call instruction, rather than
the return address.  The associated kludges in VG_(apply_StackTrace)
and VG_(get_StackTrace_wrk) are removed, and suppression matching is
observed to work in a case where it failed before.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8818
2008-12-12 13:23:03 +00:00
Julian Seward
09dac86eca Add a new module, m_seqmatch, which does very simple sequence (regexp)
matching, in the function VG_(generic_match).  Patterns to be matched
against may contain only '*'-style wildcards (matches any number of
elements, we don't care what they are), '?' wildcards (matches exactly
one element, we don't care what it is) and literal elements.

It is totally abstractified, in the sense that the pattern and input
arrays may be arrays of anything.  The caller provides enough
information so that VG_(generic_match) can step along both arrays, and
can ask the questions "is this pattern element a '*' ?", "is this
pattern element a '?' ?", and "does this pattern element match an
input element ?".

The existing function VG_(string_match) is reimplemented using
VG_(generic_match), although the ability to escape metacharacters in
the pattern string is removed -- I don't think it was ever used.

In m_errormgr, matching of suppression stacks (including wildcard
"..." lines) against error stacks is re-implemented using
VG_(generic_match).

Further detailed comments are in m_seqmatch.h and pub_tool_seqmatch.h.

A negative side effect is that VG_(string_match) will be much slower
than before, due to the abstractification.  It may be necessary to
reimplement a specialised version later.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8816
2008-12-12 08:07:49 +00:00
Julian Seward
5aa3e073b7 * Add a VG_(sizeSWA) function
* Fix spacing a bit



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8808
2008-12-06 23:34:52 +00:00
Julian Seward
dee63731b9 Add a new container data type, a Sparse Word Array: an array of UWord
which is also indexed by UWord.  This can be used as a replacement for
WordFM with unboxed keys, when the key ranges are dense.  It is
implemented as a 256-way radix tree (4-deep on 32-bit platforms,
8-deep on 64-bit platforms).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8806
2008-12-06 22:07:35 +00:00
Julian Seward
a6613bcb2b Change the memory allocation strategy used by the conflicting-access
machinery, so as to allocate fewer chunks of memory.  This increases
the speed of Helgrind by about 10% on some apps, which probably means
the conflicting-access machinery itself is about 20% faster.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8803
2008-12-03 11:39:37 +00:00
Julian Seward
3b60492dc1 Add a comment re VG_(expand_file_name).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8773
2008-11-17 12:45:01 +00:00
Julian Seward
24917a1daa Add performance comments to VG_(sizeFM), and add new method
VG_(isEmptyFM), currently commented out.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8765
2008-11-13 13:17:06 +00:00
Julian Seward
3a2fbbfafd Add ioctl wrappers for Linux wireless extensions version 22.
Patch from Gwenael Lambrouin.  Fixes #159452.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8734
2008-11-05 16:59:55 +00:00
Julian Seward
f4bffe6909 Support sys_pipe2 on {amd64,x86}-linux. Also, update syscall numbers
for all supported Linuxes to those in linux-2.6.28-rc3.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8730
2008-11-05 11:20:59 +00:00
Julian Seward
e9c7a88688 Update the C++ demangler to that from libiberty in the gcc svn trunk,
rev 141363.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8710
2008-10-26 11:53:30 +00:00
Julian Seward
35c28b721f Merge Helgrind from branches/YARD into the trunk. Also includes some
minor changes to make stack unwinding on amd64-linux approximately
twice as fast as it was before.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8707
2008-10-25 16:22:41 +00:00
Julian Seward
c50d12960e get_Seg_containing_addr() (in h_main.c): remove naive algorithm that
searches through all live Segs and replace it with one which is O(log
N) in the number of live Segs.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8676
2008-10-18 19:55:31 +00:00
Nicholas Nethercote
0cf8a14c70 - Reinstate the 'atfork' from 2.4.0, which was more powerful, and expose it to
tools.
- Factor out 'execv' from 'system' and expose it to tools.

Partly based on a patch from Robert O'Callahan.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8669
2008-10-13 04:19:15 +00:00
Nicholas Nethercote
cc2603ae7a Patch from Robert O'Callahan:
create and expose 'dup2'


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8667
2008-10-12 19:53:28 +00:00
Julian Seward
335992d8fc Merge all remaining changes from branches/PTRCHECK. These are some
relatively minor extensions to m_debuginfo, a major overhaul of
m_debuginfo/readdwarf3.c to get its space usage under control, and
changes throughout the system to enable heap-use profiling.

The majority of the merged changes were committed into
branches/PTRCHECK as the following revs: 8591 8595 8598 8599 8601 and
8161.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8621
2008-09-18 18:12:50 +00:00
Julian Seward
9d24c252e1 Make VG_(addToXA) and VG_(addBytesToXA) 64-bit clean.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8525
2008-08-19 08:57:49 +00:00
Julian Seward
27b2106884 Move the WordFM (AVL trees of UWord-pairs) implementation from
helgrind/ into the core.  It's just too darn useful to not be in the
core.  There is some overlap in functionality between OSet and WordFM,
but OSet is more space efficient in some circumstances, whereas WordFM
is easier to use and a bit more flexible in some cases.

Also in this new module (m_wordfm) is a type WordBag, build on top of
WordFM.  This provides Multiset of UWords functionality.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8524
2008-08-19 08:38:52 +00:00
Julian Seward
e5150447d7 Presently, Valgrind (non-client) code that wants to use the stat
family of syscalls is impossible to write in a way that's portable and
correct.  On some targets (eg x86-linux) you need to do sys_stat64 and
receive the results in a 'struct vki_stat64'.  But on other targets
(eg amd64-linux) neither sys_stat64 nor 'struct vki_stat64' exist.

This commit adds a new type, 'struct vg_stat', which contains 64 bit
fields in all the right places, and makes VG_(stat) and VG_(fstat) use
it.  This means callers to the two functions no longer need to worry
about the is-it-64-bit-clean-or-not question, since these routines
reformat the received data into a'struct vg_stat'.  Kind of like what
glibc must have been doing for decades.

This (indirectly) fixes a bug on x86-linux, in which m_debuginfo would
sometimes fail to read debug info, due to VG_(di_notify_mmap) using
VG_(stat) (hence sys_stat) on the file, which failed, and when in fact
it should have used sys_stat64.  Bug reported and tracked down by
Marc-Oliver Straub.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8522
2008-08-19 07:03:04 +00:00
Julian Seward
811f102388 The address space manager, and in particular the NSegment type,
hardwire the assumption that an inode number is a UWord, that is, a
host word.  There's no reason for that assumption to be valid; an
inode number could be a 64-bit int even on a 32 bit platform (eg w.r.t
sys_stat64).  This commit changes inode numbers and, for good measure,
dev numbers, to be 64-bit regardless.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8521
2008-08-18 21:47:11 +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
Bart Van Assche
46cb6b91d7 - Added support for querying information about .plt sections.
- Added support for .got.plt sections.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8127
2008-05-25 16:37:22 +00:00
Bart Van Assche
803356ed73 Added CLOCK_* definitions.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8071
2008-05-14 09:44:06 +00:00
Julian Seward
a1289fb4ca Bump the core/tool iface version number, since the just-merged-in
changes for Memcheck origin tracking change the interface (slightly).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7984
2008-05-01 21:43:17 +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
c6d4c09e7c Added support for timerfd_create(), timerfd_gettime() and timerfd_settime() system calls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7942
2008-04-27 12:56:06 +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
Bart Van Assche
f760d16eb7 Added VG_(thread_get_stack_size)().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7799
2008-03-29 09:25:53 +00:00
Bart Van Assche
f2526f4f35 Moved macro's that specify branch prediction hints to include/pub_tool_basics.h
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7745
2008-03-22 08:04:29 +00:00
Bart Van Assche
5281f69053 Enable compile-time format string checking by gcc if the macro CHECK_FORMAT_STRINGS has been defined before this file has been included.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7731
2008-03-17 18:57:03 +00:00
Nicholas Nethercote
fcb6ba0407 update comments
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7543
2008-03-03 02:15:03 +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
Bart Van Assche
e8e47e4461 Added const keyword to second argument of VG_(OSetGen_Remove)().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7436
2008-02-23 19:04:44 +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
443b85bdee Move VG_(clo_backtrace_size) to a tool-visible header file.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7331
2008-01-09 18:37:41 +00:00
Tom Hughes
4ad22500c0 Made the argument to VG_(am_get_filename) const as it doesn't need
to be modified and the routine to find the segment for an address now
returns a const pointer.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7325
2008-01-08 16:48:30 +00:00
Tom Hughes
cc3aba0192 Update linux system call lists based on 2.6.23.1 kernel source.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7323
2008-01-08 16:10:47 +00:00
Tom Hughes
3f4849d83f Add const qualifiers to appropriate arguments of OSet routines.
Patch from Bart Van Assche <bart.vanassche@gmail.com>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7308
2007-12-30 12:28:26 +00:00
Julian Seward
652c5531b1 AIX5 counterpart to r7302: Improve handling of programs which require
very large main thread stacks.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7306
2007-12-22 14:12:42 +00:00
Julian Seward
da0726854c Add a new method VG_(record_depth_1_ExeContext), a trivial derivative
of VG_(record_ExeContext), which just records the first stack frame
but does not attempt to unwind the (guest) stack.  This is useful in
situations where we suspect unwinding the stack might cause a
segfault.

Use this in m_signals, when getting a backtrace following a guest
segfault.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7304
2007-12-21 01:24:59 +00:00
Julian Seward
37742f8d11 Don't do comparisons of (signed) Words by merely subtracting them, as
this does not always produce correct results.  Instead use a slower
but correct method.  Fixes #147545.  (Nick Nethercote, Tom Hughes et
al)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7283
2007-12-09 02:08:42 +00:00
Nicholas Nethercote
d17c45b9d1 Document flakiness of NON_SIMD_CALL* in comments and the manual.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7279
2007-12-05 21:51:50 +00:00
Julian Seward
d19b3f97a8 Futz with headers.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7264
2007-12-02 02:06:46 +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
f5adf7f83a Get rid of VG_NUMW_CLO, as it is pretty much identical to VG_NUM_CLO,
and only used in one place.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7257
2007-11-30 17:50:44 +00:00
Nicholas Nethercote
79d4505e99 Back out r7221, which was incorrect.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7224
2007-11-26 02:55:12 +00:00
Nicholas Nethercote
73f9cade8f Fix NUM_CLO checking.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7221
2007-11-26 00:00:32 +00:00