Tom Hughes [Sun, 27 Jun 2004 12:48:53 +0000 (12:48 +0000)]
Commit the patch from bug 69508 that seeks to make more of the pthread
stack attribute related functions work properly as it seems to be a
sensible thing to improve even if it isn't enough to get the JVM running
under valgrind now.
Changed (client-heap-size : client-map-seg-size) ratio from 3:1 to 1:2.
As a result, can now mmap much more memory (eg. for Memcheck, 850MB up from
250MB, for Nulgrind 1750MB up from 700MB). The heap is smaller, but that
doesn't matter much, since programs use brk() directly only rarely, and
malloc() falls back on mmap() if brk() fails anyway.
Also changed the debug info printing for memory layout slightly.
Tom Hughes [Sat, 26 Jun 2004 11:27:52 +0000 (11:27 +0000)]
Implement an emulated soft limit for file descriptors in addition to
the current reserved area, which effectively acts as a hard limit. The
setrlimit system call now simply updates the emulated limits as best
as possible - the hard limit is not allowed to move at all and just
returns EPERM if you try and change it.
This should stop reductions in the soft limit causing assertions when
valgrind tries to allocate descriptors from the reserved area.
to be consistent with each other and other options (esp. --input-fd). Also
renamed some related variables. The old names still work, for backwards
compatibility, but they're not documented.
Tom Hughes [Sat, 19 Jun 2004 13:02:34 +0000 (13:02 +0000)]
Don't try and validate the contents of the environment passed to
the execve system call if the envp pointer is null as it causes
valgrind to die with a segmentation fault.
Introduced 4 macros to minimise boilerplate command line processing code.
Nicely cuts around 130 lines of code, spread over the core and several tools.
Tom Hughes [Wed, 16 Jun 2004 20:51:45 +0000 (20:51 +0000)]
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.
Fixed up various command line option scenarios:
- If no tool is specified, V now gives a short message and a list of
available tools. This was meant to happen previously, but a bug prevented
it from working properly; it gave the usage message instead.
- If a bad option is given, V now gives a short message rather than the full
--help. This make V consistent with all other programs I looked at.
- Now returning 0 when you do 'valgrind --help' and 'valgrind --version'
as other programs do.
- Removed VG_(startup_logging)() and VG_(shutdown_logging)() as they were
empty and have been for a long time (always?).
- Added various tests for these scenarios. Had to change the regtest
script slightly to allow for malformed command lines.
Fix problem with FC2's vdso (sysinfo) page, which lives at a low,
random address. This gets unmapped as part of the client setup, and
causes syscalls to fail as a result. This patch simply disregards the
sysinfo page. It seems like a blunt fix, but I don't think anything
depends on a sysinfo page.
Tom Hughes [Sun, 13 Jun 2004 12:07:53 +0000 (12:07 +0000)]
When cancelling a thread that is waiting on a condition variable we
need to relock the associated mutex before running the cancellation
handlers.
This patch ensures that the mutex is reaquired in the above case and
also makes pthread_join and pthread_cond_wait act as cancellation points
as required by the POSIX threads standard.
Based on patch from Joseph Link <joelink@joelink.net>.
Tom Hughes [Sun, 13 Jun 2004 09:59:02 +0000 (09:59 +0000)]
Add support for separate debug files, which are just separate ELF files
containing the relevant debug sections and located using the information
in the .gnu_debuglink section of the main file along with some search
rules and checksum logic borrowed from binutils/gdb.
Tom Hughes [Sat, 12 Jun 2004 12:58:22 +0000 (12:58 +0000)]
It appears that NPTL uses a new system for dealing with cleanup
handlers when a thread is cancelled which has the side effect that
programs linked with librt fail on Fedora Core 2 due to librt having
been built against the NPTL header instead of the old pthread headers.
This change extends valgrind's libpthread.so to handle both the old
and new style cleanup handlers in a similar way to NPTL and seems to
be sufficient to get programs linked with librt working again.
Tom Hughes [Fri, 4 Jun 2004 21:42:18 +0000 (21:42 +0000)]
There is no __accept in any libc or libpthread that I can find so
it isn't clear why we were intercepting that and only aliasing accept
to it. Switched to intercepting accept directly instead.
Tom Hughes [Thu, 3 Jun 2004 18:00:58 +0000 (18:00 +0000)]
Changed cancellation wrappers to use dlsym(RTLD_NEXT) to look up the
libc version of the wrapped function when forwarding the call rather
than trying to call the internal __libc_xxx version of the routine
as many of those are marked as GLIBC_PRIVATE in recent releases.
Partial fix for bug 76869. This fixes the problem with returning from
a signal handler when VDSOs are turned off in FC2. Note that we don't
(yet) support VDSOs being on (use "echo 0 > /proc/sys/kernel/vdso").
Fix wishlist item 82098, thanks to Ralf Wildenhues:
ANSIfication of the hp2ps code. The most important changes are the correct
use of the stdarg mechanism (former hacks could bite on other systems, so
please tell upstream), inclusion of stdlib.h instead of declaring free
yourself, adding a few missed PROTO()s and using size_t for xmalloc and
xrealloc.:
Addrcheck wasn't doing overlap checking as it should. This is because
mac_replace_strmem.o was being linked with vgskin_addrcheck.so instead of
vgpreload_addrcheck.so. I fixed the Makefile, and also moved
_VG_USERREQ__MEMCHECK_GET_RECORD_OVERLAP so Addrcheck could see it. And I
added the 'overlap' test (from memcheck/tests/) to Addrcheck's regression
suite.
Tom Hughes [Wed, 21 Apr 2004 15:39:57 +0000 (15:39 +0000)]
Change the debugger attachment code to send the STOP signal to the
forked process before using ptrace() to continue it, instead of asking
ptrace to deliver it, as that doesn't seem to work on some versions
of linux.
Tom Hughes [Wed, 21 Apr 2004 15:16:43 +0000 (15:16 +0000)]
Initialise %cs, %ds and %ss in the virtual machine to match the values
supplied by the operating system for the code, data and stack segments.
Explicit references using these segments still won't work but they
will at least produce an assertion to indicate that they aren't
supported instead of raising a segmentation fault in the target
program because of an apparent privilege violation.
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.
Fix for bug 77869. Names in stabs are terminated by ':'. Except templated
names, which can have :: within <> quotes. Except when it's an operator,
which can have a name like operator<, followed by ::.
Suppressions of jump errors were broken, because the size was zero and
so caused an assertion failure. So set size == 1 -- it's only used for
suppressions.
Address 0x%x is not stack'd, malloc'd or (recently) free'd
This makes things clearer in some circumstances, particularly when bogusly
accessing heap memory that has been freed, but Memcheck is no longer tracking.
Revamped. Split into sections, added stuff about the name "Valgrind" (where it
comes from, pronunciation), removed some obsolete questions, added some new
ones.