Commit Graph

876 Commits

Author SHA1 Message Date
Julian Seward
72e5cd5ce5 Add \n in failure message.
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1571
2003-04-27 23:46:21 +00:00
Julian Seward
fbf2533776 Don't trash %eflags before snapshotting the state of the machine at
startup.  I don't know if this is actually of interest, since surely
the flags are not live at the point where the section's .init function
is called, but still, it's a form of state pollution.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1570
2003-04-27 22:23:23 +00:00
Julian Seward
284654f749 Add __NR_prctl.
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1569
2003-04-26 22:55:12 +00:00
Julian Seward
14a09cb25e report_and_quit: Tell people to look at the FAQ.txt for advice.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1568
2003-04-26 22:36:42 +00:00
Julian Seward
89b48351b8 Don't call VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH) if all we're doing
is exiting normally.  There's no point, and it causes breakage when
programs which write their environment variables, finish normally.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1567
2003-04-26 22:29:25 +00:00
Julian Seward
a01d8e81df Add FAQ entry re apparent space leaks in the STL.
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1565
2003-04-26 22:23:35 +00:00
Julian Seward
85291a44d9 Support kernels >= 2.5.68 (Anders Gustafsson <andersg@0x63.nu>)
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1564
2003-04-26 21:49:40 +00:00
Julian Seward
a6194ccaea Add __NR_lookup_dcookie, whatever that might be.
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1563
2003-04-26 21:46:16 +00:00
Julian Seward
c1be97aff0 Merge patch from Josef Weidendorfer <Josef.Weidendorfer@gmx.de>:
Read symbols from both "symtab" and "dynsym" sections, rather than
merely from the one that comes last in the file.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1562
2003-04-26 21:42:09 +00:00
Julian Seward
76ffe12471 Add possibly-bogus implementations for __libc_current_sigrtmin,
__libc_current_sigrtmax and __libc_allocate_rtsig.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1561
2003-04-26 21:19:53 +00:00
Julian Seward
ac403fbc41 Fix compilation on glibc-2.1.X.
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1560
2003-04-26 21:04:42 +00:00
Julian Seward
4efd705c4b Fix threading problems on glibc-2.3.2 or later. Note this is *not*
NPTL support.

The behaviour of weak vs strong symbols seems to have changed in
glibc-2.3.2.  This caused problems in coregrind/vg_intercept.c,
wherein strong symbols in vg_libpthread.c were intended to
override weak symbols in vg_intercept.c, in order to give alternative
thread-safe implementations of some functions, poll(), select(), etc.

The change involves moving the nonblocking implementations of poll, etc
into vg_intercept.c, renaming them to (eg)  VGR_(poll), and routing
all calls to poll to VGR_(poll) [dually for other such fns].  This
means even single-threaded programs now use these functions, but
that doesn't strike me as harmful.

MERGE TO STABLE, if it doesn't break anything


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1559
2003-04-26 20:11:15 +00:00
Nicholas Nethercote
e40dd39e04 wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1558
2003-04-25 21:38:23 +00:00
Nicholas Nethercote
c9acb6f0d2 Fixed
Fixed bug in strncpy() and strncat() -- they were giving the right answers, but
could read the (n+1)th char, which could possibly be inaccessible.  Thanks to
Adam Gundy <arg@cyberscience.com> for spotting it.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1557
2003-04-25 21:37:20 +00:00
Nicholas Nethercote
4e3c15f4a6 Added a return value (0) for the LOGMESSAGE request, since it's now visible to
skins.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1556
2003-04-25 16:07:11 +00:00
Nicholas Nethercote
4f1b2c3adc Added syscall creat(), courtesy of Tom Hughes <thh@cyberscience.com>.
Weird that it's never come up before, everyone must use open() in preference.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1555
2003-04-24 18:14:11 +00:00
Dirk Mueller
e91178ac88 correct expected stdout. prepare must NOT run twice!
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1554
2003-04-24 01:02:35 +00:00
Dirk Mueller
04fe80c7e2 be a bit more libc tolerant
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1553
2003-04-24 01:01:01 +00:00
Dirk Mueller
92ca30fb7f fix sigaltstack regression test to be more glibc-version tolerant
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1552
2003-04-24 00:40:38 +00:00
Nicholas Nethercote
dc0fe27537 Changed things so that the regression test script (vg_regtest) is no longer
installed, as it was silly since the reg tests themselves aren't installed.
Updated the "make regtest" target to use the uninstalled version in tests/.

Also, vg_regtest now no longer uses the installed version of Valgrind to do the
testing, but instead coregrind/valgrind.  This means that you don't have to do
make install with your buggy changes before running the regtests on them :)

I even updated the RPM package .spec file!

