]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
23 years agoAlso update this for new code manager.
Julian Seward [Sun, 15 Dec 2002 02:51:21 +0000 (02:51 +0000)] 
Also update this for new code manager.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1378

23 years agoFix regression failure caused by different messages from new code
Julian Seward [Sun, 15 Dec 2002 02:36:48 +0000 (02:36 +0000)] 
Fix regression failure caused by different messages from new code
management stuff.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1377

23 years agoAlso diff the U (undefined) symbols.
Julian Seward [Sun, 15 Dec 2002 02:05:02 +0000 (02:05 +0000)] 
Also diff the U (undefined) symbols.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1376

23 years agoMessage cosmetics.
Julian Seward [Sun, 15 Dec 2002 02:00:41 +0000 (02:00 +0000)] 
Message cosmetics.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1375

23 years agoChange default state of the private-stacks optimisation to off, to be
Julian Seward [Sun, 15 Dec 2002 01:56:17 +0000 (01:56 +0000)] 
Change default state of the private-stacks optimisation to off, to be
on the conservative side.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1374

23 years agoRemove comment line referring to old LRU stuff.
Julian Seward [Sun, 15 Dec 2002 01:47:05 +0000 (01:47 +0000)] 
Remove comment line referring to old LRU stuff.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1373

23 years agowhitespace change
Julian Seward [Sun, 15 Dec 2002 01:44:47 +0000 (01:44 +0000)] 
whitespace change

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1372

23 years agoGet rid of the --check-addrVs flag and everything to do with it.
Julian Seward [Sun, 15 Dec 2002 01:42:22 +0000 (01:42 +0000)] 
Get rid of the --check-addrVs flag and everything to do with it.
It no longer makes much sense now we have a seperate addrcheck skin.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1371

23 years agoMerge patch from JeremyF:
Julian Seward [Sat, 14 Dec 2002 23:59:09 +0000 (23:59 +0000)] 
Merge patch from JeremyF:

66-illegal-instr

When translation encounters an illegal instruction, emit a call to an
illegal instruction rather than giving up altogether. Some programs
check for CPU capabilities by actually trying them out, so we want to
match a dumb Pentium's behaviour a little better.

It still prints the message, so it won't hide actual illegal or
mis-parsed instructions.  I was hoping this might make the Nvidia
drivers realize they're running on a pre-MMX P5, but apparently they
just won't take that as an answer.  It does make the virtual CPU
behave a little more like a real CPU though.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1370

23 years agoMerge patch from JeremyF:
Julian Seward [Sat, 14 Dec 2002 23:49:42 +0000 (23:49 +0000)] 
Merge patch from JeremyF:

71-linux-2.5

There doesn't seem to be any problem supporting Linux 2.5 (and one
presumes 2.6 when it appears).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1369

23 years agoVG_(handle_esp_assignment): merge two conditional jumps into one on
Julian Seward [Sat, 14 Dec 2002 23:18:06 +0000 (23:18 +0000)] 
VG_(handle_esp_assignment): merge two conditional jumps into one on
common path.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1368

23 years agowhitespace and __inline__ trivial changes
Julian Seward [Sat, 14 Dec 2002 23:11:35 +0000 (23:11 +0000)] 
whitespace and __inline__ trivial changes

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1367

23 years agoMerge patch from JeremyF:
Julian Seward [Thu, 12 Dec 2002 23:54:47 +0000 (23:54 +0000)] 
Merge patch from JeremyF:

75-simple-jle

Another pattern to test for Jle/Jnle. The observation is that EFLAGS
looks like this:

----O--+SZ------

with Z in bit 6, S in 7 and O in 11. Therefore RORL $7, %eflags will
result in:

Z------+-------+-------+---O---S

Since parity is only computed on the lower 8 bits, testing on P will
determine whether O==S, and since Z is in the MSB, it can be tested
with S.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1366

23 years agoTighten up assertion in VG_(target_forward).
Julian Seward [Thu, 12 Dec 2002 23:50:22 +0000 (23:50 +0000)] 
Tighten up assertion in VG_(target_forward).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1365

23 years agoMerge patch from JeremyF:
Julian Seward [Thu, 12 Dec 2002 23:42:48 +0000 (23:42 +0000)] 
Merge patch from JeremyF:

72-jump

Add some codegen infrastructure to make it easier to generate local
jumps. If you want to generate a local backwards jump, use
VG_(init_target)(&tgt) to initialize the target descriptor, then
VG_(emit_target_back)(&tgt) just before emitting the target
instruction. Then, when emitting the delta for the jump, call
VG_(emit_delta)(&tgt).

Forward jumps are analogous, except that you call VG_(emit_delta)()
then VG_(emit_target_forward)().

The new emit function, VG_(emit_jcondshort_target)() takes a target
pointer rather than a delta.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1364

