Commit Graph

97 Commits

Author SHA1 Message Date
Julian Seward
d8b60ad050 Minor tweaks to the nonblocking select() implementation.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@108
2002-04-21 01:08:26 +00:00
Julian Seward
51ab497158 Add pthread_mutex_trylock, and add various other hacks to try and make
Mozilla work.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@107
2002-04-21 00:13:57 +00:00
Julian Seward
7553e55ee2 Add comments explaining checks made by scheduler_sanity().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@106
2002-04-20 20:53:17 +00:00
Julian Seward
2d49f33a44 Sigh. Remove -Werror because it causes the ./configure test for working
const qualifier to fail.  This causes config.h to #define const to nothing,
which causes the whole compilation to fail.

What's the right way to fix this?  I really like having -Werror.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@105
2002-04-20 15:49:34 +00:00
Julian Seward
03b823c2a6 Add pthread_condattr_destroy.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@104
2002-04-20 13:59:33 +00:00
Julian Seward
12d0bf0e67 Snapshot date -> 20020420.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@103
2002-04-20 13:56:38 +00:00
Julian Seward
e39f3f644a Add fairly complete, and apparently working, support for condition
variables.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@102
2002-04-20 13:53:23 +00:00
Julian Seward
7b0247aace 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)().


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@101
2002-04-19 15:43:37 +00:00
Julian Seward
1f17043004 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.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@100
2002-04-19 14:40:57 +00:00
Julian Seward
3d7ec5ac90 Simply and rationalise pthread_mutex implementation, in preparation
for implementation of condition variables.

* Use the native pthread_mutex_t directly; we no longer have our own
  VgMutex type nor a fixed array of them.

* Give ThreadState a new field q_next :: ThreadId, used to make a
  linked list of threads waiting on a mutex, or condition variable.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@99
2002-04-18 22:38:41 +00:00
Julian Seward
f6f515f0b8 Yay! Opera (6.0TP2) now works.
Various enhancements:

* Make the error message system more thread-aware.

* Fix stupid bug in do_pthread_create causing incorrect initial
  %ESP values sometimes.

* Fix various other minor things needed to make opera work.

Performance of threaded apps is pretty terrible.  This needs
looking into.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@98
2002-04-18 11:37:52 +00:00
Julian Seward
d972c3452c Compile flags += -Werror. I'm tired of looking carefully for warnings.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@97
2002-04-18 10:03:02 +00:00
Julian Seward
b16935d300 Oops! The floating-point conditional-move instructions read %EIP, so
we'd better annotate them as such!

Fixes a floating-point misbehaviour bug reported by Robert W. Anderson
<anderson110@poptop.llnl.gov>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@95
2002-04-18 02:18:24 +00:00
Julian Seward
1c469385c2 Sanity check mutex implementation, and add support for recursive mutexes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@94
2002-04-17 23:21:37 +00:00
Julian Seward
384f6e85fc Get rid of bogus vg_assert(VG_(bbs_done) < 1000000);
intended to test previous commit.  Duh.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@93
2002-04-17 19:40:49 +00:00
Julian Seward
fda47ff910 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.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@92
2002-04-17 19:35:12 +00:00
Julian Seward
fe8ade38b8 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.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@91
2002-04-16 22:50:32 +00:00
Dirk Mueller
9db9d919be ignore
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@90
2002-04-16 10:53:53 +00:00
Julian Seward
8f0229881b 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.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@89
2002-04-16 04:40:49 +00:00
Julian Seward
0f5c165ccc 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.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@88
2002-04-16 03:44:31 +00:00
Julian Seward
93b2c2ed95 Get rid of the muraroa.demon.co.uk references since that account is
soon to disappear.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@83
2002-04-16 02:51:05 +00:00
Julian Seward
e294b0448e Update the message on clone() failure to reflect new pthreads work.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@82
2002-04-16 02:09:31 +00:00
Julian Seward
1e4cf8357b Make --demangle=no work as advertised.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@81
2002-04-16 02:05:49 +00:00
Julian Seward
095fc58c48 Don't refer to IPC_64 if it doesn't exist. Was breaking builds on older
systems.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@80
2002-04-16 01:58:19 +00:00
Julian Seward
43ca0bb6f4 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=.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@79
2002-04-16 01:55:18 +00:00
Julian Seward
94c1bf2cf4 Don't skip the top frame when picking up ExeContexts for malloc etc.
This restores the pre-pthread-merge behaviour.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@78
2002-04-16 01:10:18 +00:00
Julian Seward
495ba4092e Fix -Wall complaints.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@77
2002-04-16 00:57:02 +00:00
Julian Seward
05207b3508 Relent, and properly implement bt/bts/btc/btr for literal bit-offsets.
bt_literal.c is a somewhat halfhearted test case for it.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@76
2002-04-16 00:42:12 +00:00
Julian Seward
0f38b1975c Get rid of the old bt/bts/btr/btc implementation.
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.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@75
2002-04-15 18:36:39 +00:00
Julian Seward
5f6317476f 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.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@74
2002-04-15 16:01:47 +00:00
Julian Seward
cdde41f423 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.

