OLD | NEW |
1 /* Copyright (c) 2008-2009, Google Inc. | 1 /* Copyright (c) 2008-2009, 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 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #ifdef __GNUC__ | 43 #ifdef __GNUC__ |
44 /* valgrind.h uses gcc extensions so it won't build with other compilers */ | 44 /* valgrind.h uses gcc extensions so it won't build with other compilers */ |
45 # include "base/third_party/valgrind/valgrind.h" | 45 # include "base/third_party/valgrind/valgrind.h" |
46 #endif | 46 #endif |
47 | 47 |
48 /* Each function is empty and called (via a macro) only in debug mode. | 48 /* Each function is empty and called (via a macro) only in debug mode. |
49 The arguments are captured by dynamic tools at runtime. */ | 49 The arguments are captured by dynamic tools at runtime. */ |
50 | 50 |
51 #if DYNAMIC_ANNOTATIONS_ENABLED == 1 | 51 #if DYNAMIC_ANNOTATIONS_ENABLED == 1 |
52 | 52 |
53 void AnnotateRWLockCreate(const char *file, int line, | 53 void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockCreate)( |
54 const volatile void *lock){} | 54 const char *file, int line, const volatile void *lock){} |
55 void AnnotateRWLockDestroy(const char *file, int line, | 55 void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockDestroy)( |
56 const volatile void *lock){} | 56 const char *file, int line, const volatile void *lock){} |
57 void AnnotateRWLockAcquired(const char *file, int line, | 57 void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockAcquired)( |
58 const volatile void *lock, long is_w){} | 58 const char *file, int line, const volatile void *lock, long is_w){} |
59 void AnnotateRWLockReleased(const char *file, int line, | 59 void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockReleased)( |
60 const volatile void *lock, long is_w){} | 60 const char *file, int line, const volatile void *lock, long is_w){} |
61 void AnnotateBarrierInit(const char *file, int line, | 61 void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierInit)( |
62 const volatile void *barrier, long count, | 62 const char *file, int line, const volatile void *barrier, long count, |
63 long reinitialization_allowed) {} | 63 long reinitialization_allowed) {} |
64 void AnnotateBarrierWaitBefore(const char *file, int line, | 64 void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitBefore)( |
65 const volatile void *barrier) {} | 65 const char *file, int line, const volatile void *barrier) {} |
66 void AnnotateBarrierWaitAfter(const char *file, int line, | 66 void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitAfter)( |
67 const volatile void *barrier) {} | 67 const char *file, int line, const volatile void *barrier) {} |
68 void AnnotateBarrierDestroy(const char *file, int line, | 68 void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierDestroy)( |
69 const volatile void *barrier) {} | 69 const char *file, int line, const volatile void *barrier) {} |
70 | 70 |
71 void AnnotateCondVarWait(const char *file, int line, | 71 void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarWait)( |
72 const volatile void *cv, | 72 const char *file, int line, const volatile void *cv, |
73 const volatile void *lock){} | 73 const volatile void *lock){} |
74 void AnnotateCondVarSignal(const char *file, int line, | 74 void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignal)( |
75 const volatile void *cv){} | 75 const char *file, int line, const volatile void *cv){} |
76 void AnnotateCondVarSignalAll(const char *file, int line, | 76 void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignalAll)( |
77 const volatile void *cv){} | 77 const char *file, int line, const volatile void *cv){} |
78 void AnnotatePublishMemoryRange(const char *file, int line, | 78 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePublishMemoryRange)( |
79 const volatile void *address, | 79 const char *file, int line, const volatile void *address, long size){} |
80 long size){} | 80 void DYNAMIC_ANNOTATIONS_NAME(AnnotateUnpublishMemoryRange)( |
81 void AnnotateUnpublishMemoryRange(const char *file, int line, | 81 const char *file, int line, const volatile void *address, long size){} |
82 const volatile void *address, | 82 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQCreate)( |
83 long size){} | 83 const char *file, int line, const volatile void *pcq){} |
84 void AnnotatePCQCreate(const char *file, int line, | 84 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQDestroy)( |
85 const volatile void *pcq){} | 85 const char *file, int line, const volatile void *pcq){} |
86 void AnnotatePCQDestroy(const char *file, int line, | 86 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQPut)( |
87 const volatile void *pcq){} | 87 const char *file, int line, const volatile void *pcq){} |
88 void AnnotatePCQPut(const char *file, int line, | 88 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQGet)( |
89 const volatile void *pcq){} | 89 const char *file, int line, const volatile void *pcq){} |
90 void AnnotatePCQGet(const char *file, int line, | 90 void DYNAMIC_ANNOTATIONS_NAME(AnnotateNewMemory)( |
91 const volatile void *pcq){} | 91 const char *file, int line, const volatile void *mem, long size){} |
92 void AnnotateNewMemory(const char *file, int line, | 92 void DYNAMIC_ANNOTATIONS_NAME(AnnotateExpectRace)( |
93 const volatile void *mem, | 93 const char *file, int line, const volatile void *mem, |
94 long size){} | 94 const char *description){} |
95 void AnnotateExpectRace(const char *file, int line, | 95 void DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushExpectedRaces)( |
96 const volatile void *mem, | 96 const char *file, int line){} |
97 const char *description){} | 97 void DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRace)( |
98 void AnnotateBenignRace(const char *file, int line, | 98 const char *file, int line, const volatile void *mem, |
99 const volatile void *mem, | 99 const char *description){} |
100 const char *description){} | 100 void DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRaceSized)( |
101 void AnnotateBenignRaceSized(const char *file, int line, | 101 const char *file, int line, const volatile void *mem, long size, |
102 const volatile void *mem, | 102 const char *description){} |
103 long size, | 103 void DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsUsedAsCondVar)( |
104 const char *description) {} | 104 const char *file, int line, const volatile void *mu){} |
105 void AnnotateMutexIsUsedAsCondVar(const char *file, int line, | 105 void DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsNotPHB)( |
106 const volatile void *mu){} | 106 const char *file, int line, const volatile void *mu){} |
107 void AnnotateTraceMemory(const char *file, int line, | 107 void DYNAMIC_ANNOTATIONS_NAME(AnnotateTraceMemory)( |
108 const volatile void *arg){} | 108 const char *file, int line, const volatile void *arg){} |
109 void AnnotateThreadName(const char *file, int line, | 109 void DYNAMIC_ANNOTATIONS_NAME(AnnotateThreadName)( |
110 const char *name){} | 110 const char *file, int line, const char *name){} |
111 void AnnotateIgnoreReadsBegin(const char *file, int line){} | 111 void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsBegin)( |
112 void AnnotateIgnoreReadsEnd(const char *file, int line){} | 112 const char *file, int line){} |
113 void AnnotateIgnoreWritesBegin(const char *file, int line){} | 113 void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsEnd)( |
114 void AnnotateIgnoreWritesEnd(const char *file, int line){} | 114 const char *file, int line){} |
115 void AnnotateIgnoreSyncBegin(const char *file, int line){} | 115 void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesBegin)( |
116 void AnnotateIgnoreSyncEnd(const char *file, int line){} | 116 const char *file, int line){} |
117 void AnnotateEnableRaceDetection(const char *file, int line, int enable){} | 117 void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesEnd)( |
118 void AnnotateNoOp(const char *file, int line, | 118 const char *file, int line){} |
119 const volatile void *arg){} | 119 void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncBegin)( |
120 void AnnotateFlushState(const char *file, int line){} | 120 const char *file, int line){} |
| 121 void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncEnd)( |
| 122 const char *file, int line){} |
| 123 void DYNAMIC_ANNOTATIONS_NAME(AnnotateEnableRaceDetection)( |
| 124 const char *file, int line, int enable){} |
| 125 void DYNAMIC_ANNOTATIONS_NAME(AnnotateNoOp)( |
| 126 const char *file, int line, const volatile void *arg){} |
| 127 void DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushState)( |
| 128 const char *file, int line){} |
121 | 129 |
122 #endif /* DYNAMIC_ANNOTATIONS_ENABLED == 1 */ | 130 #endif /* DYNAMIC_ANNOTATIONS_ENABLED == 1 */ |
123 | 131 |
| 132 #if DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND == 1 |
124 static int GetRunningOnValgrind(void) { | 133 static int GetRunningOnValgrind(void) { |
125 #ifdef RUNNING_ON_VALGRIND | 134 #ifdef RUNNING_ON_VALGRIND |
126 if (RUNNING_ON_VALGRIND) return 1; | 135 if (RUNNING_ON_VALGRIND) return 1; |
127 #endif | 136 #endif |
128 | 137 |
129 #ifndef _MSC_VER | 138 #ifndef _MSC_VER |
130 char *running_on_valgrind_str = getenv("RUNNING_ON_VALGRIND"); | 139 char *running_on_valgrind_str = getenv("RUNNING_ON_VALGRIND"); |
131 if (running_on_valgrind_str) { | 140 if (running_on_valgrind_str) { |
132 return strcmp(running_on_valgrind_str, "0") != 0; | 141 return strcmp(running_on_valgrind_str, "0") != 0; |
133 } | 142 } |
(...skipping 16 matching lines...) Expand all Loading... |
150 /* See the comments in dynamic_annotations.h */ | 159 /* See the comments in dynamic_annotations.h */ |
151 int RunningOnValgrind(void) { | 160 int RunningOnValgrind(void) { |
152 static volatile int running_on_valgrind = -1; | 161 static volatile int running_on_valgrind = -1; |
153 /* C doesn't have thread-safe initialization of statics, and we | 162 /* C doesn't have thread-safe initialization of statics, and we |
154 don't want to depend on pthread_once here, so hack it. */ | 163 don't want to depend on pthread_once here, so hack it. */ |
155 int local_running_on_valgrind = running_on_valgrind; | 164 int local_running_on_valgrind = running_on_valgrind; |
156 if (local_running_on_valgrind == -1) | 165 if (local_running_on_valgrind == -1) |
157 running_on_valgrind = local_running_on_valgrind = GetRunningOnValgrind(); | 166 running_on_valgrind = local_running_on_valgrind = GetRunningOnValgrind(); |
158 return local_running_on_valgrind; | 167 return local_running_on_valgrind; |
159 } | 168 } |
| 169 |
| 170 #endif /* DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND == 1 */ |
OLD | NEW |