• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// ==============================================================
2// libc_malloc_debug_backtrace.a
3// ==============================================================
4// Used by libmemunreachable
5package {
6    default_team: "trendy_team_native_tools_libraries",
7    // See: http://go/android-license-faq
8    // A large-scale-change added 'default_applicable_licenses' to import
9    // all of the 'license_kinds' from "bionic_libc_license"
10    // to get the below license kinds:
11    //   SPDX-license-identifier-Apache-2.0
12    //   SPDX-license-identifier-BSD
13    default_applicable_licenses: ["bionic_libc_license"],
14}
15
16cc_library_static {
17    name: "libc_malloc_debug_backtrace",
18    vendor_available: true,
19
20    srcs: [
21        "backtrace.cpp",
22        "MapData.cpp",
23    ],
24
25    stl: "libc++_static",
26
27    whole_static_libs: [
28        "libbase",
29        "libasync_safe",
30    ],
31
32    include_dirs: ["bionic/libc"],
33
34    export_include_dirs: ["."],
35
36    sanitize: {
37        never: true,
38    },
39    native_coverage: false,
40
41    // -Wno-error=format-zero-length needed for gcc to compile.
42    cflags: [
43        "-Wall",
44        "-Werror",
45        "-Wno-error=format-zero-length",
46    ],
47
48    apex_available: [
49        "//apex_available:platform",
50        "com.android.runtime",
51    ],
52}
53
54// ==============================================================
55// libc_malloc_debug.so
56// ==============================================================
57cc_library {
58    name: "libc_malloc_debug",
59
60    srcs: [
61        "Config.cpp",
62        "DebugData.cpp",
63        "debug_disable.cpp",
64        "GuardData.cpp",
65        "LogAllocatorStats.cpp",
66        "malloc_debug.cpp",
67        "PointerData.cpp",
68        "RecordData.cpp",
69        "Unreachable.cpp",
70        "UnwindBacktrace.cpp",
71    ],
72
73    stl: "libc++_static",
74
75    static_libs: [
76        "libasync_safe",
77        "libbase",
78        "libc_malloc_debug_backtrace",
79        "libmemunreachable",
80    ],
81
82    whole_static_libs: [
83        "libmemory_trace",
84    ],
85
86    shared_libs: [
87        "libunwindstack",
88    ],
89
90    multilib: {
91        lib32: {
92            version_script: "exported32.map",
93        },
94        lib64: {
95            version_script: "exported64.map",
96        },
97    },
98    allow_undefined_symbols: true,
99    include_dirs: ["bionic/libc"],
100
101    sanitize: {
102        never: true,
103    },
104    native_coverage: false,
105
106    // -Wno-error=format-zero-length needed for gcc to compile.
107    cflags: [
108        "-Wall",
109        "-Werror",
110        "-fno-stack-protector",
111        "-Wno-error=format-zero-length",
112        "-Wthread-safety",
113    ],
114
115    apex_available: [
116        "com.android.runtime",
117    ],
118    static: {
119        apex_available: [
120            "//apex_available:platform",
121        ],
122    },
123}
124
125// ==============================================================
126// Unit Tests
127// ==============================================================
128cc_test {
129    name: "malloc_debug_unit_tests",
130    test_suites: ["device-tests"],
131    isolated: true,
132
133    srcs: [
134        "tests/backtrace_fake.cpp",
135        "tests/log_fake.cpp",
136        "tests/libc_fake.cpp",
137        "tests/malloc_debug_config_tests.cpp",
138        "tests/malloc_debug_record_data_tests.cpp",
139        "tests/malloc_debug_unit_tests.cpp",
140    ],
141
142    local_include_dirs: ["tests"],
143    include_dirs: [
144        "bionic/libc",
145        "bionic/libc/async_safe/include",
146    ],
147
148    header_libs: [
149        "bionic_libc_platform_headers",
150    ],
151
152    static_libs: [
153        "libc_malloc_debug",
154        "libtinyxml2",
155    ],
156
157    shared_libs: [
158        "libbase",
159        "libunwindstack",
160    ],
161
162    cflags: [
163        "-Wall",
164        "-Werror",
165        "-Wno-error=format-zero-length",
166        "-O0",
167    ],
168}
169
170// ==============================================================
171// System Tests
172// ==============================================================
173cc_test {
174    name: "malloc_debug_system_tests",
175    isolated: true,
176
177    include_dirs: [
178        "bionic/libc",
179        "bionic", // For SKIP_WITH_HWASAN.
180    ],
181
182    header_libs: [
183        "bionic_libc_platform_headers",
184    ],
185
186    srcs: [
187        "tests/malloc_debug_system_tests.cpp",
188    ],
189
190    shared_libs: [
191        "libbase",
192        "liblog",
193        "libunwindstack",
194    ],
195
196    cflags: [
197        "-Wall",
198        "-Werror",
199        "-O0",
200    ],
201    test_suites: ["general-tests"],
202    test_config: "tests/AndroidTest.xml",
203}
204