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