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 | |
Elliott Hughes | ed39800 | 2017-06-21 14:41:24 -0700 | [diff] [blame] | 11 | Copyright (C) 2007-2017 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. */ |
florian | 8e3fbb5 | 2014-10-20 19:02:38 +0000 | [diff] [blame] | 38 | Bool HG_(eq_Error) ( VgRes not_used, const Error* e1, const Error* e2 ); |
| 39 | void HG_(before_pp_Error) ( const Error* err ); |
| 40 | void HG_(pp_Error) ( const Error* err ); |
| 41 | UInt HG_(update_extra) ( const Error* err ); |
florian | 19f91bb | 2012-11-10 22:29:54 +0000 | [diff] [blame] | 42 | Bool HG_(recognised_suppression) ( const HChar* name, Supp *su ); |
| 43 | Bool HG_(read_extra_suppression_info) ( Int fd, HChar** bufpp, SizeT* nBufp, |
philippe | 362441d | 2013-07-22 22:00:13 +0000 | [diff] [blame] | 44 | Int* lineno, Supp* su ); |
florian | 8e3fbb5 | 2014-10-20 19:02:38 +0000 | [diff] [blame] | 45 | Bool HG_(error_matches_suppression) ( const Error* err, const Supp* su ); |
| 46 | const HChar* HG_(get_error_name) ( const Error* err ); |
| 47 | SizeT HG_(get_extra_suppression_info) ( const Error* err, |
florian | dbb3584 | 2012-10-27 18:39:11 +0000 | [diff] [blame] | 48 | /*OUT*/HChar* buf, Int nBuf ); |
florian | 8e3fbb5 | 2014-10-20 19:02:38 +0000 | [diff] [blame] | 49 | SizeT HG_(print_extra_suppression_use) ( const Supp* su, |
philippe | 4e32d67 | 2013-10-17 22:10:41 +0000 | [diff] [blame] | 50 | /*OUT*/HChar* buf, Int nBuf ); |
florian | 8e3fbb5 | 2014-10-20 19:02:38 +0000 | [diff] [blame] | 51 | void HG_(update_extra_suppression_use) ( const Error* err, const Supp* su ); |
sewardj | f98e1c0 | 2008-10-25 16:22:41 +0000 | [diff] [blame] | 52 | |
| 53 | /* Functions for recording various kinds of errors. */ |
| 54 | void HG_(record_error_Race) ( Thread* thr, |
sewardj | a781be6 | 2008-12-08 00:12:28 +0000 | [diff] [blame] | 55 | Addr data_addr, Int szB, Bool isWrite, |
sewardj | 23f1200 | 2009-07-24 08:45:08 +0000 | [diff] [blame] | 56 | Thread* h1_confthr, |
| 57 | ExeContext* h1_ct_segstart, |
| 58 | ExeContext* h1_ct_mbsegend ); |
sewardj | f98e1c0 | 2008-10-25 16:22:41 +0000 | [diff] [blame] | 59 | void HG_(record_error_UnlockUnlocked) ( Thread*, Lock* ); |
| 60 | void HG_(record_error_UnlockForeign) ( Thread*, Thread*, Lock* ); |
| 61 | void HG_(record_error_UnlockBogus) ( Thread*, Addr ); |
florian | 6bd9dc1 | 2012-11-23 16:17:43 +0000 | [diff] [blame] | 62 | void HG_(record_error_PthAPIerror) ( Thread*, const HChar*, Word, |
| 63 | const HChar* ); |
sewardj | ffce815 | 2011-06-24 10:09:41 +0000 | [diff] [blame] | 64 | |
philippe | 328d662 | 2015-05-25 17:24:27 +0000 | [diff] [blame] | 65 | /* Function for printing the details about an access */ |
| 66 | void HG_(print_access) (StackTrace ips, UInt n_ips, |
| 67 | Thr* thr_a, |
| 68 | Addr ga, |
| 69 | SizeT SzB, |
| 70 | Bool isW, |
| 71 | WordSetID locksHeldW ); |
| 72 | |
sewardj | ffce815 | 2011-06-24 10:09:41 +0000 | [diff] [blame] | 73 | /* see the implementation for meaning of these params */ |
philippe | 46daf0d | 2014-07-29 20:08:15 +0000 | [diff] [blame] | 74 | void HG_(record_error_LockOrder) ( Thread*, Lock*, Lock*, |
sewardj | ffce815 | 2011-06-24 10:09:41 +0000 | [diff] [blame] | 75 | ExeContext*, ExeContext*, |
| 76 | ExeContext* ); |
| 77 | |
florian | 6bd9dc1 | 2012-11-23 16:17:43 +0000 | [diff] [blame] | 78 | void HG_(record_error_Misc_w_aux) ( Thread*, const HChar* errstr, |
| 79 | const HChar* auxstr, |
| 80 | ExeContext* auxctx ); |
| 81 | void HG_(record_error_Misc) ( Thread* thr, const HChar* errstr ); |
sewardj | 8fef625 | 2010-07-29 05:28:02 +0000 | [diff] [blame] | 82 | |
sewardj | f98e1c0 | 2008-10-25 16:22:41 +0000 | [diff] [blame] | 83 | |
| 84 | /* Statistics pertaining to error management. */ |
| 85 | extern ULong HG_(stats__LockN_to_P_queries); |
| 86 | extern ULong HG_(stats__LockN_to_P_get_map_size) ( void ); |
| 87 | extern ULong HG_(stats__string_table_queries); |
| 88 | extern ULong HG_(stats__string_table_get_map_size) ( void ); |
| 89 | |
sewardj | f98e1c0 | 2008-10-25 16:22:41 +0000 | [diff] [blame] | 90 | #endif /* ! __HG_ERRORS_H */ |
| 91 | |
| 92 | /*--------------------------------------------------------------------*/ |
| 93 | /*--- end hg_errors.h ---*/ |
| 94 | /*--------------------------------------------------------------------*/ |