Commit Graph

550 Commits

Author SHA1 Message Date
Nicholas Nethercote
ed0b56fd2d Removed mc_asm.h, which is no longer needed since Memcheck has no
assembly files any more.  Moved MC_() into mc_include.h.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3692
2005-05-13 21:39:45 +00:00
Julian Seward
2b81a24365 Create a fast version of MC_(helperc_MAKE_STACK_UNINIT), so as not to
slow down call-return intensive amd64 programs too much.  Revised
version is approximately 8 times faster than the naive version.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3689
2005-05-12 23:25:43 +00:00
Julian Seward
a2b0b088db Use the new IRStmt_AbiHints created by the amd64 front end. This
finally makes memcheck able to reliably track the definedness of the
stack on amd64.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3686
2005-05-12 18:05:00 +00:00
Julian Seward
637c341f56 64-bit fix.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3685
2005-05-12 18:02:50 +00:00
Julian Seward
232a4a67f8 Another expected output file.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3684
2005-05-12 18:02:01 +00:00
Julian Seward
81307e483b 64-bit fixes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3683
2005-05-12 18:01:15 +00:00
Julian Seward
775ebbdd34 memmove on glibc on amd64 is over-optimised; replace it.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3680
2005-05-12 17:58:28 +00:00
Julian Seward
77bc562faf When constructing a LeakErr, the (Char*) .string field is abused to
carry an Int.  This is confusing but works on 32-bit platforms; on
64-bit ones, gcc complains about the cast.  This commit adds another
kludge to keep gcc quiet.  Really this should be fixed properly.  The
casting-abuse is 'undone' in case LeakErr in MAC_(pp_Shared_Error).

This should really be fixed properly.  If this .string isn't always
a string, perhaps it should be renamed 'auxword' and turned into a
UWord which is guaranteed castable to/from pointer on any platform.
 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3676
2005-05-12 09:04:06 +00:00
Nicholas Nethercote
247e241160 Modularised the core/tool interface ('details', 'needs' and VG_(tdict))
into a new module m_tooliface.  Pretty straightforward.  Touches a lot
of files because many files use this interface and so need to include
the headers for the new module.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3652
2005-05-10 04:37:01 +00:00
Nicholas Nethercote
eb32bc7045 Modularised the malloc/free stuff into two modules: m_mallocfree for the
malloc/free implementation, and m_replacemalloc with the stuff for the tools
that replace malloc with their own version.  Previously these two areas of
functionality were mixed up somewhat.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3648
2005-05-10 02:47:21 +00:00
Nicholas Nethercote
726615f35d Rename mac_needs.c as mac_shared.c, which is much more sensible and
actually matches mac_shared.h.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3645
2005-05-09 01:13:44 +00:00
Nicholas Nethercote
a08662c48c Big clean-up: changed the core/tool interface to be mediated entirely
through the VG_(tdict) function dictionary, rather than using TL_(foo)
functions.

This facilitated the following changes:

- Removed the "TL_" prefix, which is no longer needed.

- Removed the auto-generated files vg_toolint.[ch], which were no longer
  needed, which simplifies the build a great deal.  Their (greatly
  streamlined) contents went into core.h and vg_needs.h (and will soon
  go into a new module defining the core/tool interface).  
  
  This also meant that tool.h.base reverted to tool.h (so no more
  accidentally editing tool.h and not having the changes go into the
  repo, hooray!)  And gen_toolint.pl was removed.  And toolfuncs.def was
  removed.

- Removed VG_(missing_tool_func)(), no longer used.

- Bumped the core/tool interface major version number to 8.  And I
  killed the minor version number, which was never used.  The layout
  of the ToolInfo struct is such that this should not cause problems.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3644