Test case to follow.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@73
2002-04-15 14:35:28 +00:00
Julian Seward
da6c025074 malloc() and friends have moved to vg_clientfuncs.c, so move the
-fno-omit-frame-pointer flag there too.  Otherwise they are invisible
in backtraces.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@72
2002-04-15 14:27:48 +00:00
Dirk Mueller
5515a58af0 fix initial installation problem
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@71
2002-04-15 00:54:13 +00:00
Dirk Mueller
4b7f632edd some workarounds for newer automake
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@70
2002-04-15 00:31:58 +00:00
Frédéric Gobry
d44c060e37 use install-exec-hook to create the .so.0 symlink.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@69
2002-04-14 15:31:19 +00:00
Julian Seward
c5d0d4a965 Fix problems to do with make dist/make distcheck not finding the source
file vg_libpthread.so.0.c.  Now:

* libpthread.so is built as just-another-so, like valgrind.so and
  valgrinq.so.

* there is a new dummy target libpthread.so.0 which is build just
  by a symlink.

Unfortunately for some reason, when the .so.0 is installed, it gets
a complete copy rather than just the symlink being copied.  But it
works, at least.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@68
2002-04-14 14:32:54 +00:00
Julian Seward
738517097f Turn off debug printing by default.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@67
2002-04-14 13:27:00 +00:00
Julian Seward
5d8300dd17 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.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@66
2002-04-14 13:13:05 +00:00
Julian Seward
6885b33e91 * external namespace check
* VG_(printf) format strings check


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@65
2002-04-14 13:01:38 +00:00
Julian Seward
8138f264e0 Plumb the right %EIP and %EBP values through to VG_(get_ExeContext)
now that we have the additional complication of multiple threads.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@64
2002-04-14 04:16:48 +00:00
Julian Seward
00dbbed2a1 Minor cleanups:
* when a thread exits, mark its stack as noaccess
* print VgTs_Sleeping status correctly


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@63
2002-04-14 02:46:33 +00:00
Julian Seward
d8e7eaed15 Take notice of SA_RESTART flags on signals, so as to deal (at least
partially properly) with blocking system calls interrupted by signals.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@62
2002-04-14 02:29:29 +00:00
Julian Seward
acf89323f4 Add wrapper for lseek().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@61
2002-04-13 04:18:32 +00:00
Julian Seward
fe80d43903 poll_for_read_fds(): don't waste time calling select() if there are
no waiting fds.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@60
2002-04-13 04:09:07 +00:00
Julian Seward
80dc6e4215 Ultra-hacking implementation of non-blocking select() using blocking
select and non-blocking nanosleep().  Barf.  Does seem to work tho.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@59
2002-04-13 03:45:44 +00:00
Julian Seward
ac45cc3e38 Write return address for threads in assembly so we can reliably
grab their return values.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@58
2002-04-13 00:08:51 +00:00
Julian Seward
4248ca0b0a 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.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@57
2002-04-12 23:24:59 +00:00
Julian Seward
c6419ac8b7 simple_mutex program from the OReilly pthreads book.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@56
2002-04-12 21:57:01 +00:00
Julian Seward
c59b539faf 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.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@55
2002-04-12 20:12:20 +00:00
Frédéric Gobry
9158ab04e5 added rules to generate libpthread.so
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@54
2002-04-12 13:32:11 +00:00