xref: /aosp_15_r20/external/cronet/base/debug/debug.gni (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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
5import("//build/config/compiler/compiler.gni")
6
7declare_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,
16  # we currently enable it only for Android when compiling for Arm64.
17  build_allocation_stack_trace_recorder =
18      !is_official_build && current_cpu == "arm64" && is_android
19}
20
21declare_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
31assert(!(build_allocation_stack_trace_recorder && is_fuchsia),
32       "Stack trace recording is not supported on Fuchsia due to missing" +
33           " Crashpad!")
34
35assert(!(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!")
38
39assert(
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!")
43