133 Commits

Author SHA1 Message Date
Robert Walsh
9aebbbd032 Add missing atoll16 prototype. I use this in the watchpoint stuff.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2182
2004-01-04 23:15:22 +00:00
Nicholas Nethercote
07b8e3438b Updated copyright dates for 2004. Also added a couple of missing headers and
footers to some new files.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2177
2004-01-04 16:43:23 +00:00
Dirk Mueller
6be7c55829 implement cmpxchg8b, patch by Tom Hughes.
CCMAIL: 69688-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2154
2004-01-02 22:42:29 +00:00
Dirk Mueller
c3076b4eab mark the braced expression as C(++) extension
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2152
2003-12-31 14:32:23 +00:00
Jeremy Fitzhardinge
88892fd58d Re-add proper support for mremap(). Also, fix a bug in munmap().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2142
2003-12-22 08:48:50 +00:00
Jeremy Fitzhardinge
863238a720 Make rep; nop (pause) yield the thread. Based on a patch by Tom Hughes;
I added a test case and cleaned up vg_dispatch.S while I was about it.
CCMAIL: 69529-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2129
2003-12-18 09:06:09 +00:00
Jeremy Fitzhardinge
ebe35cedb9 Patch from Tom Hughes: set VG_(max_fd) based on the current file
descriptor limit rather than assuming 1024.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2127
2003-12-18 02:39:22 +00:00
Jeremy Fitzhardinge
f2f0c80b83 An experiment in generating branch-prediction hints. Enable them with
--branchpred=yes.  I'm interested to know if these make a significant
difference for anyone - I see a small speed increase on the Pentium M.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2126
2003-12-18 02:10:54 +00:00
Dirk Mueller
4ed09ea00c ignore
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2124
2003-12-17 13:28:12 +00:00
Jeremy Fitzhardinge
822231c4b0 Add and delete all the files which need adding and deleting.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2119
2003-12-16 02:14:00 +00:00
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
Dirk Mueller
2c314c8a97 this should fix compilation on weird kernel 2.6.x installations.
CCMAIL: 68360@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2052
2003-11-19 22:07:14 +00:00
Dirk Mueller
f633fb1794 trying to fix compilation. Does it work now for everybody?
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2043
2003-11-19 16:54:52 +00:00
Robert Walsh
f9ea43d896 Add a facility for tracking open file descriptors. Information about
still open files is dumped out exit.  Enabled using the --track-fds
switch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2031
2003-11-17 17:45:00 +00:00
Jeremy Fitzhardinge
4eac75bf3e Fix some bugs in syscall/signal handling:
If the proxyLWP for a thread got a signal just as we were sending the
syscall request to it, then we would end up running the syscall twice.
The fix is to not check the results pipe while sending the syscall request
- wait until we're in a better state for handling signals (the deadlock
the results-read was supposed to avoid cannot actually happen).

Related to that, if we're delivering a signal to a thread, and that thread
is currently waiting for a syscall to complete, make sure we collect the
syscall results before entering the signal handler (otherwise we may end
up bogusly trying to restart the syscall by moving EIP back, even though
it now points to the signal handler rather than the syscall instruction)

This change also adds an assertion to VG_(restart_syscall) to make sure
we were actually restarting a syscall and not just randomly changing EIP
(this found the problem above).

Also, make set/getitimer run in the proxyLWP context, so that they
modify/read the proxyLWP's timers rather than the schedluer LWP's timers.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2013
2003-11-07 23:09:48 +00:00
Julian Seward
e215c37a9b Change VG_CORE_INTERFACE_MAJOR_VERSION to 5.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2006
2003-11-05 23:59:21 +00:00
Jeremy Fitzhardinge
65649c9d47 Patch from Robert Walsh <rjwalsh@durables.org>. Adds some new client
requests to allow client code to print messages through Valgrind's
logging mechanism.  The new requests are:
  VALGRIND_PRINTF - do a normal printf (prefixed with **PID**)
  VALGRIND_PRINTF_BACKTRACE - do a printf with stack trace
  VALGRIND_INTERNAL_PRINTF - printf, but for internal use (prefixed with ==PID==)
  VALGRIND_INTERNAL_PRINTF_BACKTRACE - as above, with backtrace


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1974
2003-10-31 07:12:21 +00:00
Nicholas Nethercote
1cea4f647b Increased the skin major version number, to reflect the changed return values
of functions like VG_(open), and also to cover any future changes between now
and the HEAD becoming an official release.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1969
2003-10-30 12:34:47 +00:00
Jeremy Fitzhardinge
01c5d4fe3e Update some stuff related to the syscalls change:
- restart syscalls which return ERESETARTSYS
 - make code to restart a syscall common
 - keep a process-wide pending signal set to store as-yet
   undelivered signals (only used in 2.4 mode; TODO: siginfo, queues)
 - make execve work a bit better - it is impossible to recover from
   execve failing, so we try to check that it will before running the
   syscall itself (also fixes bug with SuSE 8.2 kernel)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1964
