Commit Graph

446 Commits

Author SHA1 Message Date
Nicholas Nethercote
b1b5c00b01 Streamlined and consistified alignment checking.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3168
2004-11-30 18:08:05 +00:00
Nicholas Nethercote
782dd25de9 64-bit cleanness: fix nasty bug... in the memory allocators, redzones
were being kept as UInts.  They were sometimes negated and then used as
indices to arrays, and on 64-bit platforms they get converted
incorrectly (using zero-extension instead of sign extension, I think)
before the indexing happens, giving a totally bogus index.

The fix was to convert all these types to SizeT.  It would be nice to be
able to avoid this automatically somehow in the future.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3158
2004-11-30 13:26:29 +00:00
Nicholas Nethercote
7a75a9f583 Overhauled the docs. Removed all the HTML files, put in XML files as
converted by Donna.  Hooked it into the build system so they are only
built when specifically asked for, and when doing "make dist".

They're not perfect;  in particular, there are the following problems:
- The plain-text FAQ should be built from FAQ.xml, but this is not
  currently done.  (The text FAQ has been left in for now.)

- The PS/PDF building doesn't work -- it fails with an incomprehensible
  error message which I haven't yet deciphered.

Nonetheless, I'm putting it in so others can see it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3153
2004-11-30 10:43:45 +00:00
Nicholas Nethercote
10b4595add Added beginnings of an AMD64 port, so lots of new files and directories.
It compiles, but aborts immediately if you try to run it.

I didn't include ldt.c;  I'm not sure how the LDT is used on AMD64.  It can be
added later if necessary.

While doing this, did some 64-bit cleanness fixes:
- Added necessary intermediate casts to ULong to avoid warnings when converting
  ThreadId to void* and vice versa, in vg_scheduler.c.
- Fixed VALGRIND_NON_SIMD_CALL[0123] to use 'long' as the return type.
- Fixed VALGRIND_PRINTF{,BACKTRACE} to use unsigned longs instead of unsigned
  ints, as needed.
- Converted some offsets in vg_symtab2.h from "Int" to "OffT".
- Made strlen, strncat, etc, use SizeT instead of 'unsigned int' for the length
  parameter.
- Couple of other minor things.

I had to insert some "#ifdef __amd64__" and "#ifndef __amd64__" guards in
places.  In particular, in vg_mylibc.c, some of our syscall wrappers aren't
appropriate for AMD64 because the syscall numbering is a bit different in
places.  This difference will have to be abstracted out somehow.

Also rewrote the sys_fcntl and sys_fcntl64 wrappers, as required for AMD64.

Also moved the ipc wrapper into x86, since it's not applicable for
AMD64.  However, it is applicable (I think) for ARM, so it would be nice
to work out a way to share syscall wrappers between some, but not all,
archs.  Hmm.  Also now using the real IPC constants rather than magic
numbers in the wrapper.

Other non-AMD64-related fixes:
- ARM: fixed syscall table by accounting for the fact that syscall
  numbers don't start at 0, but rather at 0x900000.
- Converted a few places to use ThreadId instead of 'int' or 'Int' for
  thread IDs.
