Commit Graph

104 Commits

Author SHA1 Message Date
Nicholas Nethercote
f912a81248 Add VGA_ prefix to the arch-specific macros {MIN,MAX}_INSTR_SIZE and
REGPARMS.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3458
2005-03-27 01:55:21 +00:00
Nicholas Nethercote
36e86a9542 Add VG_ prefix to SKIPLIST_INIT and IS_*_ALIGNED macros. Also pull
IS_PAGE_ALIGNED into tool.h with the others.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3457
2005-03-27 01:42:41 +00:00
Nicholas Nethercote
8853545f0f Use VGP_ prefix more consistently for platform-specific exports.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3436
2005-03-26 02:42:31 +00:00
Julian Seward
d156fe938e Horrible syscall-related hacks to make it at least compile on amd64.
Doesn't work yet.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3400
2005-03-21 17:43:34 +00:00
Julian Seward
8a5c020b4f Fix VG_({un}pad_address_space) so as to make sys_io_setup work again.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3383
2005-03-17 02:14:44 +00:00
Julian Seward
c97c70dfff Reinstate VG_(find_root_memory). This makes the leak detector work
again.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3377
2005-03-16 12:27:53 +00:00
Julian Seward
f6401271ca Get rid of VG_(client_free) as it was never used. Rename its
counterpart VG_(client_alloc) to VG_(get_memory_from_mmap_for_client).
Man, this low level memory management is an undisciplined mess.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3376
2005-03-16 12:11:12 +00:00
Julian Seward
4fa79fe968 Don't read symbol tables for .so's that constitute part of Valgrind
itself.  Doing so -- in this case for libc.so.6 -- confuses the
redirection machinery and so messes up redirections to
mac_replace_strmem.c, which in turn causes memcheck to report 
spurious errors.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3356
2005-03-14 19:11:10 +00:00
Nicholas Nethercote
a551dd690a Reinstate Addrcheck. Some of the tests fail -- some of the leak ones
because the added VG_(find_root_memory)() is just a stub.  And there's a
problem with overlap checking that I haven't worked out yet.  Still it's a
start.  The commit also brings Memcheck back into the build process,
although mc_main.c is entirely commented out at the moment.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3352
2005-03-14 01:16:05 +00:00
Julian Seward
94c4953bd8 Fix silly bug in munmap-implementation which caused massive leakage of
address space :-)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3311
2005-03-12 20:36:15 +00:00
Nicholas Nethercote
05fe123a9e Update copyright notice for 2005 on all relevant files. Don't bother trying
to be selective about it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3303
2005-03-12 16:22:54 +00:00
Nicholas Nethercote
7fb220d397 Remove dead code.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3296
2005-03-12 06:04:07 +00:00
Julian Seward
0356d27ca6 Merge in changes from the 2.4.0 line. This basically brings in the
overhaul of the thread support.  Many things are now probably broken,
but at least with --tool=none, simple and not-so-simple threaded and
non-thread programs work.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3265
2005-03-10 23:59:00 +00:00
Julian Seward
be6b72b2d3 Various cleanups to revised low-level memory manager.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3253
2005-02-28 14:39:21 +00:00
Julian Seward
f122d86dc0 Further cleanups to low-level memory management. It's still a
conceptual mess and needs a redesign, but this is a start.  Most stuff
now works again.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3247
2005-02-18 08:28:32 +00:00
Julian Seward
353c6ca6c5 Turn off tons of debug printing.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3244
2005-02-16 01:58:51 +00:00
Julian Seward
245173117c Major rewrite of the machinery which keeps track of segments:
* remove initialisation-time circularities by not using the
  skiplist mechanism and therefore not using any dynamically
  allocated memory in support of this mechanism

* Add comments about how it works (it is pretty opaque) so as
  to help future maintainers/bug-fixers

It only just works and many things are still broken.  That should
improve rapidly however.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3242
2005-02-16 01:31:37 +00:00
Julian Seward
efcf1e61ec Complete rewrite (I think this is the 4th incarnation) of translation
table/cache management.  Two main changes.  (1) Translation areas are
recorded using VexGuestExtents, so that Vex is now properly supported
and code deletion works correctly.  (2) Low overhead BB profiling,
enabled by the --profile-flags=<XXXXXXXX> option.  This finds the top
N bbs at exit and shows them, so as to give a basis from which to do
performane tuning.

