OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 declare_args() { | 5 declare_args() { |
| 6 # Compile for Address Sanitizer to find memory bugs. |
| 7 is_asan = false |
| 8 |
| 9 # Compile for Leak Sanitizer to find leaks. |
| 10 is_lsan = false |
| 11 |
| 12 # Compile for Memory Sanitizer to find uninitialized reads. |
| 13 is_msan = false |
| 14 |
| 15 # Compile for Thread Sanitizer to find threading bugs. |
| 16 is_tsan = false |
| 17 |
6 # Use libc++ (buildtools/third_party/libc++ and | 18 # Use libc++ (buildtools/third_party/libc++ and |
7 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. | 19 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. |
8 # This is intended to be used for instrumented builds. | 20 # This is intended to be used for instrumented builds. |
9 use_custom_libcxx = (is_asan && is_linux) || is_tsan || is_msan | 21 use_custom_libcxx = (is_asan && is_linux) || is_tsan || is_msan |
10 | 22 |
11 # Track where uninitialized memory originates from. From fastest to slowest: | 23 # Track where uninitialized memory originates from. From fastest to slowest: |
12 # 0 - no tracking, 1 - track only the initial allocation site, 2 - track the | 24 # 0 - no tracking, 1 - track only the initial allocation site, 2 - track the |
13 # chain of stores leading from allocation site to use site. | 25 # chain of stores leading from allocation site to use site. |
14 msan_track_origins = 2 | 26 msan_track_origins = 2 |
15 | 27 |
16 # Use dynamic libraries instrumented by one of the sanitizers instead of the | 28 # Use dynamic libraries instrumented by one of the sanitizers instead of the |
17 # standard system libraries. Set this flag to download prebuilt binaries from | 29 # standard system libraries. Set this flag to download prebuilt binaries from |
18 # GCS. | 30 # GCS. |
19 use_prebuilt_instrumented_libraries = false | 31 use_prebuilt_instrumented_libraries = false |
20 | 32 |
21 # Enable building with SyzyAsan which can find certain types of memory | 33 # Enable building with SyzyAsan which can find certain types of memory |
22 # errors. Only works on Windows. See | 34 # errors. Only works on Windows. See |
23 # https://code.google.com/p/sawbuck/wiki/SyzyASanHowTo | 35 # https://code.google.com/p/sawbuck/wiki/SyzyASanHowTo |
24 is_syzyasan = false | 36 is_syzyasan = false |
25 } | 37 } |
26 | 38 |
| 39 # TODO(GYP) bug 527515: is_ubsan, is_ubsan_vptr |
| 40 using_sanitizer = is_asan || is_lsan || is_tsan || is_msan |
| 41 |
| 42 assert(!using_sanitizer || is_clang, |
| 43 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") |
| 44 |
27 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The | 45 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The |
28 # same is possibly true for the other non-ASan sanitizers. But regardless of | 46 # same is possibly true for the other non-ASan sanitizers. But regardless of |
29 # whether it links, one would normally never run a sanitizer in debug mode. | 47 # whether it links, one would normally never run a sanitizer in debug mode. |
30 # Running in debug mode probably indicates you forgot to set the "is_debug = | 48 # Running in debug mode probably indicates you forgot to set the "is_debug = |
31 # false" flag in the build args. ASan seems to run fine in debug mode. | 49 # false" flag in the build args. ASan seems to run fine in debug mode. |
32 # | 50 # |
33 # If you find a use-case where you want to compile a sanitizer in debug mode | 51 # If you find a use-case where you want to compile a sanitizer in debug mode |
34 # and have verified it works, ask brettw and we can consider removing it from | 52 # and have verified it works, ask brettw and we can consider removing it from |
35 # this condition. We may also be able to find another way to enable your case | 53 # this condition. We may also be able to find another way to enable your case |
36 # without having people accidentally get broken builds by compiling an | 54 # without having people accidentally get broken builds by compiling an |
37 # unsupported or unadvisable configurations. | 55 # unsupported or unadvisable configurations. |
38 # | 56 # |
39 # For one-off testing, just comment this assertion out. | 57 # For one-off testing, just comment this assertion out. |
40 assert(!is_debug || !(is_msan || is_lsan || is_tsan), | 58 assert(!is_debug || !(is_msan || is_lsan || is_tsan), |
41 "Sanitizers should generally be used in release (set is_debug=false).") | 59 "Sanitizers should generally be used in release (set is_debug=false).") |
OLD | NEW |