Commit Graph

960 Commits

Author SHA1 Message Date
Tom Hughes
67bb2b010d Commit rewrite of semaphore handling to avoid having a fixed upper
limit. Patch courtesy of Aleksander Salwa <A.Salwa@osmosys.tv>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2336
2004-03-23 19:48:54 +00:00
Tom Hughes
9f1434ff0c Redirect _dl_sysinfo_int80, which is glibc's default system call
routine, to the routine in our trampoline page so that the
special sysinfo unwind hack in vg_execontext.c will kick in.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2334
2004-03-22 19:46:29 +00:00
Jeremy Fitzhardinge
d402c5408c When creating new threads, initially block all signals. It's up to the
client code (in vg_libpthread.c) to set the appropriate signal mask when
its ready.  This prevents a bug where a thread gets sent a signal before
even running any of its initialization code, which can cause problems
(particularly if the signal handler directly or indirectly uses TLS).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2332
2004-03-16 22:09:12 +00:00
Jeremy Fitzhardinge
77403e63a0 Init the per-thread sigaltstacks properly. New threads should always
appear without a sigaltstack.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2331
2004-03-16 22:07:12 +00:00
Jeremy Fitzhardinge
cae906da57 This change does two things: one is the implementation of
VG_(synth_fault_*), which synthesize faults as if an instruction had
caused a CPU fault.  This is used in two places: one in vg_translate.c,
when trying to fetch instructions from bad memory, and the other in
vg_ldt.c, when using a bad segment register.  This fixes a bug where an
assertion would fail rather than getting a useful message.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2324
2004-03-16 09:49:08 +00:00
Jeremy Fitzhardinge
a8ab0cd15a Make the sigaltstack per-thread state, so that two threads handling a
signal at once don't share the same stack.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2323
2004-03-16 08:27:29 +00:00
Jeremy Fitzhardinge
a5d22da25d Print a backtrace for core-dumping signals, even if we're not actually
dumping core.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2322
2004-03-16 08:20:14 +00:00
Jeremy Fitzhardinge
e1614b700b Ooops. Fix overly-hasty commit.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2321
2004-03-15 23:46:54 +00:00
Jeremy Fitzhardinge
a9e5c1f1dd Be a bit clearer about core-dumping messages (don't say we are if we're not)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2320
2004-03-15 23:44:11 +00:00
Tom Hughes
57b01439e0 Move the handling of PSHUFW from the SSE code to the MMX code so that
it will work on older Athlons which only have MMXEXT support.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2319
2004-03-15 16:43:58 +00:00
Jeremy Fitzhardinge
0ed11cde7b Don't bother setting the EI_OSABI entry in the core elf header, since
the kernel doesn't, nobody uses it, and RH7.2 systems don't define it.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2318
2004-03-15 16:13:06 +00:00
Julian Seward
2e2e7d2e86 Modify the memory manager so it "natively" supports 8-byte alignment,
basically by messing with the block layout.

* Move freelist next ptr from before payload to after it

* Ensure payload and red zones always have sizes which are
  multiples of 8-bytes.

Seems to work OK.  Values returned from the two basic allocator
functions VG_(arena_malloc) and VG_(arena_malloc_aligned) are
vg_asserted to have suitable alignment (== 8, >= 8 && == requested
alignment) respectively.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2316
2004-03-14 03:06:37 +00:00
Dirk Mueller
8b0514d271 whoops
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2315
2004-03-13 02:56:29 +00:00
Dirk Mueller
3d5c39f6cf fix up the other places as well
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2314
2004-03-13 02:49:49 +00:00
Jeremy Fitzhardinge
e874a403cf Close bug 71906. Set default malloc alignment to 8 rather than 4.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2313
2004-03-13 02:38:33 +00:00
Jeremy Fitzhardinge
19a82f5eae Fix bug 69872. This change adds a coredumper to vg_signal.c. This means
that when the client is killed by a coredumping signal, Valgrind will
generate the coredump itself, which is full of client state, rather than
Valgrind state; this core file will therefore be useful to the developer
in debugging their program.

The corefile generated is named vgcore.pidNNNNN (and maybe with .M on
the end in case of duplicates).  If you set a logfile with --logfile,
then this name will be used as the basename for the core file, so that
both the core and the logs will be next to each other.

