Julian Seward [Tue, 21 May 2002 00:44:02 +0000 (00:44 +0000)]
- Fix __NR_poll printing
- Invert the sense of IOC_READ / IOC_WRITE in generic ioctl handler
(Simon Hausmann)
- TIOCSPGRP (Peter A Jonsson); also add a missing break in the ioctl stuff
Julian Seward [Sat, 18 May 2002 13:14:17 +0000 (13:14 +0000)]
Fix fork/exec stuff so it works again. We have to mangle LD_LIBRARY_PATH
as well as LD_PRELOAD, so as to make our libpthread.so go out of scope
when a child which we don't want to trace, is exec'd. Otherwise the
child can wind up being connected to our libpthread.so but not to
valgrind.so, which is an unworkable combination; you have to be connected
to both or neither.
Julian Seward [Thu, 16 May 2002 11:06:21 +0000 (11:06 +0000)]
Remove existing non-working support for self-modifying code, and instead
add a simple compromise, in which the client can notify valgrind
that certain code address ranges are invalid and should be retranslated.
This is done using the VALGRIND_DISCARD_TRANSLATIONS macro in valgrind.h.
At the same time take the opportunity to close the potentially fatal
loophole that translations for executable segments were not being
discarded when those segments were munmapped. They are now.
Julian Seward [Wed, 15 May 2002 21:13:39 +0000 (21:13 +0000)]
In accordance with "build one to throw away, you will anyway (tm)",
throw away the old signals simulation and more or less start again
from scratch. vg_signals.c is nearly a complete rewrite. In fact
this is now the third generation of the signals simulation.
The purpose of this is to properly support signals in threads -- a
nightmare combination. pthread_sigmask, pthread_kill and sigwait
are now alledged to work as POSIX requires.
In the process, throw away confusing and conceptually muddled old
implementation and replace with something which is more verbose but
conceptually cleaner, simpler and easier to argue is correct.
* When the client does sigaction/sigprocmask et al, the resulting
changes are stored verbatim in SCSS -- the Static Client Signal State.
So SCSS is the state the client believes the kernel is in.
* Every time SCSS changes, we recalculate the state the kernel
*should* be in so that our signal simulation works. This is the
SKSS -- Static Kernel Signal State. The kernel state is then
updated accordingly. By diffing the new and old SKSSs, the
number of real system calls made is minimised.
* The dynamic state of the client's signals is stored in DCSS
-- Dynamic Client Signal State. This just records which signals
are pending for which threads.
The big advantage of this scheme over the previous is that the SCSS ->
SKSS mapping is made explicit and gathered all in one place, rather
than spread out in a confusing way and done implicitly. That makes it
all lot easier to decide if the mapping, which is really the heart of
the signals simulation, is correct or not.
Expanded --sort option to take threshold args with the event names. Lets you
do things like "show functions covering 99% of all D2mr events *and* 99% of all
D2mw events" - before you could only choose the threshold for one.
Useful for me, but probably no-one else. Still mentioned it in the docs,
though.
Julian Seward [Sun, 12 May 2002 03:00:17 +0000 (03:00 +0000)]
In order to catch timeout events on fds which are readable and which
have been ioctl(TCSETA)'d with a VTIMEout, we appear to need to ask if
the fd is writable, for some reason. Ask me not why. Since this is
strange and potentially troublesome we only do it if the user asks
specially, by specifying --wierd-hacks=ioctl-VTIME.
Julian Seward [Fri, 10 May 2002 21:07:22 +0000 (21:07 +0000)]
New and hopefully more reliable method for finding argc/argv/envp at
startup, by looking for the ELF frame created on the process' stack
at startup. This avoids having to deal with problems caused by glibc
magic offsets.
WARNING: only works for 2.2 kernels right now. 2.4 is broken.
Julian Seward [Fri, 10 May 2002 21:03:56 +0000 (21:03 +0000)]
Modify the startup mechanism so that any call into valgrind's libpthread.so
will start up valgrind if it is not already running. This more or less
sidesteps the problem that sometimes valgrind.so isn't init'd first by
the dynamic linker.
Julian Seward [Fri, 10 May 2002 03:03:57 +0000 (03:03 +0000)]
Insert hacks, only partially successful, to make 'make distcheck' work
with the new vg_libpthread.vs linker script. Problem is that builds
where builddir != srcdir don't work now. Don't know how to fix.
Julian Seward [Thu, 9 May 2002 17:38:13 +0000 (17:38 +0000)]
Remove valgrind's use of libc-supplied stat() and sbrk(). Now the only
sysbols we need from libc are __umoddi3 and __udivdi3 ; other than that
valgrind.so is completely self-contained.
Julian Seward [Thu, 9 May 2002 12:01:14 +0000 (12:01 +0000)]
Reinstate a condition in the IPCOP_shmctl wrapper without which the
system dies to the recently-rejuvenated
first-and-last-secondaries-look-plausible assertions around syscalls.
Julian Seward [Wed, 8 May 2002 00:32:50 +0000 (00:32 +0000)]
Improvements to the error-collecting machinery:
- Don't waste a potentially huge amount of time calling describe_addr
on addresses in errors we aren't going to show.
- If an invalid address is just below %ESP, say that it might be due
to a gcc bug. Increase the window in which this is allowed to
1024 bytes below %ESP.
Julian Seward [Tue, 7 May 2002 23:45:03 +0000 (23:45 +0000)]
Actually call VG_(first_and_last_secondaries_look_plausible) and make
assertions about the return value, rather than asserting the
non-NULL-ness of the function's address :) Classic beginner's mistake,
compounded by C's crappy (non-existent) type system, which allows me
to silently confuse Bool with Pointer-to-Function. What a great
programming language. Come back Haskell, all is forgiven.
Julian Seward [Tue, 7 May 2002 23:38:30 +0000 (23:38 +0000)]
Generate better ucode for back-to-back sequences of register pushes and
pops, as appear at function prologues/epilogues. Specifically, update %ESP
just once for the whole sequence. This reduces by about 20% the number
of calls to handle_esp_assignment (for kate in KDE 3.0, -O), which is a
good thing since that is quite expensive.
vg_symtab2.c:
- No longer aborting when encountering a N_SOL symbol after the 65535th
line in a file, just printing a warning/apology that annotations/messages
might be wrong.
This is a pain to fix properly, since it requires first guessing when a
line number overflow happens, then switching to one or more other files,
then switching back.