Commit Graph

141 Commits

Author SHA1 Message Date
Jeremy Fitzhardinge
918c3a7b7e This jumbo-checkin is the Full Virtualization checkin. This eliminates
Valgrind's dependency on the dynamic linker for getting started, and
instead takes things into its own hands.

This checkin doesn't add much in the way of new functionality, but it
is the basis for all future work on Valgrind.  It allows us much more
flexibility in implementation, and well as increasing the reliability
of Valgrind by protecting it more from its clients.

This patch requires some changes to tools to update them to the changes
in the tool API, but they are straightforward.  See the posting "Heads
up: Full Virtualization" on valgrind-developers for a more complete
description of this change and its effects on you.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2118
2003-12-16 02:05:15 +00:00
Nicholas Nethercote
d6d804d382 Updated all "report bugs to..." messages to point to valgrind.kde.org; also
updated the docs to refer to valgrind.kde.org instead of the old website.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2055
2003-11-20 16:20:55 +00:00
Nicholas Nethercote
b6e961b0bf Improved vg_libpthread's IGNORED/KLUDGED error messages; lots of people found
"kludged" confusing.  Even printing out brief explanations of why functions are
ignored/kludged, in some cases.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2054
2003-11-20 14:23:09 +00:00
Nicholas Nethercote
c4d186f121 Removed no-longer-needed declarations of __SOME_SKIN_H.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2025
2003-11-13 23:02:16 +00:00
Dirk Mueller
25a97a8692 fix build with kernel 2.6.x
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1941
2003-10-16 16:14:13 +00:00
Jeremy Fitzhardinge
1e6361234c A complete reworking of Valgrind's handling of system calls and signals,
with the aim of making it more robust, more correct and perhaps faster.

This patch removes the need to poll blocking syscalls, by adding a proxy
LWP for each application thread.  This LWP is a kernel thread whose job
is to run all (potentially) blocking syscalls, and also to handle signals.

This allows the kernel to do more of the work of dealing with signals,
so on kernels which do this properly (2.6), Valgrind's behavious is a
lot more posix compliant.  On base 2.4 kernels, we emulate some of the
missing 2.6 functionality.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1918
2003-10-13 22:26:55 +00:00
Nicholas Nethercote
f5ba3bad17 Added a couple of small #ifdefs so that Valgrind works with Erik Anderson's
uClibc (micro libc, a small alternative to glibc).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1908
2003-10-12 17:26:04 +00:00
Julian Seward
b820f69079 Delete some "inline" directives on functions that gcc-3.3.1 declined
to inline.  This is needed to get a warning-free compilation on 3.3.1.
It seems we had "inline" on some pretty huge functions in places.
Also it appears gcc-3.3.1 won't inline a function call in a tail call
position, reasonably enough.  I assume in that case it prefers to
create a tailcall to the callee, rather than inlining it.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1907
2003-10-12 10:27:06 +00:00
Julian Seward
b3e4bdb2a5 Implement pthread_spinlock_* (Tim Potter, tpot@samba.org)
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1902
2003-10-12 08:33:30 +00:00
Nicholas Nethercote
c8c6b4132e Fix minor cut+paste error.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1856
2003-09-29 12:58:37 +00:00
Dirk Mueller
612b8daeac fix compiler warnings
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1823
2003-09-18 01:39:50 +00:00
Julian Seward
9ee2fd8e43 A new implementation of pthread_once() which I believe should comply
properly with POSIX, and not get assertion failures when the same
thread makes nested calls to pthread_once with different once_control
pointers.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1746
2003-07-11 00:12:58 +00:00
Julian Seward
090be413d9 Fix up weak binding for pthread_mutexattr_setpshared.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1726
2003-07-06 01:29:49 +00:00
Julian Seward
cceee45f87 Implement pthread_mutexattr_setpshared (Nick did this).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1724
2003-07-06 01:23:11 +00:00
Dirk Mueller
2416fb6967 don't bail out when pthread_once's init route calls itself recursively
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1684
2003-06-13 12:24:41 +00:00
Julian Seward
ecee893b06 Improve threaded handling of errno:
- Change various incorrect direct references to errno into
  *(__errno_location()).

- In __errno_location and __h_errno_location, treat the tid==1 case
  (root thread) specially, as with __res_state().

This seems to fix a bug in threaded handling of errno on R H 9 and SuSE8.2,
and almost makes OpenOffice work again on R H 9.

