blob: e736186d6c7d3711d82857132fa48fa917fe68e7 [file] [log] [blame]
sewardjb4112022007-11-09 22:49:28 +00001/*
2 ----------------------------------------------------------------
3
4 Notice that the above BSD-style license applies to this one file
5 (helgrind.h) only. The entire rest of Valgrind is licensed under
6 the terms of the GNU General Public License, version 2. See the
7 COPYING file in the source distribution for details.
8
9 ----------------------------------------------------------------
10
11 This file is part of Helgrind, a Valgrind tool for detecting errors
12 in threaded programs.
13
sewardj4d474d02008-02-11 11:34:59 +000014 Copyright (C) 2007-2008 OpenWorks LLP
sewardjb4112022007-11-09 22:49:28 +000015 info@open-works.co.uk
16
17 Redistribution and use in source and binary forms, with or without
18 modification, are permitted provided that the following conditions
19 are met:
20
21 1. Redistributions of source code must retain the above copyright
22 notice, this list of conditions and the following disclaimer.
23
24 2. The origin of this software must not be misrepresented; you must
25 not claim that you wrote the original software. If you use this
26 software in a product, an acknowledgment in the product
27 documentation would be appreciated but is not required.
28
29 3. Altered source versions must be plainly marked as such, and must
30 not be misrepresented as being the original software.
31
32 4. The name of the author may not be used to endorse or promote
33 products derived from this software without specific prior written
34 permission.
35
36 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
37 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
38 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
40 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
41 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
42 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
44 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
45 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
46 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47
48 ----------------------------------------------------------------
49
50 Notice that the above BSD-style license applies to this one file
51 (helgrind.h) only. The entire rest of Valgrind is licensed under
52 the terms of the GNU General Public License, version 2. See the
53 COPYING file in the source distribution for details.
54
55 ----------------------------------------------------------------
56*/
57
58#ifndef __HELGRIND_H
59#define __HELGRIND_H
60
61#include "valgrind.h"
62
63typedef
64 enum {
65 VG_USERREQ__HG_CLEAN_MEMORY = VG_USERREQ_TOOL_BASE('H','G'),
66
67 /* The rest are for Helgrind's internal use. Not for end-user
68 use. Do not use them unless you are a Valgrind developer. */
69
70 /* Notify the tool what this thread's pthread_t is. */
71 _VG_USERREQ__HG_SET_MY_PTHREAD_T = VG_USERREQ_TOOL_BASE('H','G')
72 + 256,
73 _VG_USERREQ__HG_PTH_API_ERROR, /* char*, int */
74 _VG_USERREQ__HG_PTHREAD_JOIN_POST, /* pthread_t of quitter */
75 _VG_USERREQ__HG_PTHREAD_MUTEX_INIT_POST, /* pth_mx_t*, long mbRec */
76 _VG_USERREQ__HG_PTHREAD_MUTEX_DESTROY_PRE, /* pth_mx_t* */
77 _VG_USERREQ__HG_PTHREAD_MUTEX_UNLOCK_PRE, /* pth_mx_t* */
78 _VG_USERREQ__HG_PTHREAD_MUTEX_UNLOCK_POST, /* pth_mx_t* */
79 _VG_USERREQ__HG_PTHREAD_MUTEX_LOCK_PRE, /* pth_mx_t*, long isTryLock */
80 _VG_USERREQ__HG_PTHREAD_MUTEX_LOCK_POST, /* pth_mx_t* */
81 _VG_USERREQ__HG_PTHREAD_COND_SIGNAL_PRE, /* pth_cond_t* */
82 _VG_USERREQ__HG_PTHREAD_COND_BROADCAST_PRE, /* pth_cond_t* */
83 _VG_USERREQ__HG_PTHREAD_COND_WAIT_PRE, /* pth_cond_t*, pth_mx_t* */
84 _VG_USERREQ__HG_PTHREAD_COND_WAIT_POST, /* pth_cond_t*, pth_mx_t* */
sewardjf98e1c02008-10-25 16:22:41 +000085 _VG_USERREQ__HG_PTHREAD_COND_DESTROY_PRE, /* pth_cond_t* */
sewardjb4112022007-11-09 22:49:28 +000086 _VG_USERREQ__HG_PTHREAD_RWLOCK_INIT_POST, /* pth_rwlk_t* */
87 _VG_USERREQ__HG_PTHREAD_RWLOCK_DESTROY_PRE, /* pth_rwlk_t* */
88 _VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE, /* pth_rwlk_t*, long isW */
89 _VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST, /* pth_rwlk_t*, long isW */
90 _VG_USERREQ__HG_PTHREAD_RWLOCK_UNLOCK_PRE, /* pth_rwlk_t* */
91 _VG_USERREQ__HG_PTHREAD_RWLOCK_UNLOCK_POST, /* pth_rwlk_t* */
sewardj11e352f2007-11-30 11:11:02 +000092 _VG_USERREQ__HG_POSIX_SEM_INIT_POST, /* sem_t*, ulong value */
93 _VG_USERREQ__HG_POSIX_SEM_DESTROY_PRE, /* sem_t* */
94 _VG_USERREQ__HG_POSIX_SEM_POST_PRE, /* sem_t* */
95 _VG_USERREQ__HG_POSIX_SEM_WAIT_POST, /* sem_t* */
sewardj9f569b72008-11-13 13:33:09 +000096 _VG_USERREQ__HG_PTHREAD_BARRIER_INIT_PRE, /* pth_bar_t*, ulong */
97 _VG_USERREQ__HG_PTHREAD_BARRIER_WAIT_PRE, /* pth_bar_t* */
98 _VG_USERREQ__HG_PTHREAD_BARRIER_DESTROY_PRE /* pth_bar_t* */
sewardjb4112022007-11-09 22:49:28 +000099 } Vg_TCheckClientRequest;
100
101/* Clean memory state. This makes Helgrind forget everything it knew
102 about the specified memory range, and resets it to New. This is
103 particularly useful for memory allocators that wish to recycle
104 memory. */
105#define VALGRIND_HG_CLEAN_MEMORY(_qzz_start, _qzz_len) \
106 do { \
107 unsigned long _qzz_res; \
108 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__HG_CLEAN_MEMORY, \
109 _qzz_start, _qzz_len, 0, 0, 0); \
110 (void)0; \
111 } while(0)
112
113#endif /* __HELGRIND_H */