sewardj | f98e1c0 | 2008-10-25 16:22:41 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
| 3 | /*--- Error management for Helgrind. ---*/ |
| 4 | /*--- hg_errors.h ---*/ |
| 5 | /*--------------------------------------------------------------------*/ |
| 6 | |
| 7 | /* |
| 8 | This file is part of Helgrind, a Valgrind tool for detecting errors |
| 9 | in threaded programs. |
| 10 | |
sewardj | 9eecbbb | 2010-05-03 21:37:12 +0000 | [diff] [blame^] | 11 | Copyright (C) 2007-2010 OpenWorks Ltd |
sewardj | f98e1c0 | 2008-10-25 16:22:41 +0000 | [diff] [blame] | 12 | info@open-works.co.uk |
| 13 | |
| 14 | This program is free software; you can redistribute it and/or |
| 15 | modify it under the terms of the GNU General Public License as |
| 16 | published by the Free Software Foundation; either version 2 of the |
| 17 | License, or (at your option) any later version. |
| 18 | |
| 19 | This program is distributed in the hope that it will be useful, but |
| 20 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 22 | General Public License for more details. |
| 23 | |
| 24 | You should have received a copy of the GNU General Public License |
| 25 | along with this program; if not, write to the Free Software |
| 26 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 27 | 02111-1307, USA. |
| 28 | |
| 29 | The GNU General Public License is contained in the file COPYING. |
| 30 | */ |
| 31 | |
| 32 | #ifndef __HG_ERRORS_H |
| 33 | #define __HG_ERRORS_H |
| 34 | |
| 35 | |
| 36 | /* The standard bundle of error management functions that we are |
| 37 | required to present to the core/tool interface at startup. */ |
sewardj | 2411849 | 2009-07-15 14:50:02 +0000 | [diff] [blame] | 38 | Bool HG_(eq_Error) ( VgRes not_used, Error* e1, Error* e2 ); |
| 39 | void HG_(before_pp_Error) ( Error* err ); |
| 40 | void HG_(pp_Error) ( Error* err ); |
| 41 | UInt HG_(update_extra) ( Error* err ); |
sewardj | f98e1c0 | 2008-10-25 16:22:41 +0000 | [diff] [blame] | 42 | Bool HG_(recognised_suppression) ( Char* name, Supp *su ); |
njn | 35db56c | 2009-07-24 07:38:29 +0000 | [diff] [blame] | 43 | Bool HG_(read_extra_suppression_info) ( Int fd, Char** bufpp, SizeT* nBufp, |
sewardj | f98e1c0 | 2008-10-25 16:22:41 +0000 | [diff] [blame] | 44 | Supp* su ); |
| 45 | Bool HG_(error_matches_suppression) ( Error* err, Supp* su ); |
| 46 | Char* HG_(get_error_name) ( Error* err ); |
sewardj | 588adef | 2009-08-15 22:41:51 +0000 | [diff] [blame] | 47 | Bool HG_(get_extra_suppression_info) ( Error* err, |
| 48 | /*OUT*/Char* buf, Int nBuf ); |
sewardj | f98e1c0 | 2008-10-25 16:22:41 +0000 | [diff] [blame] | 49 | |
| 50 | /* Functions for recording various kinds of errors. */ |
| 51 | void HG_(record_error_Race) ( Thread* thr, |
sewardj | a781be6 | 2008-12-08 00:12:28 +0000 | [diff] [blame] | 52 | Addr data_addr, Int szB, Bool isWrite, |
sewardj | 23f1200 | 2009-07-24 08:45:08 +0000 | [diff] [blame] | 53 | Thread* h1_confthr, |
| 54 | ExeContext* h1_ct_segstart, |
| 55 | ExeContext* h1_ct_mbsegend ); |
sewardj | f98e1c0 | 2008-10-25 16:22:41 +0000 | [diff] [blame] | 56 | void HG_(record_error_UnlockUnlocked) ( Thread*, Lock* ); |
| 57 | void HG_(record_error_UnlockForeign) ( Thread*, Thread*, Lock* ); |
| 58 | void HG_(record_error_UnlockBogus) ( Thread*, Addr ); |
| 59 | void HG_(record_error_PthAPIerror) ( Thread*, HChar*, Word, HChar* ); |
| 60 | void HG_(record_error_LockOrder) ( Thread*, Addr, Addr, |
| 61 | ExeContext*, ExeContext* ); |
| 62 | void HG_(record_error_Misc) ( Thread*, HChar* ); |
| 63 | |
| 64 | /* Statistics pertaining to error management. */ |
| 65 | extern ULong HG_(stats__LockN_to_P_queries); |
| 66 | extern ULong HG_(stats__LockN_to_P_get_map_size) ( void ); |
| 67 | extern ULong HG_(stats__string_table_queries); |
| 68 | extern ULong HG_(stats__string_table_get_map_size) ( void ); |
| 69 | |
sewardj | 095d61e | 2010-03-11 13:43:18 +0000 | [diff] [blame] | 70 | /* For error creation: map 'data_addr' to a malloc'd chunk, if any. |
| 71 | Slow linear search. This is an abuse of the normal file structure |
| 72 | since this is exported by hg_main.c, not hg_errors.c. Oh Well. */ |
| 73 | void HG_(mm_find_containing_block)( /*OUT*/ExeContext** where, |
| 74 | /*OUT*/Addr* payload, |
| 75 | /*OUT*/SizeT* szB, |
| 76 | Addr data_addr ); |
| 77 | |
sewardj | f98e1c0 | 2008-10-25 16:22:41 +0000 | [diff] [blame] | 78 | #endif /* ! __HG_ERRORS_H */ |
| 79 | |
| 80 | /*--------------------------------------------------------------------*/ |
| 81 | /*--- end hg_errors.h ---*/ |
| 82 | /*--------------------------------------------------------------------*/ |