André Kempe | ddbe307 | 2023-03-03 18:44:38 | [diff] [blame] | 1 | # Copyright 2023 The Chromium Authors |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | import("//build/config/compiler/compiler.gni") |
| 6 | |
| 7 | declare_args() { |
| 8 | # Whether to compile support for Allocation Stack Trace Recorder. |
| 9 | # |
| 10 | # The recorder is initially intended as a support tool for Arm's |
| 11 | # Memory Tagging Extensions. A history of the most recent allocations and |
| 12 | # frees is included in the crashpad report and gives developers information |
| 13 | # where the memory which was invalidly accessed was allocated or freed. |
| 14 | # |
| 15 | # Although it should work on other platforms as well, for the above reasons, |
Keishi Hattori | 82d82af2 | 2023-08-22 18:42:28 | [diff] [blame^] | 16 | # we currently enable it only for Android when compiling for Arm64. |
| 17 | build_allocation_stack_trace_recorder = current_cpu == "arm64" && is_android |
André Kempe | ddbe307 | 2023-03-03 18:44:38 | [diff] [blame] | 18 | } |
| 19 | |
André Kempe | 7c53f62 | 2023-06-26 15:37:14 | [diff] [blame] | 20 | declare_args() { |
| 21 | # If enabled, the recorder gathers some additional information, i.e. number of |
| 22 | # collisions of slots, and prints these periodically. |
| 23 | # |
| 24 | # Since this might impact performance negatively, it's disabled by default. |
| 25 | # Even if it's disabled we still collect some data, i.e. total number of |
| 26 | # allocations. All other data will be set to a default value. |
| 27 | build_allocation_trace_recorder_full_reporting = false |
| 28 | } |
| 29 | |
André Kempe | ddbe307 | 2023-03-03 18:44:38 | [diff] [blame] | 30 | assert(!(build_allocation_stack_trace_recorder && is_fuchsia), |
| 31 | "Stack trace recording is not supported on Fuchsia due to missing" + |
| 32 | " Crashpad!") |
| 33 | |
| 34 | assert(!(build_allocation_stack_trace_recorder && is_linux), |
| 35 | "WARNING: Stack trace recording is not supported on Linux due to" + |
| 36 | " performance issues computing stack trace!") |
André Kempe | 7c53f62 | 2023-06-26 15:37:14 | [diff] [blame] | 37 | |
| 38 | assert( |
| 39 | build_allocation_stack_trace_recorder || |
| 40 | !build_allocation_trace_recorder_full_reporting, |
| 41 | "Report for stack trace recorder is enabled, but the recorder is disabled!") |