Commit Graph

1286 Commits

Author SHA1 Message Date
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
Nicholas Nethercote
6059e23b99 Remove duplicate declaration.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2770
2004-10-14 14:24:55 +00:00
Nicholas Nethercote
cea83425b5 Remove unnecessary #includes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2769
2004-10-14 13:41:28 +00:00
Nicholas Nethercote
8a80e385e2 Replace glibc header with equivalent kernel header, which fixes a compile
problem seen by Sefer Tov.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2767
2004-10-14 11:18:26 +00:00
Nicholas Nethercote
6ca6b576e1 Since we use "-Wl,-e,_ume_entry" when linking stage2, there is no need to
rename "_start" as "_ume_entry" in stage2.lds.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2766
2004-10-14 10:58:28 +00:00
Nicholas Nethercote
11c046a9b9 Arch-abstraction: replace direct mentions of x86/ directory with ${VG_ARCH}.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2763
2004-10-14 09:48:34 +00:00
Tom Hughes
5aa943f129 Implement pthread_mutexattr_gettype.
CCMAIL: 91199-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2759
2004-10-13 18:29:54 +00:00
Nicholas Nethercote
fbe7a298b8 Rename hoops() as main() -- much clearer.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2758
2004-10-13 17:58:36 +00:00
Nicholas Nethercote
7942c92bd6 Some combined cleaning up and arch-abstraction, involving UME and start-up:
- removed some assumptions that arch==x86 in Makefile.am files

- removed ume_arch.h;  moved its contents into ume.h.  There was no need for
  these to be separate.

- moved ume_go.c into an x86/ subdir;  gave it the more meaningful name
  jmp_with_stack.c in the process (the corresponding function also got the name
  change)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2757
2004-10-13 17:55:31 +00:00
Nicholas Nethercote
7440f4def2 Cleaned up ume.h by moving some functions around.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2756
2004-10-13 17:29:01 +00:00
Nicholas Nethercote
15b8a2af00 Stage2 doesn't need ume_go.c.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2754
2004-10-13 16:36:03 +00:00
Nicholas Nethercote
45449290f0 Arch-abstraction:
- whoops, missed one ucontext use in last commit


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2752
2004-10-13 14:50:35 +00:00
Nicholas Nethercote
d1ad5601fb Arch-abstraction:
- factor out differences in ucontext types across different archs.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2751
2004-10-13 14:42:57 +00:00
Nicholas Nethercote
fcae323a88 Arch-abstraction:
- move LDT stuff out of core, into x86-linux specific stuff.  Some of it
  (VG_(do_useseg)()?) may be really x86-specific, rather than
  x86/linux-specific, but that can be fixed later if it's really shared with
  another OS.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2748
2004-10-13 13:05:20 +00:00
Nicholas Nethercote
ce3c7200a7 Fix for bug 91162: cope with jumps to bogus addresses when there is a SEGV
signal handler present -- previously, Valgrind would abort unnecessarily on
this case.

Added a regression test for it.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2743
2004-10-13 09:47:24 +00:00
Nicholas Nethercote
b24f257005 Arch-abstraction:
- abstract out three ELF constants


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2741
2004-10-09 19:08:08 +00:00
Nicholas Nethercote
683657c785 typo
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2740
2004-10-09 18:50:16 +00:00
Nicholas Nethercote
e86e8e1216 Improve error message.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2736
2004-10-08 14:01:14 +00:00
Tom Hughes
088b2da749 Turn off stabs debugging.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2735
2004-10-07 08:33:29 +00:00
Tom Hughes
588711ca62 More fixes for stabs generated by the GNAT compiler. This patch
allows negative offsets in structure member definitions as well as
improving the previous fix for names that are declared as both struct
tags and typedefs.

CCMAIL: 90128-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2734
2004-10-07 08:33:08 +00:00
Tom Hughes
2e6ced42f2 Added a module level stabs_debug flag to turn on all debugging.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2733
2004-10-07 08:22:59 +00:00
Tom Hughes
a6dcbe14ec Assert on any attempt to make a symbol a typedef for itself.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2732
2004-10-07 08:21:38 +00:00
Tom Hughes
9c1dfedadc Fixed mistake in yesterday's signal trace patch.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2727
2004-09-27 18:57:08 +00:00