2 /*--------------------------------------------------------------------*/
3 /*--- Error management for Helgrind. ---*/
4 /*--- hg_errors.h ---*/
5 /*--------------------------------------------------------------------*/
8 This file is part of Helgrind, a Valgrind tool for detecting errors
11 Copyright (C) 2007-2017 OpenWorks Ltd
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.
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.
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, see <http://www.gnu.org/licenses/>.
27 The GNU General Public License is contained in the file COPYING.
34 /* The standard bundle of error management functions that we are
35 required to present to the core/tool interface at startup. */
36 Bool
HG_(eq_Error
) ( VgRes not_used
, const Error
* e1
, const Error
* e2
);
37 void HG_(before_pp_Error
) ( const Error
* err
);
38 void HG_(pp_Error
) ( const Error
* err
);
39 UInt
HG_(update_extra
) ( const Error
* err
);
40 Bool
HG_(recognised_suppression
) ( const HChar
* name
, Supp
*su
);
41 Bool
HG_(read_extra_suppression_info
) ( Int fd
, HChar
** bufpp
, SizeT
* nBufp
,
42 Int
* lineno
, Supp
* su
);
43 Bool
HG_(error_matches_suppression
) ( const Error
* err
, const Supp
* su
);
44 const HChar
* HG_(get_error_name
) ( const Error
* err
);
45 SizeT
HG_(get_extra_suppression_info
) ( const Error
* err
,
46 /*OUT*/HChar
* buf
, Int nBuf
);
47 SizeT
HG_(print_extra_suppression_use
) ( const Supp
* su
,
48 /*OUT*/HChar
* buf
, Int nBuf
);
49 void HG_(update_extra_suppression_use
) ( const Error
* err
, const Supp
* su
);
51 /* Functions for recording various kinds of errors. */
52 void HG_(record_error_Race
) ( Thread
* thr
,
53 Addr data_addr
, Int szB
, Bool isWrite
,
55 ExeContext
* h1_ct_segstart
,
56 ExeContext
* h1_ct_mbsegend
);
57 void HG_(record_error_UnlockUnlocked
) ( Thread
*, Lock
* );
58 void HG_(record_error_UnlockForeign
) ( Thread
*, Thread
*, Lock
* );
59 void HG_(record_error_UnlockBogus
) ( Thread
*, Addr
);
60 void HG_(record_error_PthAPIerror
) ( Thread
*, const HChar
*, Word
,
63 /* Function for printing the details about an access */
64 void HG_(print_access
) (StackTrace ips
, UInt n_ips
,
69 WordSetID locksHeldW
);
71 /* see the implementation for meaning of these params */
72 void HG_(record_error_LockOrder
) ( Thread
*, Lock
*, Lock
*,
73 ExeContext
*, ExeContext
*,
76 void HG_(record_error_Misc_w_aux
) ( Thread
*, const HChar
* errstr
,
79 void HG_(record_error_Misc
) ( Thread
* thr
, const HChar
* errstr
);
81 void HG_(record_error_Dubious_w_aux
) ( Thread
*, const HChar
* errstr
,
84 void HG_(record_error_Dubious
) ( Thread
* thr
, const HChar
* errstr
);
87 /* Statistics pertaining to error management. */
88 extern ULong
HG_(stats__LockN_to_P_queries
);
89 extern ULong
HG_(stats__LockN_to_P_get_map_size
) ( void );
90 extern ULong
HG_(stats__string_table_queries
);
91 extern ULong
HG_(stats__string_table_get_map_size
) ( void );
93 #endif /* ! __HG_ERRORS_H */
95 /*--------------------------------------------------------------------*/
96 /*--- end hg_errors.h ---*/
97 /*--------------------------------------------------------------------*/