2003-10-30 07:21:44 +00:00
Julian Seward
195939592a SSE/SSE2 fixes needed to run the entire test suite of the GNU
Scientific Library (gsl-1.4) compiled with Intel Icc 7.1 20030307Z '-g
-O -xW'.  I think this gives pretty good coverage of SSE/SSE2 floating
point instructions, or at least the subset emitted by Icc.  So far
tested on memcheck and nulgrind; addrcheck and cachesim still testing.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1955
2003-10-19 08:18:52 +00:00
Nicholas Nethercote
fef87991da Fix a couple of compiler warnings.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1931
2003-10-15 10:34:03 +00:00
Jeremy Fitzhardinge
8f0884bbb6 When creating a logfile name, add a sequence number to the name in case
a logfile for that pid already exists.  This may happen for programs
started during system boot which will tend to get the same pid each boot.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1928
2003-10-14 22:13:28 +00:00
Jeremy Fitzhardinge
c55d99c0cc Adds VG_(describe_addr)() for generating symbolic descriptions of a
memory address, based on which variables are in scope at the time and
their types.

As part of this change, I restructured the symbol table parsing code,
by splitting the stabs and dwarf-specific parts into their own files.
I also added a new set of vg_symtypes.[ch] files which contains the
type system code and the core of the VG_(describe_addr)().

I've only implemented the stabs type parser.  I have not yet implemented
the DWARF2 parser.  It looks well-defined but complex.

The only skin which uses this is Helgrind at the moment.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1926
2003-10-14 21:55:10 +00:00
Jeremy Fitzhardinge
bab09402f1 This creates a new UInstr for multiply. This is mainly so that memcheck
can treat it like add and generate partially-defined results of multiply
with partially defined arguments.  It may also speed things up a bit,
if they use lots of multiplies.

This change only deals with signed "new style" multiplies.  That the x86
has two quite different kinds of multiply instructions: the "old-style"
signed and unsigned multiply which uses fixed registers (eax:edx) and
generates a result twice the size of the arguments, and the newer signed
multiple which takes general addressing modes.  It seems that gcc always
(almost always?) generates the new signed multiply instructions, except
for byte-sized multiplies.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1925
2003-10-14 21:49:11 +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
4877ebb17e Moved the MALLOCLIKE and FREELIKE client requests out of memcheck.h, and into
valgrind.h.  Although these requests are not implemented by the core, they can
be implemented by skins that track heap blocks, eg. Memcheck, Annelid, Massif.
This is in preparation for committing Massif to the repository.

I think I managed to make the change in a binary-compatible way.  The only
inconvenience for users is that if they have a client program compiled with the
old requests in, Valgrind will abort with an explanatory message that tells
them to recompile.  Once they've done that (no changes to their program are
required), it works again.

I even updated the docs.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1881
2003-10-02 13:44:04 +00:00
Nicholas Nethercote
24b34c91c8 Fixed up the client request info in the docs, which required splitting the core
requests from the Memcheck requests and putting the descriptions in the
appropriate parts of the docs.

Removed the __VALGRIND_SOME_SKIN_H test -- it was designed to prevent people
#including valgrind.h when they probably want memcheck.h, but it's actually a
reasonable thing to do to #include valgrind.h alone, because there are some
requests in valgrind.h.

Removed references to VALGRIND_MAKE_NOACCESS_STACK from the docs, as it doesn't
exist in the implementation.

