OLD | NEW |
1 /* Copyright (c) 2008-2009, Google Inc. | 1 /* Copyright (c) 2011, Google Inc. |
2 * All rights reserved. | 2 * All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
11 * contributors may be used to endorse or promote products derived from | 11 * contributors may be used to endorse or promote products derived from |
12 * this software without specific prior written permission. | 12 * this software without specific prior written permission. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 * | |
26 * --- | |
27 * Author: Kostya Serebryany | |
28 */ | 25 */ |
29 | 26 |
30 /* This file defines dynamic annotations for use with dynamic analysis | 27 /* This file defines dynamic annotations for use with dynamic analysis |
31 tool such as valgrind, PIN, etc. | 28 tool such as valgrind, PIN, etc. |
32 | 29 |
33 Dynamic annotation is a source code annotation that affects | 30 Dynamic annotation is a source code annotation that affects |
34 the generated code (that is, the annotation is not a comment). | 31 the generated code (that is, the annotation is not a comment). |
35 Each such annotation is attached to a particular | 32 Each such annotation is attached to a particular |
36 instruction and/or to a particular object (address) in the program. | 33 instruction and/or to a particular object (address) in the program. |
37 | 34 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 "cv". */ | 135 "cv". */ |
139 #define ANNOTATE_CONDVAR_SIGNAL(cv) \ | 136 #define ANNOTATE_CONDVAR_SIGNAL(cv) \ |
140 DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignal)(__FILE__, __LINE__, cv) | 137 DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignal)(__FILE__, __LINE__, cv) |
141 | 138 |
142 /* Report that we are about to signal_all on the condition variable at address | 139 /* Report that we are about to signal_all on the condition variable at address |
143 "cv". */ | 140 "cv". */ |
144 #define ANNOTATE_CONDVAR_SIGNAL_ALL(cv) \ | 141 #define ANNOTATE_CONDVAR_SIGNAL_ALL(cv) \ |
145 DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignalAll)(__FILE__, __LINE__, cv) | 142 DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignalAll)(__FILE__, __LINE__, cv) |
146 | 143 |
147 /* Annotations for user-defined synchronization mechanisms. */ | 144 /* Annotations for user-defined synchronization mechanisms. */ |
148 #define ANNOTATE_HAPPENS_BEFORE(obj) ANNOTATE_CONDVAR_SIGNAL(obj) | 145 #define ANNOTATE_HAPPENS_BEFORE(obj) \ |
149 #define ANNOTATE_HAPPENS_AFTER(obj) ANNOTATE_CONDVAR_WAIT(obj) | 146 DYNAMIC_ANNOTATIONS_NAME(AnnotateHappensBefore)(__FILE__, __LINE__, obj) |
| 147 #define ANNOTATE_HAPPENS_AFTER(obj) \ |
| 148 DYNAMIC_ANNOTATIONS_NAME(AnnotateHappensAfter)(__FILE__, __LINE__, obj) |
150 | 149 |
151 /* DEPRECATED. Don't use it. */ | 150 /* DEPRECATED. Don't use it. */ |
152 #define ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) \ | 151 #define ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) \ |
153 DYNAMIC_ANNOTATIONS_NAME(AnnotatePublishMemoryRange)(__FILE__, __LINE__, \ | 152 DYNAMIC_ANNOTATIONS_NAME(AnnotatePublishMemoryRange)(__FILE__, __LINE__, \ |
154 pointer, size) | 153 pointer, size) |
155 | 154 |
156 /* DEPRECATED. Don't use it. */ | 155 /* DEPRECATED. Don't use it. */ |
157 #define ANNOTATE_UNPUBLISH_MEMORY_RANGE(pointer, size) \ | 156 #define ANNOTATE_UNPUBLISH_MEMORY_RANGE(pointer, size) \ |
158 DYNAMIC_ANNOTATIONS_NAME(AnnotateUnpublishMemoryRange)(__FILE__, __LINE__, \ | 157 DYNAMIC_ANNOTATIONS_NAME(AnnotateUnpublishMemoryRange)(__FILE__, __LINE__, \ |
159 pointer, size) | 158 pointer, size) |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 const volatile void *barrier) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; | 455 const volatile void *barrier) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; |
457 void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarWait)( | 456 void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarWait)( |
458 const char *file, int line, const volatile void *cv, | 457 const char *file, int line, const volatile void *cv, |
459 const volatile void *lock) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; | 458 const volatile void *lock) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; |
460 void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignal)( | 459 void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignal)( |
461 const char *file, int line, | 460 const char *file, int line, |
462 const volatile void *cv) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; | 461 const volatile void *cv) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; |
463 void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignalAll)( | 462 void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignalAll)( |
464 const char *file, int line, | 463 const char *file, int line, |
465 const volatile void *cv) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; | 464 const volatile void *cv) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; |
| 465 void DYNAMIC_ANNOTATIONS_NAME(AnnotateHappensBefore)( |
| 466 const char *file, int line, |
| 467 const volatile void *obj) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; |
| 468 void DYNAMIC_ANNOTATIONS_NAME(AnnotateHappensAfter)( |
| 469 const char *file, int line, |
| 470 const volatile void *obj) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; |
466 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePublishMemoryRange)( | 471 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePublishMemoryRange)( |
467 const char *file, int line, | 472 const char *file, int line, |
468 const volatile void *address, long size) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; | 473 const volatile void *address, long size) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; |
469 void DYNAMIC_ANNOTATIONS_NAME(AnnotateUnpublishMemoryRange)( | 474 void DYNAMIC_ANNOTATIONS_NAME(AnnotateUnpublishMemoryRange)( |
470 const char *file, int line, | 475 const char *file, int line, |
471 const volatile void *address, long size) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; | 476 const volatile void *address, long size) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; |
472 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQCreate)( | 477 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQCreate)( |
473 const char *file, int line, | 478 const char *file, int line, |
474 const volatile void *pcq) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; | 479 const volatile void *pcq) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK; |
475 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQDestroy)( | 480 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQDestroy)( |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 static static_var ## _annotator the ## static_var ## _annotator;\ | 586 static static_var ## _annotator the ## static_var ## _annotator;\ |
582 } | 587 } |
583 #else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */ | 588 #else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */ |
584 | 589 |
585 #define ANNOTATE_UNPROTECTED_READ(x) (x) | 590 #define ANNOTATE_UNPROTECTED_READ(x) (x) |
586 #define ANNOTATE_BENIGN_RACE_STATIC(static_var, description) /* empty */ | 591 #define ANNOTATE_BENIGN_RACE_STATIC(static_var, description) /* empty */ |
587 | 592 |
588 #endif /* DYNAMIC_ANNOTATIONS_ENABLED */ | 593 #endif /* DYNAMIC_ANNOTATIONS_ENABLED */ |
589 | 594 |
590 #endif /* __DYNAMIC_ANNOTATIONS_H__ */ | 595 #endif /* __DYNAMIC_ANNOTATIONS_H__ */ |
OLD | NEW |