Valgrind respects the RLIMIT_CORE limit when generating the file; if the
limit is set to 0, then it will not generate one.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2312
2004-03-13 02:06:58 +00:00
Jeremy Fitzhardinge
82aaa16ef9 Fix "make distcheck", and also make sure that the generated archive
contains everything needed to "make regtest".  Bump the version.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2308
2004-03-12 10:51:39 +00:00
Julian Seward
9171770931 Partially unbreak 'make distcheck'.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2307
2004-03-12 01:22:30 +00:00
Jeremy Fitzhardinge
409a3bb789 Oops, passing wrong thing to st_mkarray
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2306
2004-03-11 00:40:11 +00:00
Jeremy Fitzhardinge
e991e966f4 Fix for bug 73892; implement 'S' set/bitstring stabs type.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2300
2004-03-09 01:20:47 +00:00
Jeremy Fitzhardinge
1c6f9e6392 Raise RLIMIT_AS to max allowable, so that we can create the large mappings
we need to.  If the hard limit is set to low, then things will fail as
large mmaps fail.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2299
2004-03-09 00:57:45 +00:00
Jeremy Fitzhardinge
12111b64cf Cope with strange templated symbol names containing quoted ':'.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2298
2004-03-09 00:43:08 +00:00
Tom Hughes
ec672c606d Remove function which is no longer used following the changes to
the handling of libc thread specific data.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2297
2004-03-08 15:57:17 +00:00
Tom Hughes
2494bba71b Fix the handling of libc thread specific data so that it doesn't rely on
being able to use malloc as the libc malloc tries to use thread specific
data and we wind up in a recursive nightmare.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2293
2004-03-07 19:36:14 +00:00
Tom Hughes
56a515fc49 Treat INT with an operand other than 0x80 as an undefined instruction.
CCMAIL: 76839-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2291
2004-03-06 12:53:24 +00:00
Jeremy Fitzhardinge
55801690d8 We need to specify some version.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2290
2004-03-06 00:14:42 +00:00
Jeremy Fitzhardinge
a3b9fe272a Fix bug 76780 - implement stabs type '@' for pointer to member.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2289
2004-03-05 05:43:42 +00:00
Tom Hughes
67f9196d17 Add support for 16 bit pushes and pops of segment registers to
fix bug #76762.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2288
2004-03-04 23:36:58 +00:00
Jeremy Fitzhardinge
6baec43002 Don't intercept mmap yet, until everything else is in place to deal
with it.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2285
2004-03-02 21:40:07 +00:00
Jeremy Fitzhardinge
6fd5d698f2 Fix assertion failure when using VG_(system) near program termination.
The problem is that the use of VG_(system) causes a SIGCHLD to be sent
to the process, which ends up being delivered to one of the proxy LWPs
(which is a small problem in itself, but nothing too bad).

The proxy tells the scheduler LWP about this, and the scheduler LWP sends
a sigACK reply.

Then, while the proxy LWP is in the SigACK state, and the SigACK reply
is still queued in the message pipe, the scheduler LWP starts shutting
Valgrind down, and sends a SIGVGKILL to all proxy LWPs.  This causes
the proxy to drop from sigACK state to WaitReq state, and it reads
further commands - one of which is the SigACK message - this causes the
assertion failure.

The fix is to simply make the proxy LWP exit immediately when it gets
a SIGVGKILL, and not process any more requests.

This change also fixes a bug in VG_(system), in which the child process
returns back into Valgrind rather than exiting when exec fails.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2284
2004-03-02 21:38:51 +00:00
Dirk Mueller
11fbbb3c91 remove arch subdir for 2.1.1 release
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2282
2004-03-01 03:25:09 +00:00
Nicholas Nethercote
7f71b28677 Adjust vg_pthread_cond_t so it works with an older glibc.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2274
2004-02-28 23:32:11 +00:00
Nicholas Nethercote
9f16738ca3 Some newer systems have a new version of pthreadtypes.h that comes from glibc
2.3.3, which is binary-compatible, but not source compatible with the old one,
which came from LinuxThreads.  We were using the types defined in the old one,
which caused compilation errors on systems using the new one.

