valgrind_help.h

00001 /*<std-header orig-src='shore' incl-file-exclusion='W_BASE_H'>
00002 
00003  $Id: valgrind_help.h,v 1.2 2010/05/26 01:20:22 nhall Exp $
00004 
00005 SHORE -- Scalable Heterogeneous Object REpository
00006 
00007 Copyright (c) 1994-99 Computer Sciences Department, University of
00008                       Wisconsin -- Madison
00009 All Rights Reserved.
00010 
00011 Permission to use, copy, modify and distribute this software and its
00012 documentation is hereby granted, provided that both the copyright
00013 notice and this permission notice appear in all copies of the
00014 software, derivative works or modified versions, and any portions
00015 thereof, and that both notices appear in supporting documentation.
00016 
00017 THE AUTHORS AND THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY
00018 OF WISCONSIN - MADISON ALLOW FREE USE OF THIS SOFTWARE IN ITS
00019 "AS IS" CONDITION, AND THEY DISCLAIM ANY LIABILITY OF ANY KIND
00020 FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
00021 
00022 This software was developed with support by the Advanced Research
00023 Project Agency, ARPA order number 018 (formerly 8230), monitored by
00024 the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518.
00025 Further funding for this work was provided by DARPA through
00026 Rome Research Laboratory Contract No. F30602-97-2-0247.
00027 
00028 */
00029 
00030 #ifndef VALGRIND_HELP_H
00031 #define VALGRIND_HELP_H
00032 
00033 #include "w_defines.h"
00034 
00035 /*  -- do not edit anything above this line --   </std-header>*/
00036 
00037 /**\cond skip */
00038 
00039 #include <sys/types.h>
00040 
00041 class valgrind_check
00042 {
00043     int  _current_errors;
00044     int  _errors_last_check;
00045     int  _check_failed;
00046 
00047 public:
00048     valgrind_check(): _current_errors(0),
00049                         _errors_last_check(0), _check_failed(0) {}
00050 
00051     void check() {
00052         _current_errors = VALGRIND_COUNT_ERRORS;
00053         _check_failed = _current_errors - _errors_last_check;
00054         if(_check_failed > 0) {
00055             _errors_last_check = _current_errors;
00056         }
00057     }
00058     bool more() const { return (_check_failed>0); }
00059     int diff() const { return _check_failed; }
00060     int curr() const { return _current_errors; }
00061     int prev() const { return _current_errors - _check_failed; } };
00062 
00063 
00064 extern "C" void stop_on_vg_err();
00065 extern "C" void check_valgrind_errors(int l, const char *f);
00066 extern "C" void check_definedness(void *v, size_t len);
00067 
00068 /**\endcond skip */
00069 
00070 #endif  /* VALGRIND_HELP_H */

Generated on Wed Jul 7 17:22:32 2010 for Shore Storage Manager by  doxygen 1.4.7