To support this, the way tt/tc work is changed.  It is still a
sectored arrangement, but now each sector has its own hash table.
This simplifies a lot of things.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3226
2005-01-19 11:55:34 +00:00
Nicholas Nethercote
ce2585d447 Changed message at the top of files, and the startup message, and the
string in valgrind.pc.in, so that they describe Valgrind as a "dynamic
binary instrumentation framework", and don't mention platforms at all.  

I had to tweak the regtest filters a bit for this.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3178
2004-12-01 14:14:42 +00:00
Nicholas Nethercote
61fcb2828d Gave VG_(do_syscall)() a more specific prototype:
Int VG_(do_syscall) ( UInt, UWord, UWord, UWord, UWord, UWord, UWord );

to replace the previous:
  
  Int VG_(do_syscall) ( UInt, ... )

Reason being that sometimes you could get incorrect args passed, when
passing 32-bit ints on 64-bit platforms.  I also added macros
VG_(do_syscall[123456]) to make life easier, and converted all the
relevant calls.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3143
2004-11-29 16:49:18 +00:00
Julian Seward
86ef8a5a44 Get rid of all vestiges of translation-chaining, and generally clean
up and paranoidise the translation cache management.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3134
2004-11-28 16:58:05 +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
Julian Seward
b3498dd85c Merge in enough changes from the old Vex tree to make stage2 link, at
least.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3061
2004-11-22 19:01:47 +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
6a5456bafb 64-bit cleanness tweak.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2928
2004-11-04 19:29:06 +00:00
Nicholas Nethercote
1c674f8d7c Get rid of compile errors and warnings (ahem).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2925
2004-11-04 19:10:43 +00:00
Nicholas Nethercote
6d37450b6f Arch-abstraction: factor out a use of mmap() appropriately.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2923
2004-11-04 18:45:22 +00:00
Nicholas Nethercote
6451cc22a2 64-bit cleanness: lots more replacing of UInt with UWord as necessary.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2920
2004-11-04 18:03:06 +00:00
Nicholas Nethercote
d8fc746ba4 64-bit cleanness: Yet more UInt-->SizeT changes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2910
2004-11-03 18:10:37 +00:00
Nicholas Nethercote
3af1e3e24b 64-bit cleanness: More UInt-->SizeT changes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2909
2004-11-03 17:07:46 +00:00
Nicholas Nethercote
c73601d666 64-bit cleanness:
- Use SizeT instead of UInt for new_mem_stack and all the related functions.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2908
2004-11-02 13:29:50 +00:00
Nicholas Nethercote
c4cf15dc21 Arch-abstraction:
- Added include/x86-linux/ and include/linux/ subdirectories, with Makefile.am
  files.

- Overhauled the definitions of kernel types.  include/vg_kerneliface.h is now
  three files, include/linux/vki.h, include/x86-linux/vki_arch.h, and
  include/x86-linux/vki_arch_posixtypes.h.  These files separate the
  common/Linux and x86/Linux parts cleanly.  All code is copied verbatim from
  the relevant kernel headers, except that VKI_/vki_ prefixes are added as
  necessary to distinguish them from glibc types.  (This is done consistently,
  unlike previously when some types did not have the prefixes.)

  All code is clearly marked to show which particular header file it came from,
  and the Linux version used.  (I used 2.6.8.1, the most recent stable release,
  for all of them.)

  A few of the types changed;  this is because they changed between the older
  versions of Linux and the current 2.6.8.1.  I checked that all these changes
  were ok with respect to backwards compatibility for our purposes.

