Commit Graph

1308 Commits

Author SHA1 Message Date
Nicholas Nethercote
70a543e5a1 Arch-abstraction:
- move some asm things into x86/
- also added a check at the start of init_tt_tc() to make sure that
  VG_CODE_OFFSET is correct.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2846
2004-10-26 11:18:32 +00:00
Nicholas Nethercote
171c23bcc2 64-bit cleanness tweaks.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2845
2004-10-26 10:57:24 +00:00
Nicholas Nethercote
7f75d054d1 Comment fix only
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2844
2004-10-26 10:19:30 +00:00
Nicholas Nethercote
4dd0792907 Arch-abstraction:
- removed some x86-specific var/function names


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2843
2004-10-26 09:59:49 +00:00
Nicholas Nethercote
e3c2b6d145 Arch-abstraction:
- use less x86-specific var names


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2842
2004-10-25 20:44:09 +00:00
Nicholas Nethercote
6bd10a4f02 comment wibbles
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2841
2004-10-25 20:43:14 +00:00
Nicholas Nethercote
6977665bc5 comment wibbles
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2840
2004-10-25 20:21:47 +00:00
Nicholas Nethercote
90c4861e79 Revert last commit because stupid older versions (eg. 1.6.3) of automake can't
handle it.  Pah.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2836
2004-10-25 19:13:41 +00:00
Nicholas Nethercote
8afd755e7d Fix up stage2's dependencies.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2835
2004-10-25 17:59:43 +00:00
Nicholas Nethercote
1c0d2c1dba whoops
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2834
2004-10-25 17:28:26 +00:00
Nicholas Nethercote
ea8dfa8f34 If PIE (position-independent executables) are supported, build valgrind's
stage2 as one.  This means that we're not hard-wiring stage2 in at 0xb0000000,
which means our memory layout is a bit more flexible, yay.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2833
2004-10-25 17:18:24 +00:00
Tom Hughes
9c4b27a325 Actually call VGA_(has_tls) rather than just testing the function
address - this replaces Nick's replacing of the has_tls call with
an inline version.

BUG: 91844


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2832
2004-10-25 16:59:46 +00:00
Nicholas Nethercote
55a94d4aee Rename two params named 'syscall' as 'syscallname' to avoid clashes with a new
name in recent headers.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2831
2004-10-25 15:43:21 +00:00
Nicholas Nethercote
a758e7e77b Don't bother with -fomit-frame-pointer for the demangler.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2830
2004-10-25 15:32:09 +00:00
Nicholas Nethercote
8d5541b229 Arch-abstraction:
- factor out different CFLAGS in Makefiles


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2829
2004-10-25 15:21:00 +00:00
Nicholas Nethercote
d611af0e22 Arch-abstraction:
- factor out KICKSTART_BASE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2828
2004-10-25 14:05:56 +00:00
Nicholas Nethercote
e0794e279c Fix for 91844...
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2827
2004-10-25 11:25:22 +00:00
Nicholas Nethercote
d343add11a Build vg_replace_malloc.c into a library, because it makes the Makefiles a bit
neater.  Also remove some dodgy CFLAGS+= lines.

I had to change the expected output of pth_once.c, because the change has
altered the order of the (non-deterministic) output.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2825
2004-10-20 18:40:40 +00:00
Nicholas Nethercote
50980af357 Fix typo, courtesy of Aleksander Salwa.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2823
2004-10-20 14:22:58 +00:00
Tom Hughes
a3c298ae30 When nuking threads we set their status to VgTs_Empty. This patch
ensures that any associated mutex and conditional variable pointers
are also cleared so that the thread state appears sane.

BUG: 91599


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2818
2004-10-20 12:25:59 +00:00
Nicholas Nethercote
e281e6cb91 Arch-abstraction:
- Abstractify one remaining mention of the stack pointer.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2816
2004-10-20 11:05:34 +00:00
Nicholas Nethercote
d1f87f21f0 Arch-abstraction:
- Make Helgrind totally arch-agnostic.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2815
2004-10-20 10:58:09 +00:00
Nicholas Nethercote
e9bf009719 readability fiddle
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2808
2004-10-19 17:54:02 +00:00
Nicholas Nethercote
3e21a5a1fd Whoops, syscall.S is platform-specific, and so must go in x86-linux/ rather
than x86/.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2800
2004-10-19 14:23:46 +00:00
Nicholas Nethercote
4b44d1df7d Arch-abstraction:
- Moved all assembly files in coregrind/ into coregrind/x86/.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2799
2004-10-19 13:48:06 +00:00
Nicholas Nethercote
266836ab69 Arch-abstraction:
- Factored out the remaining arch-specific code from vg_libpthread.c.
- Also fixed up the build process for x86/libpthread.c, which was done
  wrongly in the previous commit.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2798
2004-10-19 13:18:00 +00:00
Nicholas Nethercote
7ac2403543 Arch-abstraction:
- Started out x86-specific libpthread code; began with spinlocks.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2797
2004-10-19 11:38:48 +00:00
Tom Hughes
e581bc5f41 Really fix statically initialised read-write locks this time...
BUG: 91604


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2796
2004-10-18 23:03:24 +00:00
Tom Hughes
d7c9575904 Use tgkill instead of tkill if it is available. This is the newer and
safer kernel interface to signalling a particular thread and it ensures
you can only send a signal to one of your own threads.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2795
2004-10-18 18:56:25 +00:00
Nicholas Nethercote
f19fdbd136 Tweak type of VGA_(thread_syscall), and related variable name changes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2793
2004-10-18 17:41:36 +00:00
Nicholas Nethercote
7d17111d99 Arch-abstraction:
- factor out the horrid thread_syscall() function, which is written in assembly
  code.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2792
