blob: 1f3ba596aafce229232799126f60bff799b92004 [file] [log] [blame]
Christopher Ferris723cf9b2017-01-19 20:08:48 -08001//
2// Copyright (C) 2017 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17cc_defaults {
18 name: "libunwindstack_flags",
19
20 host_supported: true,
21
22 cflags: [
23 "-Wall",
24 "-Werror",
25 "-Wextra",
26 ],
Christopher Ferris01d50372017-01-30 13:45:16 -080027
28 target: {
29 darwin: {
30 enabled: false,
31 },
Dan Willemsen0f048672017-09-19 17:53:12 -070032 linux_bionic: {
33 enabled: true,
34 },
Christopher Ferris01d50372017-01-30 13:45:16 -080035 },
Christopher Ferris723cf9b2017-01-19 20:08:48 -080036}
37
Martin Stjernholmae695c92019-10-23 21:32:43 +010038cc_defaults {
39 name: "libunwindstack_defaults",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080040 defaults: ["libunwindstack_flags"],
Christopher Ferrisd226a512017-07-14 10:37:19 -070041 export_include_dirs: ["include"],
Christopher Ferris723cf9b2017-01-19 20:08:48 -080042
43 srcs: [
44 "ArmExidx.cpp",
David Srbeckyb9cc4fb2019-04-05 18:23:32 +000045 "DexFiles.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -070046 "DwarfCfa.cpp",
Christopher Ferrisc9dee842017-11-03 14:50:27 -070047 "DwarfEhFrameWithHdr.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -070048 "DwarfMemory.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -070049 "DwarfOp.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -070050 "DwarfSection.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -080051 "Elf.cpp",
52 "ElfInterface.cpp",
53 "ElfInterfaceArm.cpp",
Christopher Ferris56d0e072018-10-17 10:57:53 -070054 "Global.cpp",
Christopher Ferris150db122017-12-20 18:49:01 -080055 "JitDebug.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080056 "Log.cpp",
Christopher Ferris0d7cf3e2017-04-19 15:42:19 -070057 "MapInfo.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -070058 "Maps.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -080059 "Memory.cpp",
Christopher Ferrisca9a54b2018-04-05 11:15:00 -070060 "LocalUnwinder.cpp",
Christopher Ferrisbae69f12017-06-28 14:51:54 -070061 "Regs.cpp",
Christopher Ferrisd06001d2017-11-30 18:56:01 -080062 "RegsArm.cpp",
63 "RegsArm64.cpp",
64 "RegsX86.cpp",
65 "RegsX86_64.cpp",
Douglas Leung61b1a1a2017-11-08 10:53:53 +010066 "RegsMips.cpp",
67 "RegsMips64.cpp",
Christopher Ferrisb9de87f2017-09-20 13:37:24 -070068 "Unwinder.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -070069 "Symbols.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080070 ],
71
Josh Gaoe22701e2017-10-23 14:25:08 -070072 cflags: [
73 "-Wexit-time-destructors",
74 ],
75
Christopher Ferris5f118512017-09-01 11:17:16 -070076 target: {
77 // Always disable optimizations for host to make it easier to debug.
Dan Willemsencd580882017-10-02 10:29:02 -070078 host: {
Elliott Hughesdc699a22018-02-16 17:58:14 -080079 cflags: [
80 "-O0",
81 "-g",
82 ],
Christopher Ferris5f118512017-09-01 11:17:16 -070083 },
84 },
85
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070086 arch: {
87 x86: {
88 srcs: ["AsmGetRegsX86.S"],
89 },
90 x86_64: {
91 srcs: ["AsmGetRegsX86_64.S"],
92 },
Douglas Leung61b1a1a2017-11-08 10:53:53 +010093 mips: {
94 srcs: ["AsmGetRegsMips.S"],
95 },
96 mips64: {
97 srcs: ["AsmGetRegsMips64.S"],
98 },
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070099 },
100
Yabin Cui3841acc2018-05-10 17:19:12 -0700101 static_libs: [
102 "libprocinfo",
103 ],
104
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800105 shared_libs: [
106 "libbase",
107 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700108 "liblzma",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800109 ],
110}
111
Martin Stjernholmae695c92019-10-23 21:32:43 +0100112cc_library {
113 name: "libunwindstack",
114 vendor_available: true,
115 recovery_available: true,
116 vndk: {
117 enabled: true,
118 support_system_process: true,
119 },
120 defaults: ["libunwindstack_defaults"],
121
122 srcs: ["DexFile.cpp"],
123 cflags: ["-DDEXFILE_SUPPORT"],
124 shared_libs: ["libdexfile_support"],
125
126 target: {
127 vendor: {
128 cflags: ["-UDEXFILE_SUPPORT"],
129 exclude_srcs: ["DexFile.cpp"],
130 exclude_shared_libs: ["libdexfile_support"],
131 },
132 recovery: {
133 cflags: ["-UDEXFILE_SUPPORT"],
134 exclude_srcs: ["DexFile.cpp"],
135 exclude_shared_libs: ["libdexfile_support"],
136 },
137 },
138}
139
140// Static library without DEX support to avoid dependencies on the ART APEX.
141cc_library_static {
142 name: "libunwindstack_no_dex",
143 recovery_available: true,
144 defaults: ["libunwindstack_defaults"],
145
146 visibility: [
147 "//system/core/debuggerd",
148 "//system/core/init",
149 "//system/core/libbacktrace",
150 ],
151 apex_available: [
152 "//apex_available:platform",
153 "com.android.runtime",
154 ],
155}
156
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800157//-------------------------------------------------------------------------
158// Unit Tests
159//-------------------------------------------------------------------------
Christopher Ferrisca9a54b2018-04-05 11:15:00 -0700160cc_test_library {
161 name: "libunwindstack_local",
162 defaults: ["libunwindstack_flags"],
163 srcs: ["tests/TestLocal.cpp"],
164
165 cflags: [
166 "-O0",
167 "-g",
168 ],
169
170 shared_libs: [
171 "libunwindstack",
172 ],
Christopher Ferris7aba5142019-09-03 10:18:42 -0700173 relative_install_path: "libunwindstack_test",
Christopher Ferrisca9a54b2018-04-05 11:15:00 -0700174}
175
Christopher Ferris7aba5142019-09-03 10:18:42 -0700176cc_defaults {
177 name: "libunwindstack_testlib_flags",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800178 defaults: ["libunwindstack_flags"],
179
180 srcs: [
181 "tests/ArmExidxDecodeTest.cpp",
182 "tests/ArmExidxExtractTest.cpp",
David Srbecky18121dc2018-03-12 19:54:22 +0000183 "tests/DexFileTest.cpp",
184 "tests/DexFilesTest.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -0700185 "tests/DwarfCfaLogTest.cpp",
186 "tests/DwarfCfaTest.cpp",
Christopher Ferris61d40972017-06-12 19:14:20 -0700187 "tests/DwarfDebugFrameTest.cpp",
188 "tests/DwarfEhFrameTest.cpp",
Christopher Ferrisc9dee842017-11-03 14:50:27 -0700189 "tests/DwarfEhFrameWithHdrTest.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -0700190 "tests/DwarfMemoryTest.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -0700191 "tests/DwarfOpLogTest.cpp",
192 "tests/DwarfOpTest.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700193 "tests/DwarfSectionTest.cpp",
194 "tests/DwarfSectionImplTest.cpp",
Christopher Ferris0b79ae12018-01-25 12:15:56 -0800195 "tests/ElfCacheTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700196 "tests/ElfFake.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800197 "tests/ElfInterfaceArmTest.cpp",
198 "tests/ElfInterfaceTest.cpp",
199 "tests/ElfTest.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700200 "tests/ElfTestUtils.cpp",
Christopher Ferrisea8e7d12019-07-17 15:47:32 -0700201 "tests/IsolatedSettings.cpp",
Christopher Ferris150db122017-12-20 18:49:01 -0800202 "tests/JitDebugTest.cpp",
David Srbeckyf1932fd2019-09-16 22:36:55 +0100203 "tests/LocalUpdatableMapsTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800204 "tests/LogFake.cpp",
Christopher Ferris9d5712c2018-10-01 21:01:09 -0700205 "tests/MapInfoCreateMemoryTest.cpp",
Christopher Ferrisbf373ed2019-01-16 17:23:39 -0800206 "tests/MapInfoGetBuildIDTest.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700207 "tests/MapInfoGetElfTest.cpp",
Christopher Ferrisb7de5f52017-12-01 21:37:37 -0800208 "tests/MapInfoGetLoadBiasTest.cpp",
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800209 "tests/MapInfoTest.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -0700210 "tests/MapsTest.cpp",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700211 "tests/MemoryBufferTest.cpp",
Christopher Ferrisef640102018-11-14 15:36:45 -0800212 "tests/MemoryCacheTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800213 "tests/MemoryFake.cpp",
214 "tests/MemoryFileTest.cpp",
215 "tests/MemoryLocalTest.cpp",
Christopher Ferris6633b0c2018-04-03 16:03:28 -0700216 "tests/MemoryOfflineBufferTest.cpp",
Josh Gaof4a94c42017-11-13 16:16:27 -0800217 "tests/MemoryOfflineTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800218 "tests/MemoryRangeTest.cpp",
Christopher Ferris9d5712c2018-10-01 21:01:09 -0700219 "tests/MemoryRangesTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800220 "tests/MemoryRemoteTest.cpp",
Christopher Ferris9744fb22017-07-07 12:18:16 -0700221 "tests/MemoryTest.cpp",
Christopher Ferris27866082018-08-02 15:21:37 -0700222 "tests/RegsInfoTest.cpp",
Josh Gao6f580d82017-09-22 12:57:15 -0700223 "tests/RegsIterateTest.cpp",
Christopher Ferriseb4a6db2017-07-19 12:37:45 -0700224 "tests/RegsStepIfSignalHandlerTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800225 "tests/RegsTest.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -0700226 "tests/SymbolsTest.cpp",
Christopher Ferrise1f7a632019-01-24 12:22:03 -0800227 "tests/TestUtils.cpp",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800228 "tests/UnwindOfflineTest.cpp",
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700229 "tests/UnwindTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700230 "tests/UnwinderTest.cpp",
Christopher Ferris71382322019-08-30 14:02:19 -0700231 "tests/VerifyBionicTerminationTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800232 ],
233
234 cflags: [
235 "-O0",
236 "-g",
237 ],
238
239 shared_libs: [
240 "libbase",
241 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700242 "liblzma",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700243 "libunwindstack",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000244 "libdexfile_support",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800245 ],
246
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700247 static_libs: [
248 "libgmock",
249 ],
250
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700251 test_suites: ["device-tests"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700252 data: [
Christopher Ferris570b76f2017-06-30 17:18:16 -0700253 "tests/files/elf32.xz",
254 "tests/files/elf64.xz",
Yabin Cui11e96fe2018-03-14 18:16:22 -0700255 "tests/files/offline/art_quick_osr_stub_arm/*",
Christopher Ferris1a141a02018-01-24 08:52:47 -0800256 "tests/files/offline/bad_eh_frame_hdr_arm64/*",
257 "tests/files/offline/debug_frame_first_x86/*",
Christopher Ferris4cc36d22018-06-06 14:47:31 -0700258 "tests/files/offline/debug_frame_load_bias_arm/*",
Christopher Ferris5838e532019-10-21 18:59:42 -0700259 "tests/files/offline/eh_frame_bias_x86/*",
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800260 "tests/files/offline/eh_frame_hdr_begin_x86_64/*",
Christopher Ferris0f40a052020-01-22 12:17:06 -0800261 "tests/files/offline/empty_arm64/*",
Christopher Ferrisd49499d2019-06-10 18:37:32 -0700262 "tests/files/offline/invalid_elf_offset_arm/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800263 "tests/files/offline/jit_debug_arm/*",
264 "tests/files/offline/jit_debug_x86/*",
Yabin Cuid5b22c52018-02-22 17:11:31 -0800265 "tests/files/offline/jit_map_arm/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800266 "tests/files/offline/gnu_debugdata_arm/*",
Christopher Ferris819f1312019-10-03 13:35:48 -0700267 "tests/files/offline/load_bias_different_section_bias_arm64/*",
Florian Mayer249c90f2019-07-05 16:48:04 +0100268 "tests/files/offline/load_bias_ro_rx_x86_64/*",
Christopher Ferris239425b2018-05-17 18:37:38 -0700269 "tests/files/offline/offset_arm/*",
Christopher Ferris01040b12018-12-10 11:13:23 -0800270 "tests/files/offline/shared_lib_in_apk_arm64/*",
271 "tests/files/offline/shared_lib_in_apk_memory_only_arm64/*",
Christopher Ferris86f2d9d2019-03-12 15:17:36 -0700272 "tests/files/offline/shared_lib_in_apk_single_map_arm64/*",
Christopher Ferrisf0c82e72019-12-04 13:37:11 -0800273 "tests/files/offline/signal_load_bias_arm/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800274 "tests/files/offline/straddle_arm/*",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800275 "tests/files/offline/straddle_arm64/*",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700276 ],
Christopher Ferris7aba5142019-09-03 10:18:42 -0700277}
278
279cc_test {
280 name: "libunwindstack_test",
281 defaults: ["libunwindstack_testlib_flags"],
282 isolated: true,
283
284 srcs: [
285 "tests/LocalUnwinderTest.cpp",
286 ],
Elliott Hughesf6d75942018-06-06 10:48:41 -0700287 required: [
288 "libunwindstack_local",
289 ],
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800290}
291
Christopher Ferris7aba5142019-09-03 10:18:42 -0700292// Skip LocalUnwinderTest until atest understands required properly.
293cc_test {
294 name: "libunwindstack_unit_test",
295 defaults: ["libunwindstack_testlib_flags"],
296 isolated: true,
297}
298
Christopher Ferris3958f802017-02-01 15:44:40 -0800299//-------------------------------------------------------------------------
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700300// Tools
Christopher Ferris3958f802017-02-01 15:44:40 -0800301//-------------------------------------------------------------------------
302cc_defaults {
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700303 name: "libunwindstack_tools",
Christopher Ferris3958f802017-02-01 15:44:40 -0800304 defaults: ["libunwindstack_flags"],
305
306 shared_libs: [
307 "libunwindstack",
308 "libbase",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700309 "liblzma",
Christopher Ferris3958f802017-02-01 15:44:40 -0800310 ],
Andreas Gampe8ccbe422018-05-21 08:24:20 -0700311 target: {
312 // Always disable optimizations for host to make it easier to debug.
313 host: {
314 cflags: [
315 "-O0",
316 "-g",
317 ],
318 },
319 },
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700320}
Christopher Ferris3958f802017-02-01 15:44:40 -0800321
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700322cc_binary {
323 name: "unwind",
324 defaults: ["libunwindstack_tools"],
325
326 srcs: [
327 "tools/unwind.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800328 ],
Christopher Ferris3958f802017-02-01 15:44:40 -0800329}
330
331cc_binary {
332 name: "unwind_info",
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700333 defaults: ["libunwindstack_tools"],
Christopher Ferris3958f802017-02-01 15:44:40 -0800334
335 srcs: [
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700336 "tools/unwind_info.cpp",
337 ],
338}
339
340cc_binary {
341 name: "unwind_symbols",
342 defaults: ["libunwindstack_tools"],
343
344 srcs: [
345 "tools/unwind_symbols.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800346 ],
347}
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700348
Christopher Ferris3dfd2ae2017-12-15 20:00:59 -0800349cc_binary {
350 name: "unwind_for_offline",
351 defaults: ["libunwindstack_tools"],
352
353 srcs: [
354 "tools/unwind_for_offline.cpp",
355 ],
356}
357
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800358cc_binary {
359 name: "unwind_reg_info",
360 defaults: ["libunwindstack_tools"],
361
362 srcs: [
363 "tools/unwind_reg_info.cpp",
364 ],
365}
366
Christopher Ferrisef640102018-11-14 15:36:45 -0800367//-------------------------------------------------------------------------
368// Benchmarks
369//-------------------------------------------------------------------------
370cc_benchmark {
371 name: "unwind_benchmarks",
372 host_supported: true,
373 defaults: ["libunwindstack_flags"],
374
375 // Disable optimizations so that all of the calls are not optimized away.
376 cflags: [
377 "-O0",
378 ],
379
380 srcs: [
381 "benchmarks/unwind_benchmarks.cpp",
382 ],
383
384 shared_libs: [
Christopher Ferrisbf373ed2019-01-16 17:23:39 -0800385 "libbase",
Christopher Ferrisef640102018-11-14 15:36:45 -0800386 "libunwindstack",
387 ],
388}
389
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700390// Generates the elf data for use in the tests for .gnu_debugdata frames.
391// Once these files are generated, use the xz command to compress the data.
392cc_binary_host {
393 name: "gen_gnudebugdata",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700394 defaults: ["libunwindstack_flags"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700395
396 srcs: [
397 "tests/GenGnuDebugdata.cpp",
398 ],
399}