23 years agoMerge patch from JeremyF. This is a fixed version of the original
Julian Seward [Thu, 12 Dec 2002 23:13:21 +0000 (23:13 +0000)] 
Merge patch from JeremyF.  This is a fixed version of the original
69-simple-jlo, which takes account of the fact that the P flag is set
only from the lowest 8 bits of the result, a problem causing the
original version of this patch not to work right.

Also fixes a call to new_emit.

69-simple-jlo

For Jlo and Jnlo, which test S == O or S != O, when generating special
test sequences which don't require the simulated flags in the real
flags, generate a test and parity test to see if both bits are equal
(even parity) or not equal (odd parity).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1363

23 years agoMerge (from 1_0_BRANCH) rev 1.16.2.4 of the old vg_cachesim.c:
Julian Seward [Wed, 11 Dec 2002 00:45:42 +0000 (00:45 +0000)] 
Merge (from 1_0_BRANCH) rev 1.16.2.4 of the old vg_cachesim.c:

Make file_err() not abort the current process; recover and keep
going instead.  This fixes a problem running OpenOffice on cachegrind.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1362

23 years agoBack out rev 1.27 since this seems to be causing mozilla-1.2.1 to loop
Julian Seward [Tue, 10 Dec 2002 23:44:17 +0000 (23:44 +0000)] 
Back out rev 1.27 since this seems to be causing mozilla-1.2.1 to loop
on memcheck on R H 6.2.  Don't know why.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1361

23 years agoVG_(saneUInstr): relax CCf so as to allow insns which read ZCP -- the
Julian Seward [Tue, 10 Dec 2002 22:24:03 +0000 (22:24 +0000)] 
VG_(saneUInstr): relax CCf so as to allow insns which read ZCP -- the
floating point conditional moves.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1360

23 years agoMake it build on R H 6.2 (with egcs-2.91.66).
Julian Seward [Mon, 9 Dec 2002 23:32:58 +0000 (23:32 +0000)] 
Make it build on R H 6.2 (with egcs-2.91.66).

Jeremy, can you just cast your eye over this (sanity check) ?  Thx -- J

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1359

23 years agosynth_jcond_lit: Handle simd cases for CondO / CondNO.
Julian Seward [Mon, 9 Dec 2002 22:44:00 +0000 (22:44 +0000)] 
synth_jcond_lit: Handle simd cases for CondO / CondNO.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1358

23 years agoMerge patch from JeremyF:
Julian Seward [Mon, 9 Dec 2002 19:20:00 +0000 (19:20 +0000)] 
Merge patch from JeremyF:

69-simple-jlo

For Jlo and Jnlo, which test S == O or S != O, when generating special
test sequences which don't require the simulated flags in the real
flags, generate a test and parity test to see if both bits are equal
(even parity) or not equal (odd parity).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1357