2005-05-09 01:02:08 +00:00
Nicholas Nethercote
ce67f7fef3 Avoid compiler warnings.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3642
2005-05-08 19:04:53 +00:00
Nicholas Nethercote
020fa40bb0 Moved mc_errcontext.c into mc_main.c, since it was very small and there was
no benefit in having it separate.  This allows some exports to be removed
from mc_include.h.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3641
2005-05-08 18:34:59 +00:00
Nicholas Nethercote
89a26b8f71 Rename some _SIZE macros as _SZB to make their units clear. This change is
in response to a mixed-units (bytes and words) error we had involving
VGA_STACK_REDZONE_SIZE (which is now VGA_STACK_REDZONE_SZB).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3639
2005-05-08 17:49:37 +00:00
Nicholas Nethercote
a8aa721ac9 Add some comments about Param errors, and slightly rewrite a tiny
bit of code in a cleaner way.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3637
2005-05-08 15:26:00 +00:00
Nicholas Nethercote
3c6fd33aff Avoid bogus compiler warning.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3634
2005-05-08 02:59:50 +00:00
Nicholas Nethercote
c9134db6ec Try to fix this test case.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3624
2005-05-06 15:11:04 +00:00
Julian Seward
93d542f1d9 Add expected output file for 64-bit platforms.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3621
2005-05-05 01:37:46 +00:00
Julian Seward
9f22797506 Add expected output files for 64-bit platforms.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3620
2005-05-05 01:32:24 +00:00
Julian Seward
5c34e62c3b Add expected output files for 64-bit platforms.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3619
2005-05-05 01:29:11 +00:00
Julian Seward
af4afafd2a Add expected output files for 64-bit platforms.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3618
2005-05-05 01:23:50 +00:00
Julian Seward
bf6bf8fbbe Move all the 'scalar' (syscall-arg) tests into x86/. In fact they are
really x86-linux specific, but fixing it all properly will have to
wait for another day.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3615
2005-05-04 13:53:00 +00:00
Julian Seward
faa09bd038 Add a new acceptable-output file.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3613
2005-05-04 12:27:48 +00:00
Julian Seward
f9b54012bf Move this test to a more sensible place. Originally it was intended
to check that the threading library hadn't messed up errno.  Now that
doesn't make much sense any more.  Anyway, now it annoyingly fails due
to memcheck reporting bugs in libpthread et al.  Move it to corecheck
so at least it can continue to run and hopefully not continually fail.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3611
2005-05-04 00:26:57 +00:00
Julian Seward
1421c14c3d Fix really stupid bug I introduced during recent 64-bitification of
mc_main.c.  As so often the case, the regtest system saved the day by
being the first to notice this idiocy.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3609
2005-05-03 18:19:05 +00:00
Tom Hughes
390115d009 Don't truncate addresses in error reports.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3608
2005-05-03 18:16:12 +00:00
Julian Seward
af48fdcbc2 Disable this test for the time being, since the functionality it tests
is currently commented out, and may eventually disappear entirely.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3607
2005-05-03 17:45:20 +00:00
Julian Seward
8cc6d78dc7 Fix expected output. It could be that having CFI-based tracebacks
made the stack traces in the error messages less crappy.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3606
2005-05-03 17:36:08 +00:00
Julian Seward
1b5003d2d9 Handle Iop_Neg{8,16,32}.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3601
2005-05-03 12:22:00 +00:00
Julian Seward
e219d86e6d Fix compile warnings on 32-bit platforms, hopefully without breaking
64-bit platforms.  (a.k.a The Portability Game)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3596
2005-05-02 12:53:38 +00:00
Julian Seward
e014d5790a Define N_PRIMARY_MAP to actually generate a 64-bit constant on 64-bit
platforms, otherwise the address-masking operations to establish
alignment and primary-mappability are wrong on 64-bit platforms.

Also set the size of fast-mapped address space on 64-bit platforms to
16G.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3580
2005-04-28 10:32:02 +00:00
Julian Seward
f9156cb08c Reinstate the leak checker; it works at least on x86.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3577
2005-04-27 22:46:36 +00:00
Julian Seward
a7b8e8ea58 Handle various new 64-bit integer primops.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3576
2005-04-27 11:40:27 +00:00
Julian Seward
a4eecff656 * Modify the instrumenter to use the new primops introduced in
vex rev 1144.

* Observe that mkLazy2 generates IR which often turns into 
  long and slow code sequences in the back end, primarily because
  PCast operations are expensive.  Add a couple of special 
  cases which give noticably better performance when handling
  FP-intensive code on x86.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3572