MERGE TO STABLE, if it doesn't break anything.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1625
2003-05-09 23:40:34 +00:00
Julian Seward
e455ba148d Fix interception of pthread_atfork with glibc-2.3.2.
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1587
2003-05-04 12:35:54 +00:00
Nicholas Nethercote
90ef0ac1d6 Moved the CLIENT_tstCALL[0123] requests out of valgrind.h into vg_skin.h,
because there was no point exposing them to clients, as they don't know the
ThreadState type.

Also, removed the LOGMESSAGE request type, replaced it with calls to
VG_(message) via the generic VALGRIND_NON_SIMD_CALL2.

In fact, almost every single pthread client request could be removed in this
same way.  That would result in less code, which would be nice... yeah, real
nice.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1584
2003-05-02 17:53:54 +00:00
Julian Seward
76ffe12471 Add possibly-bogus implementations for __libc_current_sigrtmin,
__libc_current_sigrtmax and __libc_allocate_rtsig.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1561
2003-04-26 21:19:53 +00:00
Julian Seward
4efd705c4b Fix threading problems on glibc-2.3.2 or later. Note this is *not*
NPTL support.

The behaviour of weak vs strong symbols seems to have changed in
glibc-2.3.2.  This caused problems in coregrind/vg_intercept.c,
wherein strong symbols in vg_libpthread.c were intended to
override weak symbols in vg_intercept.c, in order to give alternative
thread-safe implementations of some functions, poll(), select(), etc.

The change involves moving the nonblocking implementations of poll, etc
into vg_intercept.c, renaming them to (eg)  VGR_(poll), and routing
all calls to poll to VGR_(poll) [dually for other such fns].  This
means even single-threaded programs now use these functions, but
that doesn't strike me as harmful.

MERGE TO STABLE, if it doesn't break anything


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1559
2003-04-26 20:11:15 +00:00
Nicholas Nethercote
ac7027c441 Updated copyright notices for 2003. Only 4 months late.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1526
2003-04-15 14:58:06 +00:00
Julian Seward
f340c1b180 Duh. Make the system buildable again following recent commit
of include/valgrind.h rev 1.10.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1459
2003-03-15 20:03:33 +00:00
Julian Seward
096df69efa Fix comment bug.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1429
2003-02-23 03:40:03 +00:00
Julian Seward
4a70193610 Make poll() return (errno==EINTR) if the poll is interrupted by a signal.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1428
2003-02-23 03:37:58 +00:00
Julian Seward
1ae9a3b631 Apply the following:
The veneers for msgrcv in vg_intercept.c and vg_libpthread.c are not
returning the number of bytes read correctly - they always return zero
for any non-error case, which causes programs using msgrcv to behave
somewhat non-optimally when running under valgrind ;-)

Attached is a patch against 1.9.3 which fixes this.

Tom

