Commit Graph

183 Commits

Author SHA1 Message Date
Nicholas Nethercote
0067b11b99 Remove unused macros.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2719
2004-09-14 11:55:36 +00:00
Nicholas Nethercote
4ecc334c35 Arch-abstraction:
- Moved VG_MAX_REALREGS into x86/ part.
- Tweaked basic types so they're suitable for both 32-bit and 64-bit platforms.
  Main change was to change 'Addr' to "unsigned long" which is the same size as
  a pointer.  Had to make a couple of minor changes to accommodate this.
  Also, introduced 'UWord' and 'Word' types which will be necessary for making
  code 64-bit clean.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2669
2004-09-07 10:17:02 +00:00
Nicholas Nethercote
28864b7564 Arch-abstraction:
- moved a lot of the baseBlock initialisation into x86/, including all the
  VGOFF variables, and all the x86 asm helper functions.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2668
2004-09-06 16:43:37 +00:00
Nicholas Nethercote
cc5d7881d8 Arch-abstraction: made vg_execontext.c arch-independent, based on Paul
Mackerras's work.

- introduced arch-neutral macros for getting the instruction/frame/stack
  pointers.

- renamed ExeContext.eips as ExeContext.ips

- renamed esp/ebp/eip to sp/fp/ip in several related files and arch-neutralised
  various comments

- introduced arch-neutral macros for walking the stack


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2663
2004-09-05 21:32:37 +00:00
Nicholas Nethercote
49eea042c1 Arch-abstraction: introduce constants for min and max instruction sizes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2660
2004-09-04 15:28:37 +00:00
Nicholas Nethercote
18355ff96b Arch-abstraction:
- Added include/x86/:  contains tool_arch.h, Makefile.am, .cvsignore.

- Added coregrind/x86/state.c.  Contains some arch-specific code for dealing
  with x86 registers -- eg. setting up the baseBlock, loading/saving the whole
  register state.  It is compiled into coregrind/x86/libarch.a and linked via
  ${VG_ARCH} with the core.

  Relatedly, also added coregrind/x86/{core_arch.h,core_arch_asm.h}.

- Correspondingly abstracted the register state out of ThreadState.  This
  affected every place that touches registers, and there are a lot of them.
  (Eventually all the register touching should be abstracted out in an
  arch-neutral way, but not yet;  one step at a time.)

- Added some declarations about register loading/saving functions to core.h;
  all architectures will have to provide these functions.

- Rejigged the build system so that the arch-specific stuff is all done via
  ${VG_ARCH}, rather than naming e.g. x86/ directly.  Appropriate -I arguments
  are used so that all the headers are found, etc.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2656
