VG_(record_free_error) / VG_(record_freemismatch_error) are called
by the scheduler, not by generated code. So pass in the relevant
ThreadState*; don't get it from VG_(get_current_tid)().
Continue trying to extract myself from the pthread_mutex_* swamp.
Fall back to a compromise position, which makes my mutex implementation
initialiser- and structure-compatible with LinuxThreads, and ditto the
upcoming condition var implementation. In particular this means that
((ThreadId)0) is an invalid thread ID, so vg_threads[0] is never used,
and vg_threads[1] specially denotes the "main" thread.
Remove the scheme of having a linked list of threads waiting on
each mutex. It is too difficult to get the right semantics for
when a signal is delivered to a thread blocked in pthread_mutex_lock().
Instead, use the old scheme of each thread stating with its .waited_on_mx
field, which mutex it is waiting for. This makes pthread_mutex_unlock()
less efficient, but at least it all works.
Show backtraces for all threads in vg_assert, VG_(panic) and
VG_(unimplemented). In future this will not be enabled by default due
to the danger of recursion of assertion failures.
Change --trace-pthread= flag to accept none|some|all, for finer level
of pthread event tracing. And allow this info to be passed across to
the client, where vg_libpthread.c uses it to also control verbosity.
Add more pthread wrappers in a failed attempt to get Opera 6.0TP2
to run. Now it creates some threads but segfaults. Also add
wrapper for syscall __NR_mremap; it is way wrong, but finding
a decent description of what mremap() really does is nearly
impossible.
Handle VG_USERREQ__PTHREAD_GET_THREADID and VG_USERREQ__RUNNING_ON_VALGRIND
cheaply, with the trivial-client-request mechanism. The latter is called
once per pthread call, even simple ones like pthread_mutex_[un]lock.
Get rid of the --client-perms= flag. Valgrind now depends critically
on the client-request subsystem, and disabling it is no longer a
sensible thing to do.
Also: in the manual, mention flags --trace-sched= and --trace-pthread=.
Turns out these insns are also available as Grp8 extensions, with
literal bit-offset values. Nuisance. I've #if 0'd out the old code
which implements them since am too lazy to fix them properly, and I
can't find any cases of their use anyway. I'll wait until someone
yelps.
Add fairly comprehensive test case for bt/bts/btc/btc, mem and reg
targets, although size-L (4-byte) only. In any event the jitter
doesn't handle the size 2 case and has never been asked too, AFAIK.
Correctly implement x86 bt/btc/bts/btr insn. Previous impl was wrong:
* Didn't handle correctly operands in memory, where arbitrary signed
bit offsets are allowed. Prior impl will trash the client's stack
and give the wrong answer.
* Was done by a helper function and therefore could give spurious
value errors.
Now the address computations are done in-line.
Old implementation is there, but unused and scheduled for demolition.
Add dummy stubs for pthread_key_create, pthread_key_delete,
pthread_setspecific, pthread_getspecific. They don't do anything
right now and may well crash programs which use them.
Cleanup of the dispatch mechanism. Now syscall returns and the final
request to shutdown valgrind are done with the client request
mechanism too. This is much better than having to check all
call/return addresses.
Clean up debug printing for scheduler / pthreads. Two new flags,
--trace-sched=no|yes and --trace-pthread=no|yes, if you really want
to see tons of gory details.
Mega-merge of my last 2 weeks hacking. This basically does the groundwork
for pthread_* support. Major changes:
* Valgrind now contains a (skeletal!) user-space pthreads
implementation. The exciting bits are in new file vg_scheduler.c.
This contains thread management and scheduling, including nasty crud
to do with making some syscalls (read,write,nanosleep) nonblocking.
Also implementation of pthread_ functions: create join
mutex_{create,destroy,lock,unlock} and cancel.
* As a side effect of the above, major improvements to signal handling
and to the client-request machinery. This is now used to intercept
malloc/free etc too; the hacky way this is done before is gone.
Another side effect is that vg_dispatch.S is greatly simplified.
Also, the horrible hacks to do with delivering signals to threads
blocked in syscalls are gone, since the new mechanisms cover this case
easily.
Julian Seward [Sat, 30 Mar 2002 02:02:04 +0000 (02:02 +0000)]
Please change my e-mail address to amu@alum.mit.edu; monk is just a
finger server that knows how to deal with my account. (Perhaps I
should clarify my .sig?)
Frédéric Gobry [Tue, 26 Mar 2002 20:44:55 +0000 (20:44 +0000)]
Applied patch from Simon Hausmann <hausmann@kde.org> to enable automake1.5
compilation, except for the use of $(EXEEXT) which generates annoying warnings.
Julian Seward [Mon, 25 Mar 2002 00:07:36 +0000 (00:07 +0000)]
Add experimental omission of V-bits for address values, using
--check-addrVs=no. The default behaviour, =yes, is the original
behaviour. So far this is undocumented.
Julian Seward [Sun, 24 Mar 2002 13:52:19 +0000 (13:52 +0000)]
Detect FPU instructions which set %EFLAGS and mark the resulting
UInstrs accordingly. Fixes a bug in the simulated CPU in which the
results of f{u}comi{p} FPU insns were ignored, potentially leading to
wrong program behaviour. This will only have happened to people using
P6/P7/K7 class CPUs.
Julian Seward [Sun, 24 Mar 2002 11:29:13 +0000 (11:29 +0000)]
Change message "Use of uninitialized CPU condition code" to
"Conditional jump or move depends on uninitialised value(s)", since
that will be more meaningful to most programmers. Also change the
suppression-kind to Cond in .supp files. The old Value0 descriptor
means the same and is still accepted. Suggested by Joe Buck
<Joe.Buck@synopsys.com>.