- Added both AMD64 and ARM (which I'd forgotten) entries to valgrind.spec.in.
- Tweaked comments in various places.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3136
2004-11-29 13:54:10 +00:00
Julian Seward
46c0de784f Increase stated average translation size, at least for now.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3133
2004-11-28 16:56:51 +00:00
Julian Seward
798a984cea Build fixes for gcc-2.95.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3132
2004-11-28 14:25:01 +00:00
Nicholas Nethercote
f00e834c58 Use better syscall argument names for two wrappers, now that "res" and
"arg[2345]" don't clash with macros.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3128
2004-11-27 16:57:18 +00:00
Nicholas Nethercote
7a04aed730 Introduced build variables VG_ARCH_ALL, VG_OS_ALL, and VG_PLATFORM_ALL,
which list all the arches/OSes/platforms supported.  These are used by
several newly added DIST_SUBDIRS automake commands, which specify that
although when you are building you only want to build for the current
arch/OS/platform, when you do 'make dist' you want every
arch/OS/platform to get included.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3127
2004-11-27 16:47:42 +00:00
Nicholas Nethercote
4399d9700f Added beginnings of an ARM port, to the point where it compiles. It does not
run, though.  There are lots of stubs to be filled in.  (The asm ones currently
just have "swi" in them, which seems to cause seg faults.) 

Also, some of the macros are decided dubious, especially:

  ARCH_* are bogus
  SYSCALL_RET is bogus
  PLATFORM_SET_SYSCALL_RESULT is bogus
  not sure about SET_SYSCALL_RETVAL
  FIRST_STACK_FRAME et al -- bogus?
  VG_MAX_JUMPS ?

And in stage2.lds, the 0x8048000 is almost certainly wrong


This required some tweakings of the core:
- some of the vki_*.h kernel types were fixed up

- had to disable the AM_PROG_CC_C_O macro in configure.in, because automake
  (autoconf?) didn't like it...

- some "#ifdef __x86__" guards were introduced, for nasty x86 things I don't
  yet know how to factor out (trampoline page muck, sysinfo page muck).

- fixed a minor stupidity in vg_proxylwp.c.

- moved the ptrace wrapper into the x86-linux part

- had to change the intercept mangling scheme, to use 'J' instead of '$' as the
  escape char because GCC didn't like '$'.  This is all very dubious, and only
  works because none of our intercepted symbols contains a 'J'.  To be fixed up
  ASAP.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3120
2004-11-26 19:34:36 +00:00
Julian Seward
26e2eb2b4a When doing pessimistic lazy propagation through a dirty helper call,
do not consider inputs from those parts of the guest state marked as
read (or modified) which which are declared to be always-defined, and
dually do write outputs to those parts of the guest state written (or
modified) which are declared to be always-defined.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3119
2004-11-26 19:17:47 +00:00
Nicholas Nethercote
fdccda9d04 Removed mc_helpers.S, which is no longer used.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3104
2004-11-26 10:35:44 +00:00
Nicholas Nethercote
ead76e69ac Removing the insn_* tests from helgrind, memcheck, addrcheck and
cachegrind, because having them there doesn't add anything beyond that
tested in 'none'.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3101
2004-11-25 17:47:43 +00:00
Nicholas Nethercote
efed8e4671 Removed shadow_regs 'need', because it was being used only trivially in
a couple of places, and is no longer needed.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3096
2004-11-24 16:57:16 +00:00
Nicholas Nethercote
398ce0c269 Cleanups, mostly for the baseBlock removal.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3095
2004-11-24 16:43:43 +00:00
Nicholas Nethercote
feb4fbaef5 Removed all uses of register numbers (eg. arch-specific ones like R_EAX, and
arch-neutral ones like R_STACK_PTR).  Where they were used, we now always talk
about an offset into the Vex guest state, and an offset.  As a result,
the shadow register get/set functions had to change.  They now also use
an offset and size, and in an arch-neutral way.

Also, I combined the five the post_reg_write* functions into a single one that
takes a 'CorePart' parameter (plus also a ThreadId).  Also, I added more
arguments (the CorePart, and the ThreadId) to the post_mem_write event, for
consistency with the pre_mem_* events.

Also, I reduced the number of register names that must be specified by each
arch, by factoring out duplication; and shortened their names for the core (eg.
ARCH_STACK_PTR is now STACK_PTR).

Plus some related minor cleanups in syscall wrappers.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3094
2004-11-24 16:30:22 +00:00
Julian Seward
3558db91b1 Get rid of baseBlock. Now, when generated code is running, the guest
state pointer points directly at the ThreadState.arch.vex field, thus
updating it in place and avoiding a lot of code (and time-wasting)
which copies stuff back and forth to baseBlock.

Fix zillions of other places in the system where the current thread id
is needed.  It is now passed to all needed places.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3090
2004-11-24 10:44:19 +00:00
Nicholas Nethercote
9f2118c217 Fix this regression test to account for the fact that FP regs are now
checked for definedness errors lazily, just like integer regs.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3084
2004-11-23 17:19:53 +00:00
Nicholas Nethercote
f7d26d172b Make these work again.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3083
2004-11-23 17:13:58 +00:00
Nicholas Nethercote
6cc0d4c473 Add a mandatory --with-vex option to configure script.
Also, fix a Makefile so that Memcheck's regtests all build again.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3081
2004-11-23 16:31:56 +00:00
Nicholas Nethercote
7f0984ea02 The syscall wrappers for sys_fcntl{,64} were too simplistic -- the 3rd
arg is only used if the 2nd arg has particular values, so we were
getting false positives.  This commit makes the wrappers smarter to
account for this.  I updated the reg test too.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3080
2004-11-23 14:57:49 +00:00
Julian Seward
166033939c Do our own implementations of strchrnul() and rawmemchr().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3075
2004-11-23 00:20:17 +00:00
Nicholas Nethercote
86751c1c2e Removed now-defunct read/write checks for FPU ops.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3074
2004-11-22 21:29:38 +00:00
Nicholas Nethercote
196e8dfd25 Removed the now-defunct files vg_from_ucode.c and vg_to_ucode.c.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3073
2004-11-22 21:23:08 +00:00
Nicholas Nethercote
ddf3e0178b Remove now-defunct --cleanup option for Memcheck.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3072
2004-11-22 21:16:08 +00:00
Julian Seward
fd3934e1e5 Fix some linking problems which were preventing memcheck from starting.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3069
2004-11-22 20:51:49 +00:00
Nicholas Nethercote
8664fd5e88 Remove extended_UCode 'need', which has been obsoleted by Vex. Kept the
field in the struct for backward compatibility (but renamed it to
no_longer_used_0).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3067
2004-11-22 20:37:42 +00:00
Julian Seward
d6a28c4ff3 Make Memcheck compilable.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3065
2004-11-22 20:19:51 +00:00
Nicholas Nethercote
400cfc0311 Remove useless parameters to TL_(pre_syscall)() and TL_(post_syscall)().
Also remove Memcheck's and Addrcheck's use of syscall_wrappers,
since they didn't do anything useful.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3064
2004-11-22 19:57:39 +00:00
Nicholas Nethercote
9df62e9f85 Rename macros ("SKIN"-->"TOOL")
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3062
2004-11-22 19:12:49 +00:00
Nicholas Nethercote
454ab569fe Converted the SK_ prefix to TL_ everywhere.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3060
2004-11-22 18:33:15 +00:00
Nicholas Nethercote
3093a1768b Renamed VG_(skin_panic) as VG_(tool_panic).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3057
2004-11-22 18:02:32 +00:00
Nicholas Nethercote
213ef621b7 Renamed functions with 'Skin' in them: SK_(pp_SkinError),
SK_(eq_SkinError), MAC_(pp_shared_SkinError)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3056
2004-11-22 17:57:07 +00:00
Nicholas Nethercote
cf9cf2a220 Renamed sk_assert() as tl_assert().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3055
2004-11-22 17:18:48 +00:00
Nicholas Nethercote
40de233989 Changed name of tool shared objects from vgskin_XXX.so to vgtool_XXX.so.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3054
2004-11-22 16:58:05 +00:00
Nicholas Nethercote
48aff7c26f Convert the 'skin_errors' need to 'tool_errors'.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3053
2004-11-22 16:46:13 +00:00
Nicholas Nethercote
eb802373ac No longer producing this file.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3051
2004-11-19 16:10:23 +00:00
Nicholas Nethercote
3b4dc0bdba Generalised the reg test script again: replaced the "cpu_test" line,
which caused the test to be skipped if the CPU type wasn't appropriate,
with a "prereq" line, which specifies a command that must succeed before
the test is run.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3041
2004-11-18 12:48:17 +00:00
Nicholas Nethercote
a2d1e021a4 Generalised reg test script: instead of having a "delete:" line, for removing
files once a test has completed, we have a "cleanup:" line, which specifies a
cleanup command.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3039
2004-11-18 11:57:00 +00:00
Nicholas Nethercote
26361b37e9 account for restart_syscall
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3028
2004-11-16 18:20:35 +00:00
Nicholas Nethercote
583e072e7f fix incorrect counts
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3027
2004-11-16 18:13:11 +00:00
Nicholas Nethercote
6b8d578f39 Add some missing test cases.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3026
2004-11-16 17:59:04 +00:00
Nicholas Nethercote
1524d5ac06 Converted the last syscalls. Phew. Still some cleaning up to do, esp. with
socketcall() and ipc() which are done too simplistically.

Also, VG_([gs]et_thread_area)() both now return -VKI_EFAULT if they are given a
NULL pointer.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3024
2004-11-16 17:13:24 +00:00
Nicholas Nethercote
126c196c21 Converted the timer_* and clock_* syscalls.
Also now checking the return value of every syscall in scalar, to make sure
that they (mostly) fail as expected.  Because occasionally one would succeed
unexpectedly and unaddressable memory would be marked as addressable, and
things would go haywire.  (The fact that the wrapper sets the memory as
addressable in these cases is a bug with the relevant wrappers;  I'll fix them
later.)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3023
2004-11-16 16:15:41 +00:00
Nicholas Nethercote
c026b31697 Converted the io_* and mq_* syscalls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3022
2004-11-16 12:58:04 +00:00
Tom Hughes
a8d21d440f Use sigprocmask(SIG_SETMASK) to make sure the signal mask is in a
known state before performing the test. This is done because perl on
some systems leaves some signals blocked when starting child
processes which can cause this test to fail.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3021
2004-11-16 12:09:43 +00:00
Tom Hughes
e07366ea5e Add arguments to the prctl call in the scalar test.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3019
2004-11-16 08:27:21 +00:00
Nicholas Nethercote
d3cb945e9b add a bunch of tests
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3018
2004-11-15 20:42:06 +00:00
Nicholas Nethercote
28395a2a4a Forgot to add the expected stderr output.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3015
2004-11-15 19:09:03 +00:00
Nicholas Nethercote
39914e513d Converted sigprocmask and rt_sigprocmask.
While doing so, fixed bug #93328, by using the right sized types in
sigprocmask(), and converting them as necessary.  Added a regression test for
it too.

(partly) MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3013
2004-11-15 19:03:27 +00:00
Nicholas Nethercote
0ec929266e convert a couple more
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3012
2004-11-15 17:19:22 +00:00