2004-09-03 13:45:29 +00:00
Nicholas Nethercote
3dc0e6069d Tweak some comments.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2651
2004-09-02 15:49:09 +00:00
Nicholas Nethercote
90369deb78 Arch-abstraction:
- renamed "vg_constants.h" as "core_asm.h".
- renamed "vg_constants_skin.h" as "tool_asm.h".
- renamed "mc_constants.h" as "mc_asm.h".


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2650
2004-09-02 15:37:39 +00:00
Nicholas Nethercote
2221d976a8 Arch-abstraction: whoops II, forgot to add the (residual) vg_skin.h, which just
points to tool.h.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2649
2004-09-02 08:55:34 +00:00
Nicholas Nethercote
10d04230ef Arch-abstraction: Whoops, forgot to add tool.h.base. Also updated .cvsignore.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2648
2004-09-02 08:54:27 +00:00
Nicholas Nethercote
13a74aa53a Arch-abstraction: renamed "vg_skin.h" as "tool.h". Kept a residual vg_skin.h
(which just #includes tool.h) for backward-compatibility.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2647
2004-09-02 08:51:43 +00:00
Nicholas Nethercote
6a5de86389 Arch-abstraction: renamed "vg_include.h" as "core.h" (a few that I missed in
my previous commit).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2645
2004-09-02 08:10:13 +00:00
Tom Hughes
476075730e Add vki_itimerspec definition for POSIX timer support.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2631
2004-08-30 20:31:35 +00:00
Tom Hughes
dbff330cf4 Removed comma at the end of an enumerator list - this is allowed
in C99 but not in C89 except as a GNU extension so it's probably
best not to rely on it.

Patch from Jeroen N. Witmond <jnw@xs4all.nl>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2617
2004-08-25 13:25:30 +00:00
Nicholas Nethercote
a2b3609df7 Small step in factoring out arch-specific code: replace
__attribute((regparm(n))) with REGPARM(n) everywhere.  REGPARM() is defined in
vg_skin.h, but will eventually be defined separately for each arch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2601
2004-08-23 15:06:23 +00:00
Tom Hughes
546afbe696 Add support for the POSIX message queue system calls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2585
2004-08-14 18:52:27 +00:00
Nicholas Nethercote
db16c95eb8 Remove no-longer-used prefixes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2565
2004-08-04 10:07:47 +00:00
Nicholas Nethercote
38ff4e69d1 Comment changes only: s/skin/tool/
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2555
2004-08-03 13:29:09 +00:00
Tom Hughes
f10c38f7e5 Modify the ipc system call so that only those calls which may block
are treated as blocking.

This fixes bug #86000 because shmat is no longer treated as blocking
and it is therefore no longer possible for two threads to try and use
the same address for the shared memory segment.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2536
2004-07-29 22:40:07 +00:00
Tom Hughes
1afbb3fc45 Modified the fcntl system call so that only those reason codes which
can block (ie F_SETLKW) are treated as blocking.

This resolves the F_SETOWN problem described in bug #85969.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2535
2004-07-29 21:20:11 +00:00
Nicholas Nethercote
43f025c169 Add another C call helper.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2510
2004-07-19 08:18:00 +00:00
Tom Hughes
6374702f6c Commit missing kernel interface definitions for async I/O calls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2486
2004-07-16 06:03:24 +00:00
Jeremy Fitzhardinge
65a4962721 Clarify that you can also iterate from the result of a SkipList_Find.
(Comment change only)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2455
2004-07-02 00:22:36 +00:00
Nicholas Nethercote
2a48390f98 Couple of clarifying comments about skip lists. (Comment change only)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2454
2004-07-01 12:21:03 +00:00
Tom Hughes
4a5e522a21 Bumped the core interface major version number to reflect changes
made to the interface when removing nested functions.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2447
2004-06-27 18:10:21 +00:00
Tom Hughes
414846a941 Removed all uses of nested functions as they only work with gcc and
cause the stack to be marked as executable in order for them to work.

All assembler files have also had a declaration added so that the
object they generate will be marked as not needing an executable stack.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2446
2004-06-27 17:37:21 +00:00
Nicholas Nethercote
e55637b2b6 Remove a function and global variable no longer needed.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2435
2004-06-22 14:09:52 +00:00
Nicholas Nethercote
2fab200ad0 Renamed the following options:
--logfile-fd  -->  --log-fd
  --logfile     -->  --log-file
  --logsocket   -->  --log-socket

to be consistent with each other and other options (esp. --input-fd).  Also
renamed some related variables.  The old names still work, for backwards
compatibility, but they're not documented.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2429
2004-06-21 12:42:35 +00:00
Robert Walsh
79b252dfdf Memory pool support.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2428
2004-06-19 18:12:36 +00:00
Tom Hughes
96d29fe8ac Add support for the FIGETBSZ and FIBMAP ioctls based on a patch
from Joseph D Wagner <theman@josephdwagner.info>.

CCMAIL: 83025-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2426
2004-06-19 12:41:05 +00:00
Nicholas Nethercote
55cb3cd764 Introduced 4 macros to minimise boilerplate command line processing code.
Nicely cuts around 130 lines of code, spread over the core and several tools.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2422
2004-06-16 21:26:32 +00:00
Tom Hughes
3561ea08ca Added VG_(cpuid) to replace the various bits of inline assembler used
to query the CPU characteristics as the use of four implicit registers
causes havoc when GCC tries to inline and optimise the assembler.

Fix to bug #79696.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2421
2004-06-16 20:51:45 +00:00
Tom Hughes
bb942b40c8 Add a strrchr implementation.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2407
2004-06-13 09:55:22 +00:00
Jeremy Fitzhardinge
b8abc7c9d1 Partial fix for bug 76869. This fixes the problem with returning from
a signal handler when VDSOs are turned off in FC2.  Note that we don't
(yet) support VDSOs being on (use "echo 0 > /proc/sys/kernel/vdso").


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2400
2004-06-03 10:00:42 +00:00
Nicholas Nethercote
ff7adfacc8 Introduce uWiden, similar to uCCall, uCond, etc.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2374
2004-04-18 12:23:02 +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
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
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
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
a13fdfdad3 Fix var names in prototypes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2263
2004-02-23 16:45:18 +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
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
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
Nicholas Nethercote
aa5c98c53b Moved stage2.c into vg_main.c. Merged main() and VG_(main)(); VG_(main)()
no longer exists.  One advantage of this is that global
variables/structures needed for communicating between the two can be made
local.  Also, the order in which things happen has been simplified.

This is mostly just a big refactoring.  Startup is now a fair bit easier to
understand.  Dependencies between the various startup stages are fairly well
documented in comments.  Also, --help and --version now work properly --
eg. --help gives tool-specific help if --tool was specified.  There is still
some parts where things could be reordered and/or simplified, and where the
dependencies aren't clear.  These are marked with 'XXX'.

One new feature was added: ability to read options from ~/.valgrindrc and
./.valgrindrc.  Part of this is support for specifying tool-specific options
in the form --toolname:tool-specific-option.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2222
2004-01-24 18:18:54 +00:00
Jeremy Fitzhardinge
357883e70a Fix bug 73219. This adds a general mechanism for querying the host CPU's
capabilities, and uses it to see if it has SSE/SSE2/fxsave support before
trying to use fxsave at startup.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2221
2004-01-23 23:09:01 +00:00
Nicholas Nethercote
c756c590cf Convert "skin" to "tool" in various places; almost entirely within comments,
nothing that will affect code.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2217
2004-01-21 15:08:04 +00:00
Jeremy Fitzhardinge
75d6dc8434 This change implements the TLS extension to the x86 ABI. This allows
threads to have thread-private data which is quickly accessible via a
segment in the GDT, stored in %gs.  The patch implements the relevent
syscalls (setthreadarea), and also manages switching the VCPU's segment
information at thread context-switch time.  Mostly Tom Hughes' work.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2215
2004-01-21 01:27:27 +00:00
Nicholas Nethercote
5630025b84 Patch from Tom Hughes, for bug 72643:
Patch to improve SSE/SS2 support

  This patch should implement most of the missing SSE/SSE2 opcodes. About
  the only ones it doesn't do are the MASKMOVxxx ones as they are quite
  horrible and involved an implicit reference to EDI so I need to think
  about them a bit more.

  The patch also includes a set of tests for the MMX/SSE/SSE2 opcodes to
  validate that they have the same effect under valgrind as they do when
  run normally. In one or two cases this wasn't actually the case even
  for some of the implemented opcodes, so I fixed those as well ;-)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2202
2004-01-19 19:14:18 +00:00
Julian Seward
cafeef8e48 Support for FXSAVE/FXRSTOR (Tom Hughes). Fixes #71180.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2183
2004-01-04 23:30:55 +00:00