diff options
author | njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2003-04-21 13:24:40 +0000 |
---|---|---|
committer | njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2003-04-21 13:24:40 +0000 |
commit | 47363aba8fa03b094195bca99fc232ce5f85605d (patch) | |
tree | b9f99a69edf2763943df8aa363b894794118922a /include/valgrind.h | |
parent | 17b85356fd568d03ca49bd9ae81b125e5e116d2f (diff) | |
download | valgrind-47363aba8fa03b094195bca99fc232ce5f85605d.tar.gz |
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 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'include/valgrind.h')
-rw-r--r-- | include/valgrind.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/valgrind.h b/include/valgrind.h index e8359a2d1..b6768f755 100644 --- a/include/valgrind.h +++ b/include/valgrind.h @@ -166,6 +166,10 @@ typedef VG_USERREQ__CLIENT_tstCALL2, VG_USERREQ__CLIENT_tstCALL3, + /* Can be useful in regression testing suites -- eg. can send + Valgrind's output to /dev/null and still count errors. */ + VG_USERREQ__COUNT_ERRORS = 0x1300, + VG_USERREQ__FINAL_DUMMY_CLIENT_REQUEST } Vg_ClientRequest; @@ -271,4 +275,15 @@ typedef }) +/* Counts the number of errors that have been recorded by a skin. Nb: + the skin must record the errors with VG_(maybe_record_error)() or + VG_(unique_error)() for them to be counted. */ +#define VALGRIND_COUNT_ERRORS \ + ({unsigned int _qyy_res; \ + VALGRIND_MAGIC_SEQUENCE(_qyy_res, 0 /* default return */, \ + VG_USERREQ__COUNT_ERRORS, \ + 0, 0, 0, 0); \ + _qyy_res; \ + }) + #endif /* __VALGRIND_H */ |