Julian Seward [Sun, 3 Jan 2010 21:24:09 +0000 (21:24 +0000)]
Make sure the Memcheck tests are built on arm-linux using hardware
floating point, since the softfloat results are way different from the
hardware one (not to mention, V reports lots of accesses-below-the-SP
in the softfloat helper functions.)
Julian Seward [Sat, 2 Jan 2010 10:41:46 +0000 (10:41 +0000)]
Redo r10971 ("Made sure that C++ compilers do not complain about the
_VKI_IOC_TYPECHECK() macro") in a way which is easier to understand.
Also, add it for arm-linux.
Julian Seward [Fri, 1 Jan 2010 20:56:13 +0000 (20:56 +0000)]
initUnwindContext: put back into the loop, some initialisations for
ARM which were originally in the loop but inadvertantly got lifted out
during recent merging. This appears to make stack unwinding work
again on ARM-Linux.
Julian Seward [Fri, 1 Jan 2010 18:46:41 +0000 (18:46 +0000)]
Make the Dwarf3 CFI stack unwinding machinery work on arm-linux
too. This is a first step towards making not be completely
x86/amd64-linux specific, and so replaces some x86/amd64-specific
stuff with more general constructions:
* structure 'DiCfSI', into which the info is summarised, has been
made target-specific (ugh), since the sets of registers to be
unwound differ on different targets.
* enum CfiReg and the CFIC_ constants have been expanded
accordingly, to handle both arm and x86/amd64 registers.
The abbreviation "IA" (Intel Architecture) has been used in a
few places where the x86 and amd64 definitions are shared.
* the CFI reader/summariser in readdwarf.c has been expanded &
generalised appropriately.
* the DiCfSI evaluator in debuginfo.c, VG_(use_CFI_info), has
also been generalised appropriately.
The main change is that instead of passing around triples
of (IP, SP, BP) values, a new structure 'D3UnwindRegs' is
passed around instead. This is defined differently for IA and
ARM and succeeds in hiding at least some of the differences
where we don't care about them.
Note also, D3UnwindRegs duplicates, in purpose and structure,
structure 'RegSummary' in priv_d3basics.h. This will be tidied
up in due course.
This commit almost certainly breaks stack unwinding on amd64-linux.
Julian Seward [Fri, 1 Jan 2010 18:30:59 +0000 (18:30 +0000)]
Don't use -Wdeclaration-after-statement. We long since abandoned any
pretense of being buildable with gcc prior to 3.0, hence there's no
point in having this flag.
Julian Seward [Fri, 1 Jan 2010 11:59:33 +0000 (11:59 +0000)]
Merge from branches/ARM, all parts of the ARM-Linux port except for
the changes to do with reading and using ELF and DWARF3 info.
This breaks all targets except amd64-linux and x86-linux.
Bart Van Assche [Tue, 29 Dec 2009 14:11:38 +0000 (14:11 +0000)]
Changes:
- Made sure that C++ compilers do not complain about the header files
include/pub_tool_libcassert.h and include/pub_tool_basics.h.
- Added the source file none/tests/valgrind_cpp_test.cpp. This source file
is compiled together with the regression tests in order to verify that
Valgrind's public header files compile cleanly with a C++ compiler.
These modifications are based on a patch provided by Konstantin Serebryany.
Callgrind: fix bug 217849: Switch to running thread in CLG_(post_signal)
If instrumentation is switched off on multithreaded code,
multiple signals in a row handled by different threads could
confuse callgrind.
Callgrind assumed that in post_signal, it has the correct understanding
of the currently running thread. This is not always correct.
Really switch to running thread.
Tom Hughes [Thu, 3 Dec 2009 09:50:32 +0000 (09:50 +0000)]
Cope with prelink splitting the bss section of an ELF file into separate
dynbss and bss sections by merging them back together again.
This means that (a) we will find variables in the bss and (b) we won't
assert when there is a debuginfo file present where the bss is still
in one piece.
Tom Hughes [Wed, 2 Dec 2009 16:19:12 +0000 (16:19 +0000)]
It seems whoever wrote the preadv and pwritev system calls in the
kernel decided it would be fun to make them always take the low word
of the offset argument before the high word regardless of the
endianism of the system... Consistency - they've heard of it...
Tom Hughes [Wed, 25 Nov 2009 11:29:14 +0000 (11:29 +0000)]
Clean up support for sync_file_range system call and add second version used
by ppc platforms based on patch from Dodji Seketeli. Part fix for #215973.
Tom Hughes [Wed, 25 Nov 2009 11:24:00 +0000 (11:24 +0000)]
Rename LOHI64 to MERGE64 and make it work correctly on big endian
platforms. Also add MERGE64_FIRST and MERGE64_SECOND macros to help
produce the right argument names in error messages on big/little
endian platforms.
Based on patch from Dodji Seketeli. Part fix for #215973.
Tom Hughes [Thu, 12 Nov 2009 13:28:34 +0000 (13:28 +0000)]
Various improvements to DWARF handling to cope with changes in recent
versions of gcc as shipped with Fedora 12. Specific changes include:
- Vastly increase the number of opcodes we understand how to
evaluate when processing a location expression.
- Process frame unwind data from the debug_frame ELF section as
well as the eh_frame section.
- Handle version 3 CIEs in frame unwind data.
- Handle the compact form of DW_AT_data_member_location which just
gives a constant offset from the start of it's base type instead
of a full location expression.
Based on patches from Jakub Jelinek on bugs #210479 and #210566.
Julian Seward [Thu, 5 Nov 2009 08:55:13 +0000 (08:55 +0000)]
New flag: --trace-children-skip=patt1,patt2,etc
Specifies a comma-separated list of executable-names
(with "*" and "?" wildcards allowed) that should not be traced into
even when --trace-children=yes. Modified version of a patch
from Bill Hoffman. Fixes #148932.
Tom Hughes [Tue, 3 Nov 2009 21:14:31 +0000 (21:14 +0000)]
Rework VG_(memmove) in the case where the destination address is greater
that the source address to use the same logic as the mc_replace_strmem.c
version so that underflow is avoided. Fixes #211008.
Tom Hughes [Thu, 29 Oct 2009 14:03:02 +0000 (14:03 +0000)]
If a signal arrives when a thread which has just finished executing a
system call is between the blksys_committed and blksys_finished markers
in the system call routine then the post handler for the system call
was failing to run.
This commit fixes that by ensuring that the syscall status is recovered
from the guest state before the post VG_(post_syscall) is called just
as VG_(client_syscall) would normally do when the assembly wrapper
returned. Without that VG_(post_syscall) will not do anything a it
will think the system call is still running.
Tom Hughes [Thu, 29 Oct 2009 09:27:11 +0000 (09:27 +0000)]
Add support for ELF indirect functions. These are symbols of
type STT_GNU_IFUNC which, instead of pointing directly at the
function, point at a routine which will return the address of
the real function. Redirection of indirect functions is handled
by valgrind as follows:
- When a redirection specification matches an indirect
function symbol an active redirection is added in the
normal way, but with the isIFunc flag set.
- When a call is made to an address which matches an
active redirection with the isIFunc flag set the call
is redirected, but not to the target address of the
redirection - instead it is sent to a small wrapper
routine that is preloaded into the client.
- The wrapper routine calls the original client routine
and collects the result, which it reports to valgrind
using a client request, and then returns the result to
the caller.
- When valgrind gets the client request it looks up the
active redirection for the indirect function and then
adds a new active redirection which redirects from the
address returned by the indirection function to the
redirection target. This new redirection does not have
the isIFunc flag set so behaves as a normal redirection.
In addition to the above we also add a few new redirections to
memcheck to capture internal calls made by glibc to things like
strlen, as these internal calls do not go through the indirect
function and instead go direct to the chosen implementation.
Based on a patch from Dodji Seketeli and comments from Jakub
Jelinek, this commit closes bug 206013.
Bart Van Assche [Mon, 26 Oct 2009 16:14:04 +0000 (16:14 +0000)]
Removed the restriction that the size argument of drd_pre_mem_read_asciiz()
should be less than 4096 bytes. This function is called a.o. for the path
argument of the open() system call. This path can be longer than 4096 bytes.
Should fix bug #211941.
Bart Van Assche [Tue, 20 Oct 2009 18:13:26 +0000 (18:13 +0000)]
Fixed an assertion failure triggered by running DRD with the command-line option --trace-mutex=yes on a program using one of the ANNOTATE_HAPPENS_*() macros.