blob: 4923c0ee4e8dfad3da575a89394672c8c3ca10a3 [file] [log] [blame]
sewardjf98e1c02008-10-25 16:22:41 +00001
2/*--------------------------------------------------------------------*/
3/*--- Basic definitions for all of Helgrind. ---*/
4/*--- hg_basics.h ---*/
5/*--------------------------------------------------------------------*/
6
7/*
8 This file is part of Helgrind, a Valgrind tool for detecting errors
9 in threaded programs.
10
njn9f207462009-03-10 22:02:09 +000011 Copyright (C) 2007-2009 OpenWorks Ltd
sewardjf98e1c02008-10-25 16:22:41 +000012 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_BASICS_H
33#define __HG_BASICS_H
34
35
36/*----------------------------------------------------------------*/
37/*--- Very basic stuff ---*/
38/*----------------------------------------------------------------*/
39
40#define HG_(str) VGAPPEND(vgHelgrind_,str)
41
42void* HG_(zalloc) ( HChar* cc, SizeT n );
43void HG_(free) ( void* p );
44Char* HG_(strdup) ( HChar* cc, const Char* s );
45
46static inline Bool HG_(is_sane_ThreadId) ( ThreadId coretid ) {
47 return coretid >= 0 && coretid < VG_N_THREADS;
48}
49
50
51/*----------------------------------------------------------------*/
52/*--- Command line options ---*/
53/*----------------------------------------------------------------*/
54
55/* Flags for controlling for which events sanity checking is done */
56#define SCE_THREADS (1<<0) // Sanity check at thread create/join
57#define SCE_LOCKS (1<<1) // Sanity check at lock events
58#define SCE_BIGRANGE (1<<2) // Sanity check at big mem range events
59#define SCE_ACCESS (1<<3) // Sanity check at mem accesses
60#define SCE_LAOG (1<<4) // Sanity check at significant LAOG events
61
62#define SCE_BIGRANGE_T 256 // big mem range minimum size
63
64
65/* Enable/disable lock order checking. Sometimes it produces a lot of
66 errors, possibly genuine, which nevertheless can be very
67 annoying. */
68extern Bool HG_(clo_track_lockorders);
69
70/* When comparing race errors for equality, should the race address be
71 taken into account? For users, no, but for verification purposes
72 (regtesting) this is sometimes important. */
73extern Bool HG_(clo_cmp_race_err_addrs);
74
sewardj849b0ed2008-12-21 10:43:10 +000075/* Show conflicting accesses? This involves collecting and storing
76 large numbers of call stacks just in case we might need to show
77 them later, and so is expensive (although very useful). Hence
78 allow it to be optionally disabled. */
79extern Bool HG_(clo_show_conflicts);
80
81/* Size of the conflicting-access cache, measured in terms of
82 maximum possible number of elements in the previous-access map.
83 Must be between 10k amd 10 million. Default is 1 million. */
84extern UWord HG_(clo_conflict_cache_size);
sewardjf98e1c02008-10-25 16:22:41 +000085
86/* Sanity check level. This is an or-ing of
87 SCE_{THREADS,LOCKS,BIGRANGE,ACCESS,LAOG}. */
88extern Word HG_(clo_sanity_flags);
89
90
91
92
93#endif /* ! __HG_BASICS_H */
94
95/*--------------------------------------------------------------------*/
96/*--- end hg_basics.h ---*/
97/*--------------------------------------------------------------------*/