Fixed a few other minor things.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1880
2003-10-02 13:25:02 +00:00
Dirk Mueller
e762570dbb export emit_movzbl_regmem_reg as the other variants are exported too
and its useful for skins


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1877
2003-09-30 23:01:50 +00:00
Nicholas Nethercote
02494a520e Export to skins a function, VG_(HT_count_nodes)(), which was always intended to
be visible to them, but I had forgotten to export.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1874
2003-09-30 15:43:51 +00:00
Nicholas Nethercote
1e843020c5 comment change only
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1873
2003-09-30 15:37:24 +00:00
Nicholas Nethercote
ef2eff1717 Removed sort_hash_array(). Changed VG_(HT_to_sorted_array)() to
VG_(HT_to_array)().  Leak checker now sorts the given array itself, using
VG_(ssort)().


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1872
2003-09-30 15:35:13 +00:00
Nicholas Nethercote
79e91e16ea Added a generic VG_(ssort)() function, like stdlib.h's qsort(). It's
specialised for the size == 1/2/4 cases.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1871
2003-09-30 14:43:54 +00:00
Nicholas Nethercote
18de7ba96b Made VG_(read_millisecond_timer)() available to skins. Also made it cope
with being called from SK_(pre_clo_init)(), before its startup code has been
run (just returns 0).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1868
2003-09-30 14:03:21 +00:00
Nicholas Nethercote
4e147a4eaf Added VG_(getcwd_alloc)(), which is much easier to use than VG_(getcwd)().
(getcwd() is really a pretty stupid syscall)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1867
2003-09-30 13:51:23 +00:00
Dirk Mueller
8d8ec2ca64 implement IN and OUT opcodes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1839
2003-09-27 20:15:01 +00:00
Dirk Mueller
eaf2fd38cd implement a couple more instructions. I've mailed this patch to Julian
and Nick but got no reply. I guess they're okay with it. I tested them
quite a lot so it should be fine.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1834
2003-09-26 00:32:53 +00:00
Dirk Mueller
7d1abc6b9e compiler warning fixes
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1824
2003-09-18 01:41:48 +00:00
Nicholas Nethercote
c0f0059bf7 Added some skin-visible functions that give skins a bit more control over
how stack snapshots are taken and printed;  they can be used in preference
to VG_(get_ExeContext)() and VG_(pp_ExeContext)().  These are used by
Massif, my heap profiling skin.

Changed --num-callers to allow a backtrace size of 1.

Added code so that when Valgrind fails to disassemble an instruction, the
instructions line/file and address are printed out, which makes it easier to
work out where and what it is.  Required the stack snapshot changes above.

MERGE TO STABLE?


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1819
2003-09-16 07:41:43 +00:00
Nicholas Nethercote
1cc2127659 Moved vg_kerneliface.h from coregrind/ to include/, where it was needed for
external skin compilation to work.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1784
2003-07-24 19:35:00 +00:00
Nicholas Nethercote
0f871c249c A big commit size-wise, but small concept-wise: removed the ThreadState type
from skin's view, replacing all instances with ThreadId.  Much cleaner.  Had to
change the way VG_(get_ExeContext)() worked a little.  Changed the core/skin
major interface because this breaks the old version.  Also fixed a few minor
related things here and there.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1782
2003-07-24 08:45:32 +00:00
Nicholas Nethercote
c3439e49db Installing vg_skin.h and dependent .h files, on Josef's request, as it makes
separate skins easier to install.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1773
2003-07-22 07:44:21 +00:00
Nicholas Nethercote
6b57397875 This commit fixed some bugs in error and suppression handling. Basically, I
had forgotten that some errors (PThread errors) are found by the core, rather
than skins and so the skin shouldn't be involved in handling them.  This commit
fixes the problem.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1770
2003-07-21 10:38:23 +00:00
Julian Seward
dd2abcb8e0 In vg_memory.c, startup_segment_callback, fix initialisation ordering
problem which caused the leak checker to misbehave following recent
PLT-bypass workaround.

In short, it is an error to announce to the skin, segments found which
belong to the low-level memory manager, because the skin may then mark
them as accessible to the client.  This is wrong, and the client
should only acquire accessible memory via malloc etc and stack
movement.  Now we carefully avoid mentioning any segment belonging to
the low level memory manager.

Take the opportunity to improve VG_(within_m_state_static) so that it
also detects pointers within the thread table.  This can reduce the
number of blocks the leak checker spuriously thinks are still
reachable.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1751
2003-07-12 12:11:39 +00:00
Julian Seward
0b292b9ff6 Increase default number of supported threads from 50 to 100.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1729
2003-07-06 01:52:32 +00:00
Dirk Mueller
faf02201e5 spelling fixes
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1715
2003-07-04 16:18:15 +00:00
Julian Seward
adb1aa79cb A few more SSEs.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1705
2003-06-18 23:30:52 +00:00
Julian Seward
db24b72034 - Continue to clear up SSE insn emitters following recent cleanups re
G vs E register fields in encoding
- Add SSE3e_RegWr and use it to implement a case in MOVD.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1699
2003-06-15 22:28:05 +00:00
Julian Seward
a37fdf4d16 Rename the SSE and MMX uinstrs which read/write integer registers, in
a way consistent with the position of the register field in the
instruction.  In Intel encoding parlance, the G register is in bits
5,4,3 and the E register is bits 2,1,0, and so we adopt this scheme
consistently.  Considering how much confusion this has caused me in
this recent bout of SSE hacking, consistent renaming can only be a
good thing.  It makes it a lot easier to figure out if parts of the
SSE handling machinery are correct, or not.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1698
2003-06-15 21:54:34 +00:00
Julian Seward
eeb449497f Yet more SSE insns.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1696
2003-06-15 03:13:48 +00:00