sewardj | 7f3ad22 | 2002-11-13 22:11:53 +0000 | [diff] [blame] | 1 | /* |
| 2 | ---------------------------------------------------------------- |
| 3 | |
| 4 | Notice that the following BSD-style license applies to this one |
weidendo | 2dc8480 | 2006-03-31 12:53:22 +0000 | [diff] [blame] | 5 | file (helgrind.h) only. The rest of Valgrind is licensed under the |
njn | 7fd15d6 | 2006-03-31 12:05:04 +0000 | [diff] [blame] | 6 | terms of the GNU General Public License, version 2, unless |
| 7 | otherwise indicated. See the COPYING file in the source |
| 8 | distribution for details. |
sewardj | 7f3ad22 | 2002-11-13 22:11:53 +0000 | [diff] [blame] | 9 | |
| 10 | ---------------------------------------------------------------- |
| 11 | |
nethercote | 137bc55 | 2003-11-14 17:47:54 +0000 | [diff] [blame] | 12 | This file is part of helgrind, a Valgrind tool for detecting |
sewardj | 7f3ad22 | 2002-11-13 22:11:53 +0000 | [diff] [blame] | 13 | data races in threaded programs. |
| 14 | |
sewardj | 9ebd6e0 | 2007-01-08 06:01:59 +0000 | [diff] [blame] | 15 | Copyright (C) 2002-2007 Nicholas Nethercote. All rights reserved. |
sewardj | 7f3ad22 | 2002-11-13 22:11:53 +0000 | [diff] [blame] | 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 | |
sewardj | 7f3ad22 | 2002-11-13 22:11:53 +0000 | [diff] [blame] | 61 | #include "valgrind.h" |
| 62 | |
| 63 | typedef |
| 64 | enum { |
njn | fc26ff9 | 2004-11-22 19:12:49 +0000 | [diff] [blame] | 65 | VG_USERREQ__HG_CLEAN_MEMORY = VG_USERREQ_TOOL_BASE('H','G'), |
sewardj | 34a257c | 2003-03-15 19:20:52 +0000 | [diff] [blame] | 66 | VG_USERREQ__HG_KNOWN_RACE |
sewardj | 7f3ad22 | 2002-11-13 22:11:53 +0000 | [diff] [blame] | 67 | } Vg_HelgrindClientRequest; |
| 68 | |
| 69 | /* Clean memory state. This makes Helgrind forget everything it knew |
| 70 | about the specified memory range, and resets it to virgin. This is |
| 71 | particularly useful for memory allocators who wish to recycle |
| 72 | memory. */ |
| 73 | #define VALGRIND_HG_CLEAN_MEMORY(_qzz_start, _qzz_len) \ |
| 74 | do { \ |
| 75 | unsigned int _qzz_res; \ |
| 76 | VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__HG_CLEAN_MEMORY, \ |
| 77 | _qzz_start, _qzz_len, 0, 0); \ |
| 78 | (void)0; \ |
| 79 | } while(0) |
| 80 | |
| 81 | /* Mark memory as known racy. This puts the memory range specified |
| 82 | into the error state, so that data race errors are not reported |
| 83 | against it. */ |
| 84 | #define VALGRIND_HG_KNOWN_RACE(_qzz_start, _qzz_len) \ |
| 85 | do { \ |
| 86 | unsigned int _qzz_res; \ |
| 87 | VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__HG_KNOWN_RACE, \ |
| 88 | _qzz_start, _qzz_len, 0, 0); \ |
| 89 | (void)0; \ |
| 90 | } while(0) |
| 91 | |
| 92 | #endif /* __HELGRIND_H */ |