sewardj | b411202 | 2007-11-09 22:49:28 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
sewardj | 4d474d0 | 2008-02-11 11:34:59 +0000 | [diff] [blame] | 14 | Copyright (C) 2007-2008 OpenWorks LLP |
sewardj | b411202 | 2007-11-09 22:49:28 +0000 | [diff] [blame] | 15 | 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 | |
| 63 | typedef |
| 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* */ |
sewardj | f98e1c0 | 2008-10-25 16:22:41 +0000 | [diff] [blame^] | 85 | _VG_USERREQ__HG_PTHREAD_COND_DESTROY_PRE, /* pth_cond_t* */ |
sewardj | b411202 | 2007-11-09 22:49:28 +0000 | [diff] [blame] | 86 | _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* */ |
sewardj | 11e352f | 2007-11-30 11:11:02 +0000 | [diff] [blame] | 92 | _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* */ |
sewardj | b411202 | 2007-11-09 22:49:28 +0000 | [diff] [blame] | 96 | _VG_USERREQ__HG_GET_MY_SEGMENT /* -> Segment* */ |
| 97 | } Vg_TCheckClientRequest; |
| 98 | |
| 99 | /* Clean memory state. This makes Helgrind forget everything it knew |
| 100 | about the specified memory range, and resets it to New. This is |
| 101 | particularly useful for memory allocators that wish to recycle |
| 102 | memory. */ |
| 103 | #define VALGRIND_HG_CLEAN_MEMORY(_qzz_start, _qzz_len) \ |
| 104 | do { \ |
| 105 | unsigned long _qzz_res; \ |
| 106 | VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__HG_CLEAN_MEMORY, \ |
| 107 | _qzz_start, _qzz_len, 0, 0, 0); \ |
| 108 | (void)0; \ |
| 109 | } while(0) |
| 110 | |
| 111 | #endif /* __HELGRIND_H */ |