--
Tom Hughes (thh@cyberscience.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1424
2003-02-23 03:00:29 +00:00
Julian Seward
18722f68c7 Implement pthread_getconcurrency, in the same way as LinuxThreads does it.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1393
2002-12-26 12:16:11 +00:00
Julian Seward
1c1de878a1 Implement (nop, but that's OK according to POSIX) pthread_set_concurrency.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1355
2002-12-08 23:51:32 +00:00
Julian Seward
a3feec4235 Implement (as a nop) pthread_rwlockattr_destroy.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1354
2002-12-08 23:42:17 +00:00
Julian Seward
9545356102 Merge patch (bug fix) from Jeremy F:
59-fix-readv-writev

Fix error returns for readv and writev (and select).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1342
2002-12-01 10:25:53 +00:00
Julian Seward
ae37920280 Comment out unused function.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1338
2002-11-30 14:04:45 +00:00
Julian Seward
f7a957606f Merge patch from Jeremy F:
46-fix-writeable_or_erring-proto

Prototype fix for wait_for_fd_to_be_writable_or_erring(). (bugfix for
43-nonblock-readwritev)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1337
2002-11-30 14:02:53 +00:00
Julian Seward
2d855ea5e1 Merge patch from JeremyF:
43-nonblock-readwritev

Nonblocking readv/writev.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1319
2002-11-16 11:04:18 +00:00
Julian Seward
088086b221 Merge patch from JeremyF:
23-intercept-select-poll

Do the intercept thing for select and poll.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1298
2002-11-13 22:00:20 +00:00
Julian Seward
0cefc40a95 Merge patch from JeremyF:
22-mutex-destroy-unlock:

It seems that glibc assumes in its internal use of pthreads that
destroying a lock implicity unlocks it. This patch handles this case
so that lock ownership tracking is accurate.

Also handles the case of the dyanmic linker wanting to do locking
before Valgrind has started up. vg_libpthread now implements toy
lock/unlock functions to keep it happy and leave the locks in a
sensible state. Implements some untested code to handle the case where
a lock is taken before Valgrind is running but released afterwards.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1297
2002-11-13 21:57:52 +00:00
Julian Seward
eb3e1ed766 Merge patch from JeremyF:
03a-open-nonblock
  Implement open of FIFOs for threaded programs, so that everything
  doesn't block when we try to open a FIFO file in a non-blocking way.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1296
2002-11-13 21:51:10 +00:00
Julian Seward
93de9055b6 Add a new client request, VG_USERREQ__LOGMESSAGE, and use this to route
all commentary from our libpthread.so through to the valgrind core and
hence to the selected logging sink.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1274
2002-11-03 13:41:41 +00:00
Julian Seward
6452d39430 Merge patch from Jeremy Fitzhardinge:
18-recv-nonblock
  Make recv() nonblocking.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1266
2002-10-23 21:55:01 +00:00
Julian Seward
af9e404d3e Merge patch from Jeremy Fitzhardinge:
16-function-intercept
  Implement a more reliable for vg_libpthread to intercept libc
  calls. Since the only reliable way of making sure that our code
  defines the symbol is by making sure that valgrind.so itself does it,
  this patch adds a new file, vg_intercept.so, which defines those
  symbols. They are then passed off to a weak local function if
  libpthread isn't present, or to the libpthread version if it is.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1265
2002-10-23 21:53:49 +00:00
Julian Seward
7845210b4f Merge patch from Jeremy Fitzhardinge:
02-sysv-msg
  Support for threaded programs using msgsnd/msgrcv.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1264
2002-10-23 21:49:33 +00:00
Julian Seward
8f7a43395a merge rev 1.90.2.12:
Put __pthread_getspecific_addr inside ifdefs.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1242
2002-10-20 16:25:55 +00:00
Julian Seward
488524613b merge rev 1.90.2.11:
Create __ versions of the select and poll symbols, so that all
references are caught (Jeremy Fitzhardinge)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1241
2002-10-20 16:24:04 +00:00
Julian Seward
4a133a6408 merge revs
vg_libpthread.c       1.90.2.10
   vg_libpthread_unimp.c 1.30.2.5

Implement (sort-of) pthread_attr_{set,get}guardsize.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1240
2002-10-20 16:22:57 +00:00
Julian Seward
695aaac7c1 merge revs
vg_libpthread.c 1.90.2.9
   vg_libpthread_unimp.c 1.30.2.4

Add sem_timedwait().  From Scott Smith <sls@cs.unt.edu>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1238
2002-10-16 19:45:06 +00:00
Julian Seward
99c3bf9dbb Finish off support for Red Hat 8 thread-specific-data. Unfortunately
the appearance of libc_internal_tsd_address requires a redesign, since
the existing scheme doesn't make it sensible to take the address of a
specific-data value.

New scheme is that the ThreadState structure carries not the table of
specifics, but merely a pointer to such.  This is allocated from the
client-side library, thus residing in client-visible memory and so
addresses can validlyh be taken.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1208
2002-10-12 16:42:35 +00:00
Julian Seward
a3d1803851 Initial stuff to make it work on Red Hat 8:
- autoconf stuff for detecting glibc-2.3

- vg_libpthread_unimp.c: hack for __pthread_clock_[gs]ettime

- vg_libpthread.c: initialise thread's default locale by calling
  __uselocale(LC_GLOBAL_LOCALE) at the right time.  Gruesome.
  Also need to do this for new other threads - not yet done.

- cleanups -- don't use write() to write messages when bombing out,
  instead go direct to the syscalls.  Avoids nasty circularities
  with glibc initialisations.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1207
2002-10-07 23:56:55 +00:00
Nicholas Nethercote
089e7e3bcb Updated file descriptions in the copyright notices to reflect the core/skin
split.  Each skin now has its own two-line description.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1166
2002-10-02 13:26:35 +00:00
Julian Seward
dcb3d7e32c update the libc_tsd stuff for R H limbo (glibc HEAD actually) and
clean it up a bit


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1160
2002-10-02 09:41:49 +00:00
Julian Seward
6f356bc8db This glibc (2.2.90 ?) seems to need another thread-specific key.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1151
2002-10-01 02:09:39 +00:00
Julian Seward
469c9e167b Placate gcc-3.2, which rather alarmingly complains that ...
vg_libpthread.c:1550: warning: weak declaration of `write' after
   first use results in unspecified behavior


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1149
2002-10-01 00:25:04 +00:00
Nicholas Nethercote
afebe61b37 Files updated, added and removed in order to turn the ERASER branch into HEAD
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1086
2002-09-23 09:36:25 +00:00