2004-10-18 17:36:40 +00:00
Tom Hughes
52eb188b93 Back-out accidental commit.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2791
2004-10-18 17:35:35 +00:00
Tom Hughes
25725b8d8b Make statically initialised read-write locks work.
BUG: 91604


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2790
2004-10-18 17:34:43 +00:00
Nicholas Nethercote
296804a70e Arch-abstraction:
- factor out the setting of syscall results, which can be more complicated
  than just putting a value in the result register (eg. PPC has to fiddle with
  multiple registers).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2789
2004-10-18 17:00:30 +00:00
Nicholas Nethercote
e0e17fab32 Increase the size of M_VG_ERRTXT from 512B to 4KB, increasing the size of C++
names that can be demangled.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2787
2004-10-18 15:47:18 +00:00
Nicholas Nethercote
3cff5cf8d9 Arch-abstraction:
- factor out code for restarting syscalls


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2786
2004-10-18 15:34:14 +00:00
Nicholas Nethercote
f3ef39ea53 Arch-abstraction:
- account for x86's strange argument passing (via memory) for mmap()


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2785
2004-10-18 14:47:48 +00:00
Nicholas Nethercote
411cf69104 Arch-abstraction:
- just a couple more constants moved


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2784
2004-10-18 14:08:16 +00:00
Tom Hughes
f5216fc7c7 Add a couple of lines that were missed out in the long timeouts patch.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2783
2004-10-18 12:11:23 +00:00
Nicholas Nethercote
493933b1c6 Arch-abstraction: a nice change that removes the need for ume_entry.S. Instead
of using an assembly hack to find the stack pointer at startup, we find it from
argv.  It's much simpler, avoids linking games, is platform independent, and
works on PPC.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2782
2004-10-18 11:52:17 +00:00
Tom Hughes
2d7c989f9a Fix problems with very long timeouts given when waiting on a mutex or
condition variable. The pthread routines now use a timeout of 0xfffffffe
if the user asks for something longer than that otherwise we will wrap
around and actually get a much shorter timeout.

The scheduler has also been changed so that it it now limits itself to
a timeout of 0x7fffffff when working how how long to poll for. This won't
affect how long a thread actually sleeps for as we'll just wind up waiting
a bit more on the next pass round the loop.

This fixes bug 76845.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2781
2004-10-17 15:18:22 +00:00
Tom Hughes
b7229cb4fc Implement pthread_mutex_timedlock. This resolves bug 78422.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2780
2004-10-17 15:00:20 +00:00
Tom Hughes
23cff452d7 When returning from handling a signal check whether any mutex that the
thread was waiting on has been unlocked while the signal handler was
running and resume the thread if it was.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2779
2004-10-16 16:50:14 +00:00
Tom Hughes
e531fcba56 If a thread is waiting on a mutex or condition variable when a signal is
delivered that the thread state is temporarily changed from WaitMX or WaitCV
to Running while the signal handler is running. The original state is then
restored when the handler returns.

This patch forces the associated_mx and associated_cv values to be cleared
at the same time and the original values restored afterwards. Without this
the scheduler state will not be considered sane while the handler is running.

This is based on a patch from Kenneth Schalk and fixes a problem he had
with posting to a semaphore in a signal handler. It also allows a couple
of assertions in the scheduler sanity check to be uncommented.

BUG: 72082


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2778
2004-10-16 16:17:06 +00:00
Nicholas Nethercote
7f7638248f Remove unnecessary glibc #includes; use VKI_O_RDONLY instead of O_RDONLY as
appropriate with VG_(open).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2777
2004-10-16 15:31:49 +00:00
Tom Hughes
e7e79a576f Remove the limit on the number of pthread read/write locks. This works
in a similar way to the previous patch that removed the limit on the
number of semaphores and fixes bug 86264.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2776
2004-10-16 14:49:53 +00:00
Tom Hughes
6204049d43 Add a dummy implementation of pthread_attr_getinheritsched.
BUG: 79495


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2775
2004-10-16 14:24:43 +00:00
Tom Hughes
76126d1e2b When signal routing is in use (because we are running on an older kernel
that doesn't route signals to the correct threads properly) the siginfo
data was not being propagated to any signal handlers installed by the
client program.

This is because the main thread routes the signal to the proxy LWP by
using the tkill system call but that then appears in the proxy as a user
initiated signal and the original siginfo data is lost.

This patch adds a small queue of siginfo data for pending sigals to
each thread's state so that when the proxy LWP passes the signal back
to the main thread the relevant siginfo data can be recovered and passed
on to any signal handlers. Thix fixes bug 91325.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2773
2004-10-16 10:59:49 +00:00
Tom Hughes
f2f2fe6cb7 Yet another attempt to quash the assertions in the pthread forwarding code.
It appears that the resolution of the address is to forward to is now
working properly but that on some systems the second part of the assertion
fails because the dynamic linker resolves the name of the function being
forwarded to the glibc version rather than the version in valgrind's pthread
library.

The solution is to use dlopen to explicitly obtain a handle to valgrind's
pthread library and then lookup the symbol with dlsym when doing the
comparison in the assertion.

BUG: 88614


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2772
2004-10-16 10:50:11 +00:00
Tom Hughes
38615b9b78 It seems there are some kernels around where the getpid system call has
been changed to return the ID of the thread group leader but which do not
have a gettid system call.

This breaks VG_(gettid) which assumes that the getpid system call will
give the thread ID if the gettid system call does not exist.

The (horrible) solution is to use readlink to see where /proc/self points
when the gettid system call fails.

BUG: 82114


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2771
2004-10-16 10:46:01 +00:00