OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This file contains the default options for various compiler-based dynamic | 5 // This file contains the default options for various compiler-based dynamic |
6 // tools. | 6 // tools. |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(ADDRESS_SANITIZER) && defined(OS_MACOSX) | 10 #if defined(ADDRESS_SANITIZER) && defined(OS_MACOSX) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // work around libGL.so using the obsolete API, see | 44 // work around libGL.so using the obsolete API, see |
45 // http://crbug.com/341805. This may break if pthread_cond_t objects are | 45 // http://crbug.com/341805. This may break if pthread_cond_t objects are |
46 // accessed by both instrumented and non-instrumented binaries (e.g. if | 46 // accessed by both instrumented and non-instrumented binaries (e.g. if |
47 // they reside in shared memory). This option is going to be deprecated in | 47 // they reside in shared memory). This option is going to be deprecated in |
48 // upstream AddressSanitizer and must not be used anywhere except the | 48 // upstream AddressSanitizer and must not be used anywhere except the |
49 // official builds. | 49 // official builds. |
50 // check_printf=1 - check the memory accesses to printf (and other formatted | 50 // check_printf=1 - check the memory accesses to printf (and other formatted |
51 // output routines) arguments. | 51 // output routines) arguments. |
52 // use_sigaltstack=1 - handle signals on an alternate signal stack. Useful | 52 // use_sigaltstack=1 - handle signals on an alternate signal stack. Useful |
53 // for stack overflow detection. | 53 // for stack overflow detection. |
54 // strip_path_prefix=Release/../../ - prefixes up to and including this | 54 // strip_path_prefix=/../../ - prefixes up to and including this |
55 // substring will be stripped from source file paths in symbolized reports | 55 // substring will be stripped from source file paths in symbolized reports |
56 // fast_unwind_on_fatal=1 - use the fast (frame-pointer-based) stack unwinder | 56 // fast_unwind_on_fatal=1 - use the fast (frame-pointer-based) stack unwinder |
57 // to print error reports. V8 doesn't generate debug info for the JIT code, | 57 // to print error reports. V8 doesn't generate debug info for the JIT code, |
58 // so the slow unwinder may not work properly. | 58 // so the slow unwinder may not work properly. |
59 // detect_stack_use_after_return=1 - use fake stack to delay the reuse of | 59 // detect_stack_use_after_return=1 - use fake stack to delay the reuse of |
60 // stack allocations and detect stack-use-after-return errors. | 60 // stack allocations and detect stack-use-after-return errors. |
61 #if defined(OS_LINUX) | 61 #if defined(OS_LINUX) |
62 #if defined(GOOGLE_CHROME_BUILD) | 62 #if defined(GOOGLE_CHROME_BUILD) |
63 // Default AddressSanitizer options for the official build. These do not affect | 63 // Default AddressSanitizer options for the official build. These do not affect |
64 // tests on buildbots (which don't set GOOGLE_CHROME_BUILD) or non-official | 64 // tests on buildbots (which don't set GOOGLE_CHROME_BUILD) or non-official |
65 // Chromium builds. | 65 // Chromium builds. |
66 const char kAsanDefaultOptions[] = | 66 const char kAsanDefaultOptions[] = |
67 "legacy_pthread_cond=1 malloc_context_size=5 " | 67 "legacy_pthread_cond=1 malloc_context_size=5 " |
68 "symbolize=1 check_printf=1 use_sigaltstack=1 detect_leaks=0 " | 68 "symbolize=1 check_printf=1 use_sigaltstack=1 detect_leaks=0 " |
69 "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1"; | 69 "strip_path_prefix=/../../ fast_unwind_on_fatal=1"; |
70 #else | 70 #else |
71 // Default AddressSanitizer options for buildbots and non-official builds. | 71 // Default AddressSanitizer options for buildbots and non-official builds. |
72 const char *kAsanDefaultOptions = | 72 const char *kAsanDefaultOptions = |
73 "symbolize=1 check_printf=1 use_sigaltstack=1 " | 73 "symbolize=1 check_printf=1 use_sigaltstack=1 " |
74 "detect_leaks=0 strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 " | 74 "detect_leaks=0 strip_path_prefix=/../../ fast_unwind_on_fatal=1 " |
75 "detect_stack_use_after_return=1 "; | 75 "detect_stack_use_after_return=1 "; |
76 #endif // GOOGLE_CHROME_BUILD | 76 #endif // GOOGLE_CHROME_BUILD |
77 | 77 |
78 #elif defined(OS_MACOSX) | 78 #elif defined(OS_MACOSX) |
79 const char *kAsanDefaultOptions = | 79 const char *kAsanDefaultOptions = |
80 "check_printf=1 use_sigaltstack=1 " | 80 "check_printf=1 use_sigaltstack=1 " |
81 "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 " | 81 "strip_path_prefix=/../../ fast_unwind_on_fatal=1 " |
82 "detect_stack_use_after_return=1 detect_odr_violation=0 "; | 82 "detect_stack_use_after_return=1 detect_odr_violation=0 "; |
83 static const char kNaClDefaultOptions[] = "handle_segv=0"; | 83 static const char kNaClDefaultOptions[] = "handle_segv=0"; |
84 static const char kNaClFlag[] = "--type=nacl-loader"; | 84 static const char kNaClFlag[] = "--type=nacl-loader"; |
85 #endif // OS_LINUX | 85 #endif // OS_LINUX |
86 | 86 |
87 #if defined(OS_LINUX) || defined(OS_MACOSX) | 87 #if defined(OS_LINUX) || defined(OS_MACOSX) |
88 SANITIZER_HOOK_ATTRIBUTE const char *__asan_default_options() { | 88 SANITIZER_HOOK_ATTRIBUTE const char *__asan_default_options() { |
89 #if defined(OS_MACOSX) | 89 #if defined(OS_MACOSX) |
90 char*** argvp = _NSGetArgv(); | 90 char*** argvp = _NSGetArgv(); |
91 int* argcp = _NSGetArgc(); | 91 int* argcp = _NSGetArgc(); |
(...skipping 21 matching lines...) Expand all Loading... |
113 // Default options for ThreadSanitizer in various configurations: | 113 // Default options for ThreadSanitizer in various configurations: |
114 // detect_deadlocks=1 - enable deadlock (lock inversion) detection. | 114 // detect_deadlocks=1 - enable deadlock (lock inversion) detection. |
115 // second_deadlock_stack=1 - more verbose deadlock reports. | 115 // second_deadlock_stack=1 - more verbose deadlock reports. |
116 // report_signal_unsafe=0 - do not report async-signal-unsafe functions | 116 // report_signal_unsafe=0 - do not report async-signal-unsafe functions |
117 // called from signal handlers. | 117 // called from signal handlers. |
118 // report_thread_leaks=0 - do not report unjoined threads at the end of | 118 // report_thread_leaks=0 - do not report unjoined threads at the end of |
119 // the program execution. | 119 // the program execution. |
120 // print_suppressions=1 - print the list of matched suppressions. | 120 // print_suppressions=1 - print the list of matched suppressions. |
121 // history_size=7 - make the history buffer proportional to 2^7 (the maximum | 121 // history_size=7 - make the history buffer proportional to 2^7 (the maximum |
122 // value) to keep more stack traces. | 122 // value) to keep more stack traces. |
123 // strip_path_prefix=Release/../../ - prefixes up to and including this | 123 // strip_path_prefix=/../../ - prefixes up to and including this |
124 // substring will be stripped from source file paths in symbolized reports. | 124 // substring will be stripped from source file paths in symbolized reports. |
125 const char kTsanDefaultOptions[] = | 125 const char kTsanDefaultOptions[] = |
126 "detect_deadlocks=1 second_deadlock_stack=1 report_signal_unsafe=0 " | 126 "detect_deadlocks=1 second_deadlock_stack=1 report_signal_unsafe=0 " |
127 "report_thread_leaks=0 print_suppressions=1 history_size=7 " | 127 "report_thread_leaks=0 print_suppressions=1 history_size=7 " |
128 "strict_memcmp=0 strip_path_prefix=Release/../../ "; | 128 "strict_memcmp=0 strip_path_prefix=/../../ "; |
129 | 129 |
130 SANITIZER_HOOK_ATTRIBUTE const char *__tsan_default_options() { | 130 SANITIZER_HOOK_ATTRIBUTE const char *__tsan_default_options() { |
131 return kTsanDefaultOptions; | 131 return kTsanDefaultOptions; |
132 } | 132 } |
133 | 133 |
134 extern "C" char kTSanDefaultSuppressions[]; | 134 extern "C" char kTSanDefaultSuppressions[]; |
135 | 135 |
136 SANITIZER_HOOK_ATTRIBUTE const char *__tsan_default_suppressions() { | 136 SANITIZER_HOOK_ATTRIBUTE const char *__tsan_default_suppressions() { |
137 return kTSanDefaultSuppressions; | 137 return kTSanDefaultSuppressions; |
138 } | 138 } |
139 | 139 |
140 #endif // THREAD_SANITIZER && OS_LINUX | 140 #endif // THREAD_SANITIZER && OS_LINUX |
141 | 141 |
142 #if defined(MEMORY_SANITIZER) | 142 #if defined(MEMORY_SANITIZER) |
143 // Default options for MemorySanitizer: | 143 // Default options for MemorySanitizer: |
144 // intercept_memcmp=0 - do not detect uninitialized memory in memcmp() calls. | 144 // intercept_memcmp=0 - do not detect uninitialized memory in memcmp() calls. |
145 // Pending cleanup, see http://crbug.com/523428 | 145 // Pending cleanup, see http://crbug.com/523428 |
146 // strip_path_prefix=Release/../../ - prefixes up to and including this | 146 // strip_path_prefix=/../../ - prefixes up to and including this |
147 // substring will be stripped from source file paths in symbolized reports. | 147 // substring will be stripped from source file paths in symbolized reports. |
148 const char kMsanDefaultOptions[] = | 148 const char kMsanDefaultOptions[] = |
149 "intercept_memcmp=0 strip_path_prefix=Release/../../ "; | 149 "intercept_memcmp=0 strip_path_prefix=/../../ "; |
150 | 150 |
151 SANITIZER_HOOK_ATTRIBUTE const char *__msan_default_options() { | 151 SANITIZER_HOOK_ATTRIBUTE const char *__msan_default_options() { |
152 return kMsanDefaultOptions; | 152 return kMsanDefaultOptions; |
153 } | 153 } |
154 | 154 |
155 #endif // MEMORY_SANITIZER | 155 #endif // MEMORY_SANITIZER |
156 | 156 |
157 #if defined(LEAK_SANITIZER) | 157 #if defined(LEAK_SANITIZER) |
158 // Default options for LeakSanitizer: | 158 // Default options for LeakSanitizer: |
159 // print_suppressions=1 - print the list of matched suppressions. | 159 // print_suppressions=1 - print the list of matched suppressions. |
160 // strip_path_prefix=Release/../../ - prefixes up to and including this | 160 // strip_path_prefix=/../../ - prefixes up to and including this |
161 // substring will be stripped from source file paths in symbolized reports. | 161 // substring will be stripped from source file paths in symbolized reports. |
162 const char kLsanDefaultOptions[] = | 162 const char kLsanDefaultOptions[] = |
163 "print_suppressions=1 strip_path_prefix=Release/../../ "; | 163 "print_suppressions=1 strip_path_prefix=/../../ "; |
164 | 164 |
165 SANITIZER_HOOK_ATTRIBUTE const char *__lsan_default_options() { | 165 SANITIZER_HOOK_ATTRIBUTE const char *__lsan_default_options() { |
166 return kLsanDefaultOptions; | 166 return kLsanDefaultOptions; |
167 } | 167 } |
168 | 168 |
169 extern "C" char kLSanDefaultSuppressions[]; | 169 extern "C" char kLSanDefaultSuppressions[]; |
170 | 170 |
171 SANITIZER_HOOK_ATTRIBUTE const char *__lsan_default_suppressions() { | 171 SANITIZER_HOOK_ATTRIBUTE const char *__lsan_default_suppressions() { |
172 return kLSanDefaultSuppressions; | 172 return kLSanDefaultSuppressions; |
173 } | 173 } |
174 | 174 |
175 #endif // LEAK_SANITIZER | 175 #endif // LEAK_SANITIZER |
176 | 176 |
177 #if defined(UNDEFINED_SANITIZER) | 177 #if defined(UNDEFINED_SANITIZER) |
178 // Default options for UndefinedBehaviorSanitizer: | 178 // Default options for UndefinedBehaviorSanitizer: |
179 // print_stacktrace=1 - print the stacktrace when UBSan reports an error. | 179 // print_stacktrace=1 - print the stacktrace when UBSan reports an error. |
180 const char kUbsanDefaultOptions[] = "print_stacktrace=1"; | 180 const char kUbsanDefaultOptions[] = "print_stacktrace=1"; |
181 | 181 |
182 SANITIZER_HOOK_ATTRIBUTE const char* __ubsan_default_options() { | 182 SANITIZER_HOOK_ATTRIBUTE const char* __ubsan_default_options() { |
183 return kUbsanDefaultOptions; | 183 return kUbsanDefaultOptions; |
184 } | 184 } |
185 | 185 |
186 #endif // UNDEFINED_SANITIZER | 186 #endif // UNDEFINED_SANITIZER |
OLD | NEW |