2005-04-26 23:49:24 +00:00
Tom Hughes
3a9a923718 Support the 64 bit comparison instructions which vex is now using.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3570
2005-04-26 07:44:48 +00:00
Julian Seward
c97ba2bbaa Add 64-bit values to the bogus-literal detector.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3548
2005-04-23 23:26:29 +00:00
Julian Seward
78ed655987 Add 64-bit fast case handlers for loads/stores. On amd64,
MC_(helperc_LOADV8) compiles down to just 12 instructions for the
fast-path, which is pretty darn good.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3547
2005-04-23 23:25:49 +00:00
Julian Seward
2c4c0c38f6 Allow memcheck to take account of VGA_STACK_REDZONE_SIZE -- that is,
account for the fact that on amd64 (really, on amd64-linux) the area
up to 128 bytes below the stack pointer is accessible.  This meant
moving the definitions of VGA_STACK_REDZONE_SIZE to tool-visible
places.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3546
2005-04-23 22:42:27 +00:00
Julian Seward
c0967c9762 Handle 8-byte value-check failures using a special fast-case fn (like
0,1,4 sized) rather than the generic one.  Remove size 2 since that
never seems to get used.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3545
2005-04-23 22:38:38 +00:00
Julian Seward
59505fcb00 Add a few cases arising from testing on amd64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3544
2005-04-23 01:14:51 +00:00
Julian Seward
bb89c6cb32 Tidy up: remove lots of old code, rearrange order of functions
somewhat.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3543
2005-04-22 21:10:28 +00:00
Julian Seward
79354c6b5b mc_LOADVn_slow: When loading from invalid addresses, mark loaded data
as defined.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3542
2005-04-22 20:23:27 +00:00
Julian Seward
7cad1b7f65 Mostly finish fixing fast-path cases. Also enhance sanity checking.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3541
2005-04-22 16:29:19 +00:00
Julian Seward
85e8c334b8 Finish off fast cases for {LOAD,STORE}V{4,2,1} and do an inspection of
it.  Do fast cases for make_aligned_word32_{noaccess,writable}.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3540
2005-04-21 22:16:29 +00:00
Julian Seward
5c01cb38f1 * Crank up the memcheck event-counting system, and enhance it to
name the events, rather than just number them, which makes it a
  lot easier to use

* Based on that, fill in some fast-path cases 
  {LOAD,STORE}V{4,2,1}.  The assembly code looks about the same
  length as it did before, on x86.  Fast-path cases for the
  stack have yet to be done.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3538
2005-04-21 17:34:00 +00:00
Julian Seward
2d1062ccdb Fix a bunch of 64-bit cases required amd64. Stop to ponder whether
there is a better way to handle the 'pessimising cast' family of
operations in such a way that Vex's back-end instruction selectors can
generate better code than they do now, with less verbosity and general
confusingness in the insn selectors.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3536
2005-04-20 22:31:26 +00:00
Julian Seward
fbc1c4c2ff Initial rehash of Memcheck's shadow-space management to support both
32- and 64-bit targets, little- and big-endian.  It does more or less
work on x86 as-is, although is unusably slow since I have knocked out
all the fast-path cases and am concentrating on getting the baseline
functionality correct.  The fast cases will go back in in due course.

The fundamental idea is to retain the old 2-level indexing for speed,
even on a 64-bit target.  Since that's clearly unviable on a 64-bit
target, the primary map handles only first N gigabytes of address
space (probably to be set to 16, 32 or 64G).  Addresses above that are
handled slowly using an auxiliary primary map which explicitly lists
(base, &-of-secondary-map) pairs.  The goal is to have the
address-space-manager try and put everything below the 16/32/64G
boundary, so we hit the fast cases almost all the time.

Performance of the 32-bit case should be unaffected since the fast map
will always cover at least the lowest 4G of address space.

There are many word-size and endianness cleanups.

Jeremy's distinguished-map space-compression scheme is retained, in
modified form, as it is simple and seems effective at reducing
Memcheck's space use.

Note this is all subject to rapid change.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3535
2005-04-20 14:44:11 +00:00
Julian Seward
94ee81b0b9 Add a missing case. I guess it can't have been wildly popular :-)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3496
2005-04-01 20:20:12 +00:00
Nicholas Nethercote
f1f707c7b2 This change reduces the number of calls to dlsym() when loading tools from a
lot to one.  This required two basic changes.

1. Tools are responsible for telling the tool about any functions they
provide that the tool may call.  This includes basic functions like
TL_(instrument)(), functions that assist core services such as
TL_(pp_Error)(), and malloc-replacement-related functions like
TL_(malloc)().  

2. Tools that replace malloc now specify the size of the heap block redzones
through an arg to the VG_(malloc_funcs)() function, rather than with a
variable VG_(vg_malloc_redzone_szB).

One consequence of these changes is that VG_(tool_init_dlsym)() no longer
needs to be generated by gen_toolint.pl.

There are a number of further improvements that could follow on from this one.
- Avoid the confusingly different definitions of the TL_() macro in the
  core vs. for tools.  Indeed, the functions provided by the tools now don't
  need to use the TL_() macro at all, as they can have arbitrary names.
- Remove a lot of the auto-generated stuff in vg_toolint.c and vg_toolint.h
  (indeed, it might be possible to not auto-generate these at all, which
  would be nice).
- The handling of VgToolInterface is currently split across vg_needs.c and
  vg_toolint.c, which isn't nice.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3487
2005-03-31 04:37:24 +00:00