Thanks to Dirk M�ller for the suggestion.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1551
2003-04-23 21:48:20 +00:00
Julian Seward
68c23c28d2 Record the correct address of the initial thread's stack, as determined
by the initial scan of /proc/self/maps, so that we correctly identify
addresses in it.  This fix is thanks to Dirk Mueller.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1550
2003-04-23 21:18:52 +00:00
Julian Seward
e033e52c19 Change the version "number" to something less confusing, since we are
not (yet) making releases from this branch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1549
2003-04-23 21:17:24 +00:00
Nicholas Nethercote
64ece9aa70 wibbles
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1548
2003-04-23 17:49:09 +00:00
Nicholas Nethercote
dd6eacf7ff Now counting tests and stdout failures and stderr failures separately and
correctly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1547
2003-04-23 17:47:13 +00:00
Dirk Mueller
9728df8ca7 the error is in line 13, not in line 15
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1546
2003-04-23 17:03:34 +00:00
Dirk Mueller
ba862b918e - fix regression tests counting
- unset $VALGRIND_OPTS (fixes 6 testsuite failures)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1545
2003-04-23 16:52:06 +00:00
Dirk Mueller
edce114946 always run check before regtest
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1544
2003-04-23 16:39:31 +00:00
Nicholas Nethercote
aa8fbe8dd9 wibble 2
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1543
2003-04-23 07:35:56 +00:00
Nicholas Nethercote
6525b9a6c6 wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1542
2003-04-23 07:33:05 +00:00
Julian Seward
45641c5fc2 Majorly update and expand, adding workarounds for more or less all
failures with known workarounds.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1541
2003-04-22 23:26:24 +00:00
Nicholas Nethercote
e7b23faa99 Implemented malloc_usable_size(), which was used in a program written by
Frederic Delley <fdelley@cisco.com>.

This required also adding VG_(arena_payload_szB)().


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1540
2003-04-22 22:45:55 +00:00
Nicholas Nethercote
a00a117591 According to Greg Hosler <hosler@lugs.org.sg>, these entries need to be added,
otherwise rpm on RH9 will complain that these files are in the payload area,
but not saved to the rpm.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1539
2003-04-22 21:47:56 +00:00
Nicholas Nethercote
092c9b944b Added "Int exitcode" argument to SK_(fini)(), because it could be useful
for skins.

Changed lackey to print out the exit code.

Changed AUTOMAKE_OPTIONS back to 1.5 (whoops)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1538
2003-04-22 21:41:40 +00:00
Nicholas Nethercote
2fc8530d61 Re-added the FAQ that was lost a while back, possibly when I did the original
core/skin split.  Added a couple more questions+answers.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1537
2003-04-22 20:58:47 +00:00
Nicholas Nethercote
994eea589d Fixed minor boo-boo
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1536
2003-04-22 20:58:02 +00:00
Nicholas Nethercote
b7066c5c93 In my big malloc-out-of-core changes of last week, I broke Helgrind by
forgetting to change one of the skin functions.  It ran fine until it tried to
generate an error message, whereupon it complained about a missing skin
function.  (We should really have more than one regression test for
Helgrind...)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1535
2003-04-21 22:04:03 +00:00
Nicholas Nethercote
2b1c838711 Renamed VG_NON_SIMD_CALL1 (and friends) as VALGRIND_NON_SIMD_CALL1 to be
consistent with the names of the other client requests.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1534
2003-04-21 13:30:55 +00:00
Nicholas Nethercote
1b48c55fc5 Added two client requests: VALGRIND_COUNT_ERRORS and VALGRIND_COUNT_LEAKS.
The first returns the number of errors found so far, and is a core request.
The second returns the number of bytes found
reachable/dubious/leaked/suppressed by all leak checks so far, for Memcheck and
Addrcheck.

Both are useful for using Valgrind in regression test suites where multiple
tests are present in a single file -- one can run Valgrind with no output
(using --logfile-fd=-1) and use the requests after each test to determine if
any errors happened.

Had to rename and make public vg_n_errs_found --> VG_(n_errs_found) to do so.
Nb: leak errors are not counted as errors for the purposes of
VALGRIND_COUNT_ERRORS.  This was decided as the best thing to do after
discussion with Olly Betts, who original suggested these changes.

Pulled out common client request code shared between Memcheck and Addrcheck.

Added a regression test for this.

Added some documentation too.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1533
2003-04-21 13:24:40 +00:00
Nicholas Nethercote
df7e5ac5ec Better way to specify where gdb is -- now GDB_PATH is defined in config.h,
which is global, rather than passing it in with -D to the file that needed it.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1532
2003-04-18 12:54:24 +00:00
Dirk Mueller
d98a4aa5f4 be autoconf 2.13 compatible
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1531
2003-04-17 17:38:45 +00:00
Dirk Mueller
02b63b3ba8 reapply automake fixes. make check will now generate the binaries which
are only required for regression testing.

