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 |
| 5 | file (helgrind.h) only. The entire rest of Valgrind is licensed |
| 6 | under the terms of the GNU General Public License, version 2. See |
| 7 | the COPYING file in the source distribution for details. |
| 8 | |
| 9 | ---------------------------------------------------------------- |
| 10 | |
nethercote | 137bc55 | 2003-11-14 17:47:54 +0000 | [diff] [blame] | 11 | This file is part of helgrind, a Valgrind tool for detecting |
sewardj | 7f3ad22 | 2002-11-13 22:11:53 +0000 | [diff] [blame] | 12 | data races in threaded programs. |
| 13 | |
njn | 5361242 | 2005-03-12 16:22:54 +0000 | [diff] [blame] | 14 | Copyright (C) 2002-2005 Nicholas Nethercote. All rights reserved. |
sewardj | 7f3ad22 | 2002-11-13 22:11:53 +0000 | [diff] [blame] | 15 | |
| 16 | Redistribution and use in source and binary forms, with or without |
| 17 | modification, are permitted provided that the following conditions |
| 18 | are met: |
| 19 | |
| 20 | 1. Redistributions of source code must retain the above copyright |
| 21 | notice, this list of conditions and the following disclaimer. |
| 22 | |
| 23 | 2. The origin of this software must not be misrepresented; you must |
| 24 | not claim that you wrote the original software. If you use this |
| 25 | software in a product, an acknowledgment in the product |
| 26 | documentation would be appreciated but is not required. |
| 27 | |
| 28 | 3. Altered source versions must be plainly marked as such, and must |
| 29 | not be misrepresented as being the original software. |
| 30 | |
| 31 | 4. The name of the author may not be used to endorse or promote |
| 32 | products derived from this software without specific prior written |
| 33 | permission. |
| 34 | |
| 35 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS |
| 36 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 37 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 38 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 39 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 40 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
| 41 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 42 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 43 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 44 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 45 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 46 | |
| 47 | ---------------------------------------------------------------- |
| 48 | |
| 49 | Notice that the above BSD-style license applies to this one file |
| 50 | (helgrind.h) only. The entire rest of Valgrind is licensed under |
| 51 | the terms of the GNU General Public License, version 2. See the |
| 52 | COPYING file in the source distribution for details. |
| 53 | |
| 54 | ---------------------------------------------------------------- |
| 55 | */ |
| 56 | |
| 57 | #ifndef __HELGRIND_H |
| 58 | #define __HELGRIND_H |
| 59 | |
sewardj | 7f3ad22 | 2002-11-13 22:11:53 +0000 | [diff] [blame] | 60 | #include "valgrind.h" |
| 61 | |
| 62 | typedef |
| 63 | enum { |
njn | fc26ff9 | 2004-11-22 19:12:49 +0000 | [diff] [blame] | 64 | VG_USERREQ__HG_CLEAN_MEMORY = VG_USERREQ_TOOL_BASE('H','G'), |
sewardj | 34a257c | 2003-03-15 19:20:52 +0000 | [diff] [blame] | 65 | VG_USERREQ__HG_KNOWN_RACE |
sewardj | 7f3ad22 | 2002-11-13 22:11:53 +0000 | [diff] [blame] | 66 | } Vg_HelgrindClientRequest; |
| 67 | |
| 68 | /* Clean memory state. This makes Helgrind forget everything it knew |
| 69 | about the specified memory range, and resets it to virgin. This is |
| 70 | particularly useful for memory allocators who wish to recycle |
| 71 | memory. */ |
| 72 | #define VALGRIND_HG_CLEAN_MEMORY(_qzz_start, _qzz_len) \ |
| 73 | do { \ |
| 74 | unsigned int _qzz_res; \ |
| 75 | VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__HG_CLEAN_MEMORY, \ |
| 76 | _qzz_start, _qzz_len, 0, 0); \ |
| 77 | (void)0; \ |
| 78 | } while(0) |
| 79 | |
| 80 | /* Mark memory as known racy. This puts the memory range specified |
| 81 | into the error state, so that data race errors are not reported |
| 82 | against it. */ |
| 83 | #define VALGRIND_HG_KNOWN_RACE(_qzz_start, _qzz_len) \ |
| 84 | do { \ |
| 85 | unsigned int _qzz_res; \ |
| 86 | VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__HG_KNOWN_RACE, \ |
| 87 | _qzz_start, _qzz_len, 0, 0); \ |
| 88 | (void)0; \ |
| 89 | } while(0) |
| 90 | |
| 91 | #endif /* __HELGRIND_H */ |