| 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. | 6 # Compile for Address Sanitizer to find memory bugs. |
| 7 is_asan = false | 7 is_asan = false |
| 8 | 8 |
| 9 # Compile for Leak Sanitizer to find leaks. | 9 # Compile for Leak Sanitizer to find leaks. |
| 10 is_lsan = false | 10 is_lsan = false |
| 11 | 11 |
| 12 # Compile for Memory Sanitizer to find uninitialized reads. | 12 # Compile for Memory Sanitizer to find uninitialized reads. |
| 13 is_msan = false | 13 is_msan = false |
| 14 | 14 |
| 15 # Compile for Thread Sanitizer to find threading bugs. | 15 # Compile for Thread Sanitizer to find threading bugs. |
| 16 is_tsan = false | 16 is_tsan = false |
| 17 | 17 |
| 18 # Compile for Undefined Behaviour Sanitizer to find various types of | 18 # Compile for Undefined Behaviour Sanitizer to find various types of |
| 19 # undefined behaviour. | 19 # undefined behaviour (excludes vptr checks). |
| 20 is_ubsan = false | 20 is_ubsan = false |
| 21 | 21 |
| 22 # Compile for Undefined Behaviour Sanitizer's vptr checks. |
| 23 is_ubsan_vptr = false |
| 24 |
| 22 # Track where uninitialized memory originates from. From fastest to slowest: | 25 # Track where uninitialized memory originates from. From fastest to slowest: |
| 23 # 0 - no tracking, 1 - track only the initial allocation site, 2 - track the | 26 # 0 - no tracking, 1 - track only the initial allocation site, 2 - track the |
| 24 # chain of stores leading from allocation site to use site. | 27 # chain of stores leading from allocation site to use site. |
| 25 msan_track_origins = 2 | 28 msan_track_origins = 2 |
| 26 | 29 |
| 27 # Use dynamic libraries instrumented by one of the sanitizers instead of the | 30 # Use dynamic libraries instrumented by one of the sanitizers instead of the |
| 28 # standard system libraries. Set this flag to download prebuilt binaries from | 31 # standard system libraries. Set this flag to download prebuilt binaries from |
| 29 # GCS. | 32 # GCS. |
| 30 use_prebuilt_instrumented_libraries = false | 33 use_prebuilt_instrumented_libraries = false |
| 31 | 34 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 50 # Args that are in turn dependent on other args must be in a separate | 53 # Args that are in turn dependent on other args must be in a separate |
| 51 # declare_args block. User overrides are only applied at the end of a | 54 # declare_args block. User overrides are only applied at the end of a |
| 52 # declare_args block. | 55 # declare_args block. |
| 53 declare_args() { | 56 declare_args() { |
| 54 # Use libc++ (buildtools/third_party/libc++ and | 57 # Use libc++ (buildtools/third_party/libc++ and |
| 55 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. | 58 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. |
| 56 # This is intended to be used for instrumented builds. | 59 # This is intended to be used for instrumented builds. |
| 57 use_custom_libcxx = (is_asan && is_linux) || is_tsan || is_msan || is_ubsan | 60 use_custom_libcxx = (is_asan && is_linux) || is_tsan || is_msan || is_ubsan |
| 58 } | 61 } |
| 59 | 62 |
| 60 # TODO(GYP) bug 527515: is_ubsan, is_ubsan_vptr | 63 using_sanitizer = |
| 61 using_sanitizer = is_asan || is_lsan || is_tsan || is_msan || is_ubsan | 64 is_asan || is_lsan || is_tsan || is_msan || is_ubsan || is_ubsan_vptr |
| 62 | 65 |
| 63 assert(!using_sanitizer || is_clang, | 66 assert(!using_sanitizer || is_clang, |
| 64 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") | 67 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") |
| 65 | 68 |
| 66 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The | 69 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The |
| 67 # same is possibly true for the other non-ASan sanitizers. But regardless of | 70 # same is possibly true for the other non-ASan sanitizers. But regardless of |
| 68 # whether it links, one would normally never run a sanitizer in debug mode. | 71 # whether it links, one would normally never run a sanitizer in debug mode. |
| 69 # Running in debug mode probably indicates you forgot to set the "is_debug = | 72 # Running in debug mode probably indicates you forgot to set the "is_debug = |
| 70 # false" flag in the build args. ASan seems to run fine in debug mode. | 73 # false" flag in the build args. ASan seems to run fine in debug mode. |
| 71 # | 74 # |
| 72 # If you find a use-case where you want to compile a sanitizer in debug mode | 75 # If you find a use-case where you want to compile a sanitizer in debug mode |
| 73 # and have verified it works, ask brettw and we can consider removing it from | 76 # and have verified it works, ask brettw and we can consider removing it from |
| 74 # this condition. We may also be able to find another way to enable your case | 77 # this condition. We may also be able to find another way to enable your case |
| 75 # without having people accidentally get broken builds by compiling an | 78 # without having people accidentally get broken builds by compiling an |
| 76 # unsupported or unadvisable configurations. | 79 # unsupported or unadvisable configurations. |
| 77 # | 80 # |
| 78 # For one-off testing, just comment this assertion out. | 81 # For one-off testing, just comment this assertion out. |
| 79 assert(!is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan), | 82 assert( |
| 80 "Sanitizers should generally be used in release (set is_debug=false).") | 83 !is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan || is_ubsan_vptr), |
| 84 "Sanitizers should generally be used in release (set is_debug=false).") |
| OLD | NEW |