If this breaks something, please mail me first instead of reverting.
Thank you.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1530
2003-04-17 17:00:43 +00:00
Dirk Mueller
0c1d7aa7f6 fix make distcheck by properly implementing the NPTL configure check.
Dear users who still use Redhat: please test if this still works.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1529
2003-04-17 16:58:03 +00:00
Nicholas Nethercote
41cb5c62fe The location of gdb is now determined by the 'configure' script, instead
of being hard-wired at /usr/bin/gdb.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1528
2003-04-16 20:50:50 +00:00
Nicholas Nethercote
d2168aca37 wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1527
2003-04-16 20:09:47 +00:00
Nicholas Nethercote
ac7027c441 Updated copyright notices for 2003. Only 4 months late.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1526
2003-04-15 14:58:06 +00:00
Nicholas Nethercote
7a03be02b3 Namespace police
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1525
2003-04-15 14:09:58 +00:00
Nicholas Nethercote
982fa6481a -----------------------------------------------------------------------------
overview
-----------------------------------------------------------------------------
Previously Valgrind had its own versions of malloc() et al that replaced
glibc's.  This is necessary for various reasons for Memcheck, but isn't needed,
and was actually detrimental, to some other skins.  I never managed to treat
this satisfactorily w.r.t the core/skin split.

Now I have.  If a skin needs to know about malloc() et al, it must provide its
own replacements.  But because this is not uncommon, the core provides a module
vg_replace_malloc.c which a skin can link with, which provides skeleton
definitions, to reduce the amount of work a skin must do.  The skeletons handle
the transfer of control from the simd CPU to the real CPU, and also the
--alignment, --sloppy-malloc and --trace-malloc options.  These skeleton
definitions subsequently call functions SK_(malloc), SK_(free), etc, which the
skin must define;  in these functions the skin can do the things it needs to do
about tracking heap blocks.

For skins that track extra info about malloc'd blocks -- previously done with
ShadowChunks -- there is a new file vg_hashtable.c that implements a
generic-ish hash table (using dodgy C-style inheritance using struct overlays)
which allows skins to continue doing this fairly easily.

Skins can also replace other functions too, eg. Memcheck has its own versions
of strcpy(), memcpy(), etc.

Overall, it's slightly more work now for skins that need to replace malloc(),
but other skins don't have to use Valgrind's malloc(), so they're getting a
"purer" program run, which is good, and most of the remaining rough edges from
the core/skin split have been removed.

-----------------------------------------------------------------------------
details
-----------------------------------------------------------------------------
Moved malloc() et al intercepts from vg_clientfuncs.c into vg_replace_malloc.c.
Skins can link to it if they want to replace malloc() and friends;  it does
some stuff then passes control to SK_(malloc)() et al which the skin must
define.  They can call VG_(cli_malloc)() and VG_(cli_free)() to do the actual
allocation/deallocation.  Redzone size for the client (the CLIENT arena) is
specified by the static variable VG_(vg_malloc_redzone_szB).
vg_replace_malloc.c thus represents a kind of "mantle" level service.

To get automake to build vg_replace_malloc.o, had to resort to a similar trick
as used for the demangler -- ask for a "no install" library (which is never
used) to be built from it.

Note that all malloc, calloc, realloc, builtin_new, builtin_vec_new, memalign
are now aware of --alignment, when running on simd CPU or real CPU.

This means the new_mem_heap, die_mem_heap, copy_mem_heap and ban_mem_heap
events no longer exist, since the core doesn't control malloc() any more, and
skins can watch for these events themselves.

This required moving all the ShadowChunk stuff out of the core, which meant
the sizeof_shadow_block ``need'' could be removed, yay -- it was a horrible
hack.  Now ShadowChunks are done with a generic HashTable type, in
vg_hashtable.c, which skins can "inherit from" (in a dodgy C-only fashion by
using structs with similar layouts).  Also, the free_list stuff was all moved
as a part of this.  Also, VgAllocKind was moved out of core into
Memcheck/Addrcheck and renamed MAC_AllocKind.

Moved these options out of core into vg_replace_malloc.c:
    --trace-malloc
    --sloppy-malloc
    --alignment

The alternative_free ``need'' could go, too, since Memcheck is now in complete
control of free(), yay -- another horribility.

The bad_free and free_mismatch events could go too, since they're now not
detected by core, yay -- yet another horribility.

Moved malloc() et al wrappers for Memcheck out of vg_clientmalloc.c into
mac_malloc_wrappers.c.  Helgrind has its own wrappers now too.