- vg_unsafe.h has been removed;  we are no longer including any kernel headers,
  as we have our own copies for everything.  This is because installed kernel
  headers are not reliable, and often cause compilation problems. (bug
  #92420 is a recent example)

- Removed some no-longer-needed header-presence tests from configure.in.

- Some code in the rest of Valgrind was changed to account for some slight
  changes in the names of our VKI_/vki_ kernel constants and types.

- Updated README_MISSING_SYSCALL_OR_IOCTL accordingly.

- Fixed off-by-one error with VKI_GDT_ENTRY_TLS_MAX (merged from stable branch)

The end result is that the kernel types situation should be much clearer, and
similar files can be created relatively easily for other architectures as
necessary.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2884
2004-10-31 18:48:21 +00:00
Nicholas Nethercote
4dd0792907 Arch-abstraction:
- removed some x86-specific var/function names


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2843
2004-10-26 09:59:49 +00:00
Nicholas Nethercote
e9bf009719 readability fiddle
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2808
2004-10-19 17:54:02 +00:00
Nicholas Nethercote
cea83425b5 Remove unnecessary #includes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2769
2004-10-14 13:41:28 +00:00
Nicholas Nethercote
eb41aa73c3 Arch-abstraction:
- abstract out some direct naming of registers


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2694
2004-09-11 15:11:47 +00:00
Nicholas Nethercote
d897ba2bd1 To get 32-bit programs working on Opteron, VG_(valgrind_end) was recently
changed to name the last byte in Valgrind's section, rather than one past the
last byte.  This was because the last byte is 0xffffffff, and so one past gave
0x0, which screwed things up.

However, when this change was made, all the places where VG_(valgrind_end) is
used weren't adjusted appropriately.  So this commit makes those adjustments.
It also renames the variable as VG_(valgrind_last), which makes the difference
between it and the other VG_(*_end) variables much clearer.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2672
2004-09-07 23:04:49 +00:00
Nicholas Nethercote
ba210a6364 Arch-abstraction step: renamed "vg_include.h" as "core.h".
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2643
2004-09-01 23:58:16 +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
Nicholas Nethercote
3fb236f86d Fix bug, courtesy of Paul Mackerras: when giving find_map_space an address
lower than that of any existing segment, it got it wrong due to the confusing
SkipList API.  I wonder how many more bugs like that there are...?


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2596
2004-08-23 09:28:37 +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
134268140a Fix typo in comment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2491
2004-07-16 23:07:58 +00:00
Nicholas Nethercote
4e6783677f apostrophe pedantry; comment change only
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2488
2004-07-16 17:32:15 +00:00
Tom Hughes
29a3645022 Add comments to explain the address space padding technology.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2487
2004-07-16 15:36:45 +00:00
Tom Hughes
61fa07e868 Implement support for the async I/O system calls in 2.6 kernels. This
requires padding of the address space around calls to io_setup in order
to constrain the kernel's choice of address for the I/O context.

Based on patch from Scott Smith <scott-kde@gelatinous.com> with various
enhancements, this fixes bug #83060.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2485
2004-07-15 23:13:37 +00:00
Nicholas Nethercote
472d50b40a Merged Valgrind's heap and stack. This has two main advantages:
1. It simplifies various things a bit.

2. Valgrind/tools will run out of memory later than currently in many
circumstances.  This is good news esp. for Calltree.

Some things were going in V's 128MB heap, and some were going in V's 128MB map
segment.  Now all these things are going into a single 256MB map segment.
stage2 has been moved down to 0xb0000000, the start of the 256MB map segment.
The .so files needed by it are placed at 0xb1000000 (that's the map_base).

This required some bootstrapping at startup for memory -- we need to allocate
memory to create the segments skip-list which lets us allocate memory...
solution was to make the first superblock allocated a special static one.
That's pretty simple and enough to get things going.

Removed vg_glibc.c which wasn't doing anything anyway.

Removed VG_(brk) and associated stuff, made all the things that were calling it
call VG_(mmap)() instead.

Removed VG_(valgrind_mmap_end) which was no longer needed.

Rejigged the startup order a bit as necessary.

Moved an important comment from ume.c to vg_main.c where it should be.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2482
2004-07-15 12:59:41 +00:00
Nicholas Nethercote
138739e464 Removed some code from VG_(client_alloc)() that could be left to VG_(mmap)().
Added a comment about stack extension failure.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2476
2004-07-11 18:01:06 +00:00
Nicholas Nethercote
b740e70a9c Whoops, fix comment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2471
2004-07-10 17:27:20 +00:00
Nicholas Nethercote
b88ea45f72 Comment changes only.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2468
2004-07-10 16:59:25 +00:00
Nicholas Nethercote
dac19c41c2 Remove out-of-date comment -- should have been removed when VG_(mmap)() was
changed to accept the sf_flags argument.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2467
2004-07-10 16:57:20 +00:00