This commit introduces our own versions of these types.  Our versions are laid
out identically to the LinuxThreads ones, but the field names are different.
We convert all pthread types to our versions before using them, so we don't
rely on the pthreadtypes.h types any more.  Hopefully this will fix the
problem;  I have three reports that it does.  Let's see...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2272
2004-02-28 15:40:36 +00:00
Jeremy Fitzhardinge
e7b88d999d Fix shmdt by using the right argument for the shared segment address.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2269
2004-02-25 00:07:10 +00:00
Nicholas Nethercote
df8ba4773c Check new fds are not within Valgrind's reserved range. Still one case for
recvmsg() where I'm not sure if it should be checked, and if so, what error
should be returned if the check fails.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2268
2004-02-24 23:57:47 +00:00
Jeremy Fitzhardinge
aa80b6dcf0 This fixes bug 75614. It seems that a symbol can be named
"foo<bar::blat>"; normally stabs names are terminated by ':', but we
also need to keep track of <> pairs so we can ignore nested colons.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2267
2004-02-24 23:46:06 +00:00
Jeremy Fitzhardinge
d03690c430 Fix the use of brk. This change removes the requirement for the "real" brk
segment to be moved up to stage2's brk segment.  Instead, Valgrind's
use of brk is simulated with mmap.  In order to prevent any unwanted use
of the process brk segment, it also sets the RLIMIT_DATA to 0, which will
make brk always fail.  glibc's malloc will use mmap to allocate if brk
fails.  We try to intercept glibc's brk, but malloc seems to always use the
library-internal version.  (The client's use of brk has always been simulated,
and is unaffected by this change.)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2266
2004-02-24 23:42:55 +00:00
Nicholas Nethercote
ace3f28976 Added various functions that make instrumentation easier, particularly
doing C calls.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2262
2004-02-23 16:10:06 +00:00
Nicholas Nethercote
0ecccb51cb Three CDROM ioctls, from Rocky Bernstein.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2259
2004-02-22 18:08:04 +00:00
Nicholas Nethercote
fcad29e364 Patch from Tom Hughes:
Patch to ignore REP prefixes on single byte RET instructions.

(REP RET is apparently faster than RET on AMD K7/K8)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2257
2004-02-22 16:56:28 +00:00
Nicholas Nethercote
a1db7b4001 Add a pair of missing {pre,post}_mem_write events.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2254
2004-02-15 16:21:38 +00:00
Nicholas Nethercote
3b2f2b7d57 Fix so that new versions of system (using clone()) work.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2253
2004-02-15 16:15:05 +00:00
Nicholas Nethercote
500de31850 This patch fixes getrlimit(RLIMIT_FILENO) to return VG_(max_fd) as the soft
limit for file descriptors to try and prevent the target programming realising
that the reserved file descriptors exist. It also appears to fix
sysconf(_SC_OPEN_MAX) so that must be going through the same system call.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2250
2004-02-15 15:32:51 +00:00
Nicholas Nethercote
18b4c5e404 fix code typo
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2249
2004-02-15 15:10:25 +00:00
Nicholas Nethercote
563c4e566a Adding Massif, the heap profiler.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2245
2004-02-14 16:40:02 +00:00
Nicholas Nethercote
49c135649d Now doing pre_mem_read()s on the args to execve(), so eg. Memcheck can check
them.  Added a regtest for this.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2244
2004-02-12 14:34:14 +00:00
Nicholas Nethercote
4c8ecb23c3 Heroic patch from Tom Hughes:
This patch adds translation tests for most of the basic x86 instructions and
  fixes a few missing/broken instructions to work properly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2242
2004-02-11 23:33:29 +00:00
Nicholas Nethercote
b2e8445916 Added support for epoll.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2241
2004-02-10 23:44:15 +00:00
Jeremy Fitzhardinge
863515c9a4 Fix for bug 73326. It seems that gcc 3.2.2 is generating negatively-sized
scopes and out of order line number information in the stabs debug info.
I wonder if this is the stabs writer rotting now that dwarf is the
default...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2240
2004-02-05 22:58:37 +00:00
Nicholas Nethercote
41dd3b13ee Fix broken "make dist".
Doesn't fix "make distcheck", however, because this happens:

  /usr/bin/ld: cannot open linker script file ../../coregrind/x86/stage2.lds:
  No such file or directory

For some reason I can't work out, that file is built when you make in a CVS
tree, or manually from a "make dist" tarball, but not when you "make
distcheck".


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2239
2004-02-05 14:27:36 +00:00