Introduced VG_USERREQ__CLIENT_CALL[123] client requests.  When a skin function
is operating on the simd CPU, this will call a given function and run it on the
real CPU.  The macros VG_NON_SIMD_CALL[123] in valgrind.h present a cleaner
interface to actually use.  Also introduce analogues of these that pass 'tst'
from the scheduler as the first arg to the called function -- needed for
MC_(client_malloc)() et al.

Fiddled with USERREQ_{MALLOC,FREE} etc. in vg_scheduler.c; they call
SK_({malloc,free})() which by default call VG_(cli_malloc)() -- can't call
glibc's malloc() here.  All the other default SK_(calloc)() etc. instantly
panic; there's a lock variable to ensure that the default SK_({malloc,free})()
are only called from the scheduler, which prevents a skin from forgetting to
override SK_({malloc,free})().  Got rid of the unused USERREQ_CALLOC,
USERREQ_BUILTIN_NEW, etc.

Moved special versions of strcpy/strlen, etc, memcpy() and memchr() into
mac_replace_strmem.c -- they are only necessary for memcheck, because the
hyper-optimised normal glibc versions confuse it, and for memcpy() etc. overlap
checking.

Also added dst/src overlap checks to strcpy(), memcpy(), strcat().  They are
reported not as proper errors, but just with single line warnings, as for silly
args to malloc() et al;  this is mainly because they're on the simulated CPU
and proper error handling would be a pain;  hopefully they're rare enough to
not be a problem.  The strcpy check is done after the copy, because it would
require counting the length of the string beforehand.  Also added strncpy() and
strncat(), which have overlap checks too.  Note that addrcheck doesn't do
overlap checking.

Put USERREQ__LOGMESSAGE in vg_skin.h to do the overlap check error messages.

After removing malloc() et al and strcpy() et al out of vg_clientfuncs.c, moved
the remaining three things (sigsuspend, VG_(__libc_freeres_wrapper),
__errno_location) into vg_intercept.c, since it contains things that run on the
simulated CPU too.  Removed vg_clientfuncs.c altogether.

Moved regression test "malloc3" out of corecheck into memcheck, since corecheck
no longer looks for silly (eg. negative) args to malloc().

Removed the m_eip, m_esp, m_ebp fields from the `Error' type.  They were being
set up, and then read immediately only once, only if GDB attachment was done.
So now they're just being held in local variables.  This saves 12 bytes per
Error.

Made replacement calloc() check for --sloppy-malloc;  previously it didn't.

Added "silly" negative size arg check to realloc(), it didn't have one.

Changed VG_(read_selfprocmaps)() so it can parse the file directly, or from a
previously read buffer.  Buffer can be filled with the new
VG_(read_selfprocmaps_contents)().  Using this at start-up to snapshot
/proc/self/maps before the skins do anything, and then parsing it once they
have done their setup stuff.  Skins can now safely call VG_(malloc)() in
SK_({pre,post}_clo_init)() without the mmap'd superblock erroneously being
identified as client memory.

Changed the --help usage message slightly, now divided into four sections: core
normal, skin normal, core debugging, skin debugging.  Changed the interface for
the command_line_options need slightly -- now two functions, VG_(print_usage)()
and VG_(print_debug_usage)(), and they do the printing themselves, instead of
just returning a string -- that's more flexible.

Removed DEBUG_CLIENTMALLOC code, it wasn't being used and was a pain.

Added a regression test testing leak suppressions (nanoleak_supp), and another
testing strcpy/memcpy/etc overlap warnings (overlap).

Also changed Addrcheck to link with the files shared with Memcheck, rather than
#including the .c files directly.

Commoned up a little more shared Addrcheck/Memcheck code, for the usage
message, and initialisation/finalisation.

Added a Bool param to VG_(unique_error)() dictating whether it should allow
GDB to be attached; for leak checks, because we don't want to attach GDB on
leak errors (causes seg faults).  A bit hacky, but it will do.

Had to change lots of the expected outputs from regression files now that
malloc() et al are in vg_replace_malloc.c rather than vg_clientfuncs.c.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1524
2003-04-15 13:03:23 +00:00
Nicholas Nethercote
230a216353 wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1523
2003-04-08 12:06:51 +00:00
Nicholas Nethercote
3cc0c8f8fa Minor HTML fixes in docs, thanks to Arnaud Desitter.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1522
2003-04-08 11:08:45 +00:00
Nicholas Nethercote
7332367dab Added a Makefile target for running the regression tests.
Use "make regtest" to run them now.  (It just runs
'$PREFIX/bin/vg_regtest --all')


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1521
2003-04-08 10:29:13 +00:00