23 years agoNULLify the destructor field when a thread key is deleted. This
Julian Seward [Mon, 9 Dec 2002 19:07:59 +0000 (19:07 +0000)] 
NULLify the destructor field when a thread key is deleted.  This
allegedly fixes the following (haven't tested it myself):

valgrind: vg_scheduler.c:3454 (scheduler_sanity): Assertion
`vg_thread_keys[i].destructor == ((void *)0)' failed.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1356

23 years agoImplement (nop, but that's OK according to POSIX) pthread_set_concurrency.
Julian Seward [Sun, 8 Dec 2002 23:51:32 +0000 (23:51 +0000)] 
Implement (nop, but that's OK according to POSIX) pthread_set_concurrency.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1355

23 years agoImplement (as a nop) pthread_rwlockattr_destroy.
Julian Seward [Sun, 8 Dec 2002 23:42:17 +0000 (23:42 +0000)] 
Implement (as a nop) pthread_rwlockattr_destroy.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1354

23 years agoClarify 65-fix-ldt (comment-only change).
Julian Seward [Sun, 8 Dec 2002 23:27:21 +0000 (23:27 +0000)] 
Clarify 65-fix-ldt (comment-only change).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1353

23 years agoFix for the following (line number for 1.0.X series):
Julian Seward [Sun, 8 Dec 2002 23:24:18 +0000 (23:24 +0000)] 
Fix for the following (line number for 1.0.X series):

valgrind: vg_scheduler.c:3446 (scheduler_sanity): Assertion
`vgPlain_kisemptysigset( & vgPlain_threads[i].sigs_waited_for)' failed.

Test case is:

#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>

sigset_t intr;

void *
waiter (void *arg)
{
  int signum;
  printf ("Waiter started\n");

  sigwait (&intr, &signum);

  printf ("Waiter got signal %d (nothing will happen though)\n", signum);
  return 0;
}

int main ()
{
  pthread_t waiter_id;
  void *status;

  sigemptyset (&intr);
  sigaddset (&intr, SIGINT);
  pthread_sigmask (SIG_BLOCK, &intr, 0);

  printf ("Starting the sigwait thread\n");

  pthread_create (&waiter_id, 0, waiter, 0);

  sleep (2);
  printf ("Canceling the sigwait thread\n");

  pthread_cancel (waiter_id);
  pthread_join (waiter_id, &status);

  printf ("All done\n");
  return 0;
}

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1352

23 years agoGet rid of the flag --fast-jcc; it's wired-on by default. Assumes that
Julian Seward [Sun, 8 Dec 2002 22:24:59 +0000 (22:24 +0000)] 
Get rid of the flag --fast-jcc; it's wired-on by default.  Assumes that
pushf/popf is catastrophically expensive on most target CPUs, which is
certainly true for P3 and Athlon and I assume (but not checked) P4.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1351

23 years agoMerge patch from JeremyF:
Julian Seward [Sun, 8 Dec 2002 22:19:04 +0000 (22:19 +0000)] 
Merge patch from JeremyF:

67-dist

Fixes to various places Makefile.am to generate proper distributions.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1350

23 years agoMerge patch from JeremyF:
Julian Seward [Sun, 8 Dec 2002 22:16:58 +0000 (22:16 +0000)] 
Merge patch from JeremyF:

55-ac-clientreq

ADDRCHECK: implement some client requests

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1349

23 years agoMerge patch from JeremyF:
Julian Seward [Sun, 8 Dec 2002 22:14:11 +0000 (22:14 +0000)] 
Merge patch from JeremyF:

65-fix-ldt

Fix LDT handling in threaded programs. do__apply_in_new_thread() was
failing to set up the child thread's LDT inherited from the parent,
and was triggering an assert in VG_(save_thread_state)() when trying
to copy the parent's thread state to the child.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1348

23 years agoRe-add the NP case in synth_jcond_lit.
Julian Seward [Sun, 8 Dec 2002 19:50:36 +0000 (19:50 +0000)] 
Re-add the NP case in synth_jcond_lit.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1347

23 years agoMerge patches from JeremyF, to do lazy eflags updating:
Julian Seward [Sun, 8 Dec 2002 18:20:01 +0000 (18:20 +0000)] 
Merge patches from JeremyF, to do lazy eflags updating:

- D flag is seperated from the rest (OSZCAP)

- Minimise transfers between real and simulated %eflags since these
  are very expensive.

61-special-d

Make the D flag special. Store it separately in the baseblock rather
than in EFLAGs. This is because it is used almost completely unlike
the other flags, and mashing them together just makes maintaining
eflags hard.

62-lazy-eflags

Implements lazy eflags save and restore. Helps a lot.

Hopefully more documentation to follow.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1346

23 years agoAdded the new 'detail' details_avg_translation_sizeB which was missing. It now
Nicholas Nethercote [Wed, 4 Dec 2002 15:31:36 +0000 (15:31 +0000)] 
Added the new 'detail' details_avg_translation_sizeB which was missing.  It now
works again.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1345

23 years agoVG_(switch_to_real_CPU): Apparently we can't reload the %cs register
Julian Seward [Tue, 3 Dec 2002 00:38:59 +0000 (00:38 +0000)] 
VG_(switch_to_real_CPU): Apparently we can't reload the %cs register
in untrusted mode.  Strange.  I thought I fixed this a couple of
months back.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1344

23 years agoChange the way INCEIP is done. Instead of emitting add insns, keep
Julian Seward [Sun, 1 Dec 2002 19:40:49 +0000 (19:40 +0000)] 
Change the way INCEIP is done.  Instead of emitting add insns, keep
track of the current %EIP value and write it to memory at an INCEIP.
Uses JeremyF's idea of only writing the lowest 8 bits if the upper 24
are unchanged since the previous write.  [might this cause probls
to do with write combining on high-performance CPUs?  To be checked
out.]

On a simple program running a small inner loop, this gets about 2/3
the benefits of removing INCEIPs altogether, compared with the add-insn
scheme.

I tried a much more complex scheme too, in which we do analysis to
remove as many INCEIPs as possible if it is possible to show that
there will be no EIP reads in between them.  This seemed to make
almost no improvement on real programs (kate, xedit) and adds some
code and slows down the code generator, so I don't think it's worth
the hassle.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1343

23 years agoMerge patch (bug fix) from Jeremy F:
Julian Seward [Sun, 1 Dec 2002 10:25:53 +0000 (10:25 +0000)] 
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

23 years agoTake into account TCEntry and alignment overheads when calculating TC
Julian Seward [Sun, 1 Dec 2002 02:55:46 +0000 (02:55 +0000)] 
Take into account TCEntry and alignment overheads when calculating TC
sector sizes.  Also, recalibrate all skins against mozilla-1.0.1.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1341

23 years agoMerge patch from JeremyF:
Julian Seward [Sun, 1 Dec 2002 02:07:08 +0000 (02:07 +0000)] 
Merge patch from JeremyF:

56-chained-accounting

Fix accounting for chained blocks, by only counting real unchain
events, rather than the unchains used to establish the initial call to
VG_(patch_me) at the jump site.

Also a minor cleanup of the jump delta calculation in synth_jcond_lit.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1340

23 years agoMerge patch from JeremyF:
Julian Seward [Sat, 30 Nov 2002 15:01:01 +0000 (15:01 +0000)] 
Merge patch from JeremyF:

50-fast-cond

Implement Julian's idea for fast conditional jumps. Rather than fully
restoring the eflags register with an expensive push-popf pair, just
test the flag bits directly out of the base block. Faster, and smaller
code too!

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1339

23 years agoComment out unused function.
Julian Seward [Sat, 30 Nov 2002 14:04:45 +0000 (14:04 +0000)] 
Comment out unused function.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1338

23 years agoMerge patch from Jeremy F:
Julian Seward [Sat, 30 Nov 2002 14:02:53 +0000 (14:02 +0000)] 
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

23 years agoMerge in a somewhat modified patch version of Jeremy Fitzhardinge's
Julian Seward [Sat, 30 Nov 2002 14:00:47 +0000 (14:00 +0000)] 
Merge in a somewhat modified patch version of Jeremy Fitzhardinge's
translation chaining patch.

47-chained-bb

This implements basic-block chaining. Rather than always going through
the dispatch loop, a BB may jump directly to a successor BB if it is
present in the translation cache.

When the BB's code is first generated, the jumps to the successor BBs
are filled with undefined instructions. When the BB is inserted into
the translation cache, the undefined instructions are replaced with a
call to VG_(patch_me). When VG_(patch_me) is called, it looks up the
desired target address in the fast translation cache. If present, it
backpatches the call to patch_me with a jump to the translated target
BB. If the fast lookup fails, it falls back into the normal dispatch
loop.

When the parts of the translation cache are discarded, all translations
are unchained, so as to ensure we don't have direct jumps to code which
has been thrown away.

This optimisation only has effect on direct jumps; indirect jumps
(including returns) still go through the dispatch loop.  The -v stats
indicate a worst-case rate of about 16% of jumps having to go via the
slow mechanism.  This will be a combination of function returns and
genuine indirect jumps.

Certain parts of the dispatch loop's actions have to be moved into
each basic block; namely: updating the virtual EIP and keeping track
of the basic block counter.

At present, basic block chaining seems to improve performance by up to
25% with --skin=none.  Gains for skins adding more instrumentation
will be correspondingly smaller.

There is a command line option: --chain-bb=yes|no (defaults to yes).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1336

23 years agoMerge patch from JeremyF (with a little added paranoia, for this one
Julian Seward [Sat, 30 Nov 2002 12:35:42 +0000 (12:35 +0000)] 
Merge patch from JeremyF (with a little added paranoia, for this one
could potentially cause hard-to-find code generation bugs):

00-lazy-fp

This patch implements lazy FPU state save and restore, which improves
the performance of FPU-intensive code by a factor of 15 or so.  [when
running without any instrumentatation, that is.]

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1335

23 years agoComplete integration of the new code management (sectored FIFO) story.
Julian Seward [Sat, 30 Nov 2002 00:49:43 +0000 (00:49 +0000)] 
Complete integration of the new code management (sectored FIFO) story.

This commit adds stats gathering / printing (use -v -v), and selection
of sector size decided by asking skins, via
VG_(details).avg_translation_sizeB, the average size of their
translations.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1334

23 years agoComplete overhaul of the storage of translations to properly support
Julian Seward [Fri, 29 Nov 2002 01:02:45 +0000 (01:02 +0000)] 
Complete overhaul of the storage of translations to properly support
translation chaining.  The old LRU system has gone, since it required
marking each translation each time it was used -- simulating a
reference bit.  This is unacceptably expensive.

New scheme uses FIFO discard.  TC is split into a variable number
(currently 8) parts.  When all 8 parts are full, the oldest is
discarded and reused for allocation.  This somewhat guards against
discarding recently-made translations and performs well in practice.

TT entries are simplified: the orig and trans size fields are now
stored in the TC, not in the TT.  The TC entries are "self
describing", so it is possible to scan forwards through the TC entries
and rebuild the TT from them.  TC entries are now word-aligned.

VG_(tt_fast) entries now point to TC entries, not TT entries.

The main dispatch loop now is 2 insns shorter since there's no need to
mark the current epoch on each TT entry as it is used.  For that
matter, there's no longer any need for the notion of a current epoch
anyway.

It's all a great deal simpler than the old scheme, and it seems
significantly faster too.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1333

23 years agoFixed up for core/skin interface change.
Nicholas Nethercote [Fri, 22 Nov 2002 16:10:55 +0000 (16:10 +0000)] 
Fixed up for core/skin interface change.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1332

23 years agoMoved setting of err->where outside the if/else; it was redundant because the
Nicholas Nethercote [Thu, 21 Nov 2002 13:38:08 +0000 (13:38 +0000)] 
Moved setting of err->where outside the if/else;  it was redundant because the
same test is done with VG_(get_ExeContext2)().

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1331

23 years agoA small tool to help documentation writers. Copies docs out of an
Julian Seward [Wed, 20 Nov 2002 08:17:16 +0000 (08:17 +0000)] 
A small tool to help documentation writers.  Copies docs out of an
installation tree (`pwd`/Inst) back to the build tree since it is a
lot easier to edit them in the installation tree.  Use with care!

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1330

23 years agoRemoved some impossible code (thanks to the way it's called), added an
Nicholas Nethercote [Tue, 19 Nov 2002 16:19:32 +0000 (16:19 +0000)] 
Removed some impossible code (thanks to the way it's called), added an
assertion to ensure it remains impossible.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1329

23 years agoFixed broken regression tests:
Nicholas Nethercote [Mon, 18 Nov 2002 11:46:48 +0000 (11:46 +0000)] 
Fixed broken regression tests:

  - For all except `trivialleak', expected output lines like this:

      by 0x........: __libc_start_main@@GLIBC_2.0 (...libc...)

    were changed to look like this:

      by 0x........: (within /.../tests/supp2)

    This change was caused by a change about 3 weeks ago, but we couldn't work
    out exactly which one.  It does not seem unreasonable, though.

  - For `malloc1' and `trivialleak', one of the line numbers changed -- they
    are now correct instead of off by one -- thanks to Jeremy F's recent patch
    which subtracts one from return addresses (for exactly this reason).

Now they all pass again except `tronical', as expected.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1328

23 years agoFixed regression tests "broken" by one of Jeremy F's patches -- a bogus PThread
Nicholas Nethercote [Mon, 18 Nov 2002 11:33:37 +0000 (11:33 +0000)] 
Fixed regression tests "broken" by one of Jeremy F's patches -- a bogus PThread
error no longer needs to be suppressed.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1327

23 years agoAdded copyright notice header and footer. No code changed.
Nicholas Nethercote [Mon, 18 Nov 2002 11:14:53 +0000 (11:14 +0000)] 
Added copyright notice header and footer.  No code changed.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1326

23 years agoOverview:
Nicholas Nethercote [Mon, 18 Nov 2002 11:04:50 +0000 (11:04 +0000)] 
Overview:
  - Factored out a lot of commonality between AddrCheck and MemCheck.  Basic
    idea is that common code goes into a single file in MemCheck, and AddrCheck
    peeks in and "borrows" it.

    More or less, only identical code or identical-with-respect-to-subtypes
    code was factored out.

    Identical-with-respect-to-subtypes means that some enum types (SuppKind,
    ErrorKind, etc) were merged because they were identical except that
    MemCheck had some extra constants.  So some of the code borrowed by
    AddrCheck contains cases it never needs.  But that's not so bad, avoiding
    the duplication is IMHO more important.

Removed:
  - ac_include.h, it wasn't necessary

  - All the old debugging stuff from ac_main.c (printing shadow regs, not
    applicable for AddrCheck).

  - MANUAL_DEPS from memcheck/Makefile.am because it wasn't doing anything

  - Some unnecessary crud from addrcheck/Makefile.am

Added:
  - memcheck/mc_common.{c,h}
  - memcheck/mc_constants.h
  - addrcheck/ac_common.c, which simply #includes memcheck/mc_common.c.  This
    hack was required because there is no way (that I could work out) to tell
    Automake that it should build ../memcheck/mc_common.o before building
    AddrCheck.

Changed:
  - a lot of prefixes from SK_ to MC_;  only core/skin interface functions are
    prefixed with SK_ now.  This makes it clear which functions are from the
    core/skin interface, and for AddrCheck it's clear which functions are
    shared with/borrowed from MemCheck.  Changed some related prefixes for
    consistency.

  - Also factored out some duplication within AddrCheck -- some accessibility
    checking was needlessly split up into separate read and write checks that
    did the same thing.

Unchanged:
  - I considered moving the leak detector out of core into mc_common.c, but
    didn't, because it constantly accesses ShadowChunk fields and converting to
    get/set methods would have been a total pain.

  - Left old debugging stuff in for MemCheck, although I seriously doubt it
    would still work.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1325

23 years agoRestructure the documentation to try and make it hang together better.
Julian Seward [Mon, 18 Nov 2002 00:07:28 +0000 (00:07 +0000)] 
Restructure the documentation to try and make it hang together better.
Majorly improved.  Still a lot to do, but the structure is better.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1324

23 years agoAdd (bogus) support for ioctls CDROM_DRIVE_STATUS and CDROM_CLEAR_OPTIONS.
Julian Seward [Sun, 17 Nov 2002 02:50:17 +0000 (02:50 +0000)] 
Add (bogus) support for ioctls CDROM_DRIVE_STATUS and CDROM_CLEAR_OPTIONS.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1323

23 years ago(whitespace change only) -- break some long lines
Julian Seward [Sun, 17 Nov 2002 02:46:19 +0000 (02:46 +0000)] 
(whitespace change only) -- break some long lines

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1322

23 years agoA bit more flushing of stdout, so that "valgrind-listener | tee logfile"
Julian Seward [Sat, 16 Nov 2002 20:15:16 +0000 (20:15 +0000)] 
A bit more flushing of stdout, so that "valgrind-listener | tee logfile"
isn't so mysterious.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1321

23 years agoMerge patch from JeremyF:
Julian Seward [Sat, 16 Nov 2002 11:06:50 +0000 (11:06 +0000)] 
Merge patch from JeremyF:

27-nvalgrind

Make valgrind.h pay attention to the preprocessor symbol NVALGRIND. If
defined, it compiles out the Valgrind magic sequence and just assigns
the result with the default return. This is analogous to NDEBUG's
effect on assert().

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1320

23 years agoMerge patch from JeremyF:
Julian Seward [Sat, 16 Nov 2002 11:04:18 +0000 (11:04 +0000)] 
Merge patch from JeremyF:

43-nonblock-readwritev

Nonblocking readv/writev.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1319

23 years agoMerge patch from JeremyF:
Julian Seward [Sat, 16 Nov 2002 11:01:39 +0000 (11:01 +0000)] 
Merge patch from JeremyF:

30-hg-fix

HELGRIND: little fixes in the wake of Nick's big rearrangement

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1318

23 years agoMerge patch from JeremyF:
Julian Seward [Thu, 14 Nov 2002 23:16:58 +0000 (23:16 +0000)] 
Merge patch from JeremyF:

41-linefix

When working out the source:line information for a stack backtrace,
subtract 1 from return addresses in the hope that this points to the
line of the caller rather than the line after the caller.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1317

23 years agoChanged some out-of-date instances of "vg_annotate" into "cg_annotate".
Nicholas Nethercote [Thu, 14 Nov 2002 16:18:55 +0000 (16:18 +0000)] 
Changed some out-of-date instances of "vg_annotate" into "cg_annotate".

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1316

23 years agoNow installing helgrind.h in $prefix/include/valgrind/helgrind.h like the
Nicholas Nethercote [Thu, 14 Nov 2002 13:54:04 +0000 (13:54 +0000)] 
Now installing helgrind.h in $prefix/include/valgrind/helgrind.h like the
other .h files.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1315

23 years agoLots of changes to future-proof the core/skin interface, making it less likely
Nicholas Nethercote [Thu, 14 Nov 2002 12:42:47 +0000 (12:42 +0000)] 
Lots of changes to future-proof the core/skin interface, making it less likely
that changes will cause binary incompatibilities.  Mostly done by hiding naked
structs with function calls.

Structs hidden in this way were: UCodeBlock, SkinSupp and SkinError (which were
merged back with CoreSupp and CoreError into single types Supp and Error),
ShadowChunk, VgDetails, VgNeeds and VgTrackEvents.  The last three are the most
important ones, as they are (I think) the most likely to change.

Suitable get()/set() methods were defined for each one.  The way UCodeBlocks
are copied for instrumentation by skins is a little different now, using
setup_UCodeBlock.  Had to add a few other functions here n there.  Changed
how SK_(complete_shadow_chunk) works a bit.

Added a file coregrind/vg_needs.c which contains all the get/set functions.
It's pretty simple.

The changes are not totally ideal -- eg. ShadowChunks has get()/set() methods
for its `next' field which arguably shouldn't be exposed (betraying the fact
that it's a linked list), and the get()/set() methods are a bit cumbersome at
times, esp. for `Error' because the fields are accessed quite a few times, and
the treatment of Supps and Errors is a bit inconsistent (but they are used in
different ways), and sizeof_shadow_blocks is still a hack.  But still better
than naked structs.  And one advantage is that a bit of sanity checking can be
performed by the get()/set() methods, as is done for VG_({get,set}_sc_extra)()
to make sure no reading/writing occurs outside the allowed area.

I didn't do it for UInstr, because its fields are accessed directly in lots and
lots of spots, which would have been a great big pain and I was a little
worried about overhead of calling lots of extra functions, although in practice
translation times are small enough that it probably doesn't matter.

Updated the example skin and the docs, too, hurrah.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1314

23 years agoLoad weak symbols too, at the recommendation of Josef Weidendorfer.
Julian Seward [Wed, 13 Nov 2002 22:49:54 +0000 (22:49 +0000)] 
Load weak symbols too, at the recommendation of Josef Weidendorfer.

MERGE TO STABLE

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1313

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:46:13 +0000 (22:46 +0000)] 
Merge patch from JeremyF:

42-hg-show-all-locks

HELGRIND: show all the locks when a cycle is detected, because doing
it selectively is wrong for now.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1312

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:43:26 +0000 (22:43 +0000)] 
Merge patch from JeremyF:

40-hg-tidstate

HELGRIND: record more information when a memory location changes
state. Now also records the thread ID and the previous state at that
point (so now a "possible race" error message tells you the moment we
entered an error state from an OK state, and where we entered that OK
state and from what).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1311

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:42:13 +0000 (22:42 +0000)] 
Merge patch from JeremyF:

39-lock-prefix

Add a new UInstr LOCK to represent a "lock" prefix in the instruction
stream. This has the same semantics as NOP, but allows a skin to tell
whether a group of UInstrs associated with an x86 instruction are
meant to be locked.

HELGRIND: uses the LOCK UInstr to automatically take and release a
special __BUS_HARDWARE_LOCK__ around locked instructions. This only
works properly if all instructions touching a given address are locked
(even reads).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1310

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:37:41 +0000 (22:37 +0000)] 
Merge patch from JeremyF:

38-hg-lazy-lasttouch

HELGRIND: rather than recording the last access, record the last state
change. This is more interesting and useful, and uses up a lot less
memory when using (now inaccurately named) --show-last-access=all.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1309

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:35:55 +0000 (22:35 +0000)] 
Merge patch from JeremyF:

37-hg-private-stack

HELGRIND: by default, assume that thread stacks are thread-local. This
means that they are always initalized to be exclusively owned by their
thread (rather than virgin), and no access checks are generated for
stack-relative memory references (ie, relative off ESP or EBP). This
saves about 70% (statically) of checks on memory accesses.

This is enabled by default, but can be disabled with
--private-stacks=no

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1308

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:31:26 +0000 (22:31 +0000)] 
Merge patch from JeremyF:

36-hg-optim

HELGRIND: various microoptimizations and small tidyups.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1307

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:29:34 +0000 (22:29 +0000)] 
Merge patch from JeremyF:

33-pre_mutex_lock

HELGRIND: two updates: add a pre_mutex_lock tracking function, so the
skin can do something before the thread blocks. This allows us to do
lock ordering tests before the thread blocks in the deadlock we'd like
to report...

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1306

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:25:51 +0000 (22:25 +0000)] 
Merge patch from JeremyF:

32-hg-lifetime-segments

HELGRIND: implement the algorithm described in "Runtime Checking of
Multithreaded Applications with Visual Threads". Rather than working
with thread IDs, this algorithm breaks the lifetime of a thread up
into thread lifetime segments, and arranges them in an interference
graph.

If a memory location is in exclusive state and it is touched by
another thread, it compares the TLSs of the old owner and the new
thread. If the two TLSs can't possibly overlap in time (for example,
one TLS is the parent before a child thread is created, and the other
TLS is the child thread) the memory location's ownership is
transferred rather than moving it into a shared state. This allows a
parent thread to set up some memory and then create a new child,
handing ownership of that memory to the child, without generating
spurious errors.

At present the only synchonization events used to create new TLSs are
thread create and thread join, though in principle any synchronization
event would work.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1305

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:22:25 +0000 (22:22 +0000)] 
Merge patch from JeremyF:

31-hg-shadow-execontext

HELGRIND: Add option to record ExeContext for every word access. This
is probably very slow and memory hungry, but it helps make the error
reports more useful. Defaults to off.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1304

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:18:09 +0000 (22:18 +0000)] 
Merge patch from JeremyF:

30-hg-clo

HELGRIND: command line option processing infrastructure (nothing using
it yet)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1303

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:14:30 +0000 (22:14 +0000)] 
Merge patch from JeremyF:

29-hg-rename-hg_mutex_t

HELGRIND: rename hg_mutex_t, because it was annoying me.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1302

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:11:53 +0000 (22:11 +0000)] 
Merge patch from JeremyF:

26-hg-client-reqs

HELGRIND: first client requests. Adds a request to return memory to
its virginal state (useful for allocators which recycle memory), and
one to put memory into an error state (useful for suppressing errors
from known races).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1301

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:08:40 +0000 (22:08 +0000)] 
Merge patch from JeremyF:

25-hg-free-mutex

HELGRIND: Track memory frees and allocates, looking for the freeing of
locked mutexes. Also makes some prime hash sizes actually prime.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1300

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:06:35 +0000 (22:06 +0000)] 
Merge patch from JeremyF:

24-sym-offset

When looking up a symbol, also attach an offset. Also changes to make
sprintf reentrant.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1299

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 22:00:20 +0000 (22:00 +0000)] 
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

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 21:57:52 +0000 (21:57 +0000)] 
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

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 21:51:10 +0000 (21:51 +0000)] 
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

23 years agoMerge patch from JeremyF:
Julian Seward [Wed, 13 Nov 2002 21:46:34 +0000 (21:46 +0000)] 
Merge patch from JeremyF:

  21-hg-hashed-lockset

  HELGRIND: New implementation of LockSets. This changes the
  lockset_table into a hash, and changes the representation of each
  LockSet from a list into an array. This improves performance (mainly
  because of the hash, but the arrays are more cache friendly too), and
  simplifies the code.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1295

23 years agoMerge patch from Jeremy F:
Julian Seward [Wed, 13 Nov 2002 21:44:39 +0000 (21:44 +0000)] 
Merge patch from Jeremy F:

 20-hg-lockgraph-report
 HELGRIND: Better reporting of locking ordering problems.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1294

23 years agoChange master version number to 1.9.1.
Julian Seward [Wed, 13 Nov 2002 21:35:53 +0000 (21:35 +0000)] 
Change master version number to 1.9.1.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1293

23 years agoJust call me Mr Brain-Dead Moron. Move the documentation sources to
Julian Seward [Wed, 13 Nov 2002 21:24:57 +0000 (21:24 +0000)] 
Just call me Mr Brain-Dead Moron.  Move the documentation sources to
where I _should_ have put them in the first place, and fix up the
Makefile.am's accordingly.  'make' and 'make install' now work.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1292

23 years agoRename --exit-when-zero flag to --exit-at-zero, in accordance with docs.
Julian Seward [Wed, 13 Nov 2002 19:42:30 +0000 (19:42 +0000)] 
Rename --exit-when-zero flag to --exit-at-zero, in accordance with docs.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1291

23 years agoDisallow logging sockets < 1024.
Julian Seward [Wed, 13 Nov 2002 19:41:41 +0000 (19:41 +0000)] 
Disallow logging sockets < 1024.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1290

23 years agoChanged Makefiles so that the following files are installed:
Nicholas Nethercote [Tue, 12 Nov 2002 10:53:31 +0000 (10:53 +0000)] 
Changed Makefiles so that the following files are installed:

  valgrind.h --> $prefix/include/valgrind/valgrind.h
  memcheck.h --> $prefix/include/valgrind/memcheck.h

This mirrors the lib/ structure.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1289

23 years agoAt Jeremy F's suggestion, avoided some gratuitous rule duplication.
Nicholas Nethercote [Tue, 12 Nov 2002 08:41:07 +0000 (08:41 +0000)] 
At Jeremy F's suggestion, avoided some gratuitous rule duplication.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1288

23 years agoCompiling vg_intercept.c with -fno-omit-frame-pointer to improve error
Nicholas Nethercote [Mon, 11 Nov 2002 18:54:42 +0000 (18:54 +0000)] 
Compiling vg_intercept.c with -fno-omit-frame-pointer to improve error
messages, as suggested by Jeremy Fitzhardinge.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1287

23 years agosort_malloc_shadows: check a loop bound in establishing initial shellsort
Julian Seward [Mon, 11 Nov 2002 08:36:52 +0000 (08:36 +0000)] 
sort_malloc_shadows: check a loop bound in establishing initial shellsort
step size.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1286

23 years agoFix error due to use of = as comparison, rather than ==, in profiling.
Julian Seward [Mon, 11 Nov 2002 08:32:06 +0000 (08:32 +0000)] 
Fix error due to use of = as comparison, rather than ==, in profiling.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1285

23 years agoAdd documentation back in, in its new form. Still all very rough and
Julian Seward [Mon, 11 Nov 2002 00:20:07 +0000 (00:20 +0000)] 
Add documentation back in, in its new form.  Still all very rough and
totally borked, but pretty much all the duplication is gone, and there
is a good start on a common core section in
coregrind/coregrind_core.html.  At least I know where I'm going with
all this now.

The Makefile.am's need to be fixed up.

Basic idea is that, when put together in a single directory, these
files make a coherent manual, starting at manual.html.  Fortunately
:-) "make install" does exactly that -- copies them to a single
directory.

After redundancy removal, there's more that 38000 words of
documentation here, according to wc.  Amazing.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1284

23 years agoDelete all the old documentation ...
Julian Seward [Mon, 11 Nov 2002 00:11:22 +0000 (00:11 +0000)] 
Delete all the old documentation ...

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1283

23 years agoThis isn't performance-critical; remove some optimisation flags.
Julian Seward [Sun, 10 Nov 2002 10:18:42 +0000 (10:18 +0000)] 
This isn't performance-critical; remove some optimisation flags.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1282

23 years agoAdded Makefile.am for auxprogs/.
Nicholas Nethercote [Sat, 9 Nov 2002 17:53:30 +0000 (17:53 +0000)] 
Added Makefile.am for auxprogs/.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1281

23 years agoClean up; add command-line spec of port # and request to exit when number
Julian Seward [Sat, 9 Nov 2002 10:24:01 +0000 (10:24 +0000)] 
Clean up; add command-line spec of port # and request to exit when number
of connections falls to zero.  Also, handle SIGINT, and print time
at start/exit.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1280

23 years agoAdded a basic core/skin interface versioning system. Each skin must use the
Nicholas Nethercote [Fri, 8 Nov 2002 15:48:16 +0000 (15:48 +0000)] 
Added a basic core/skin interface versioning system.  Each skin must use the
macro VG_DETERMINE_INTERFACE_VERSION exactly once.  If the X.Y core and skin
versions don't have a matching X (indicating binary incompatibility), Valgrind
will abort execution immediately at startup.

I even documented it in the skins guide!

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1279