blob: 512c9622773f1d873f609cd060555dc69d1570f3 [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
Christopher Ferrisf6d54312017-07-11 15:29:32 -070038cc_library {
39 name: "libunwindstack",
Christopher Ferris6f3981c2017-07-27 09:29:18 -070040 vendor_available: true,
Jiyong Parka0e75042018-05-24 14:11:00 +090041 recovery_available: true,
Justin Yun73bd4f02017-08-04 17:33:54 +090042 vndk: {
43 enabled: true,
44 support_system_process: true,
45 },
Christopher Ferris723cf9b2017-01-19 20:08:48 -080046 defaults: ["libunwindstack_flags"],
Christopher Ferrisd226a512017-07-14 10:37:19 -070047 export_include_dirs: ["include"],
Christopher Ferris723cf9b2017-01-19 20:08:48 -080048
49 srcs: [
50 "ArmExidx.cpp",
David Srbecky18121dc2018-03-12 19:54:22 +000051 "DexFile.cpp",
David Srbeckyb9cc4fb2019-04-05 18:23:32 +000052 "DexFiles.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -070053 "DwarfCfa.cpp",
Christopher Ferrisc9dee842017-11-03 14:50:27 -070054 "DwarfEhFrameWithHdr.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -070055 "DwarfMemory.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -070056 "DwarfOp.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -070057 "DwarfSection.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -080058 "Elf.cpp",
59 "ElfInterface.cpp",
60 "ElfInterfaceArm.cpp",
Christopher Ferris56d0e072018-10-17 10:57:53 -070061 "Global.cpp",
Christopher Ferris150db122017-12-20 18:49:01 -080062 "JitDebug.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080063 "Log.cpp",
Christopher Ferris0d7cf3e2017-04-19 15:42:19 -070064 "MapInfo.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -070065 "Maps.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -080066 "Memory.cpp",
Christopher Ferrisca9a54b2018-04-05 11:15:00 -070067 "LocalUnwinder.cpp",
Christopher Ferrisbae69f12017-06-28 14:51:54 -070068 "Regs.cpp",
Christopher Ferrisd06001d2017-11-30 18:56:01 -080069 "RegsArm.cpp",
70 "RegsArm64.cpp",
71 "RegsX86.cpp",
72 "RegsX86_64.cpp",
Douglas Leung61b1a1a2017-11-08 10:53:53 +010073 "RegsMips.cpp",
74 "RegsMips64.cpp",
Christopher Ferrisb9de87f2017-09-20 13:37:24 -070075 "Unwinder.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -070076 "Symbols.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080077 ],
78
Josh Gaoe22701e2017-10-23 14:25:08 -070079 cflags: [
Christopher Ferris456df692019-11-20 14:46:10 -080080 "-DDEXFILE_SUPPORT",
Josh Gaoe22701e2017-10-23 14:25:08 -070081 "-Wexit-time-destructors",
82 ],
83
Christopher Ferris5f118512017-09-01 11:17:16 -070084 target: {
85 // Always disable optimizations for host to make it easier to debug.
Dan Willemsencd580882017-10-02 10:29:02 -070086 host: {
Elliott Hughesdc699a22018-02-16 17:58:14 -080087 cflags: [
88 "-O0",
89 "-g",
90 ],
Christopher Ferris5f118512017-09-01 11:17:16 -070091 },
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -080092 vendor: {
Christopher Ferris456df692019-11-20 14:46:10 -080093 cflags: ["-UDEXFILE_SUPPORT"],
David Srbecky18121dc2018-03-12 19:54:22 +000094 exclude_srcs: [
95 "DexFile.cpp",
David Srbecky18121dc2018-03-12 19:54:22 +000096 ],
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +000097 exclude_shared_libs: [
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +000098 "libdexfile_support",
99 ],
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800100 },
Jiyong Parka0e75042018-05-24 14:11:00 +0900101 recovery: {
Christopher Ferris456df692019-11-20 14:46:10 -0800102 cflags: ["-UDEXFILE_SUPPORT"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900103 exclude_srcs: [
104 "DexFile.cpp",
Jiyong Parka0e75042018-05-24 14:11:00 +0900105 ],
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000106 exclude_shared_libs: [
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000107 "libdexfile_support",
108 ],
Jiyong Parka0e75042018-05-24 14:11:00 +0900109 },
Christopher Ferris5f118512017-09-01 11:17:16 -0700110 },
111
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700112 arch: {
113 x86: {
114 srcs: ["AsmGetRegsX86.S"],
115 },
116 x86_64: {
117 srcs: ["AsmGetRegsX86_64.S"],
118 },
Douglas Leung61b1a1a2017-11-08 10:53:53 +0100119 mips: {
120 srcs: ["AsmGetRegsMips.S"],
121 },
122 mips64: {
123 srcs: ["AsmGetRegsMips64.S"],
124 },
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700125 },
126
Yabin Cui3841acc2018-05-10 17:19:12 -0700127 static_libs: [
128 "libprocinfo",
129 ],
130
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800131 shared_libs: [
132 "libbase",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000133 "libdexfile_support",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800134 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700135 "liblzma",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800136 ],
137}
138
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800139//-------------------------------------------------------------------------
140// Unit Tests
141//-------------------------------------------------------------------------
Christopher Ferrisca9a54b2018-04-05 11:15:00 -0700142cc_test_library {
143 name: "libunwindstack_local",
144 defaults: ["libunwindstack_flags"],
145 srcs: ["tests/TestLocal.cpp"],
146
147 cflags: [
148 "-O0",
149 "-g",
150 ],
151
152 shared_libs: [
153 "libunwindstack",
154 ],
Christopher Ferris7aba5142019-09-03 10:18:42 -0700155 relative_install_path: "libunwindstack_test",
Christopher Ferrisca9a54b2018-04-05 11:15:00 -0700156}
157
Christopher Ferris7aba5142019-09-03 10:18:42 -0700158cc_defaults {
159 name: "libunwindstack_testlib_flags",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800160 defaults: ["libunwindstack_flags"],
161
162 srcs: [
163 "tests/ArmExidxDecodeTest.cpp",
164 "tests/ArmExidxExtractTest.cpp",
David Srbecky18121dc2018-03-12 19:54:22 +0000165 "tests/DexFileTest.cpp",
166 "tests/DexFilesTest.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -0700167 "tests/DwarfCfaLogTest.cpp",
168 "tests/DwarfCfaTest.cpp",
Christopher Ferris61d40972017-06-12 19:14:20 -0700169 "tests/DwarfDebugFrameTest.cpp",
170 "tests/DwarfEhFrameTest.cpp",
Christopher Ferrisc9dee842017-11-03 14:50:27 -0700171 "tests/DwarfEhFrameWithHdrTest.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -0700172 "tests/DwarfMemoryTest.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -0700173 "tests/DwarfOpLogTest.cpp",
174 "tests/DwarfOpTest.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700175 "tests/DwarfSectionTest.cpp",
176 "tests/DwarfSectionImplTest.cpp",
Christopher Ferris0b79ae12018-01-25 12:15:56 -0800177 "tests/ElfCacheTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700178 "tests/ElfFake.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800179 "tests/ElfInterfaceArmTest.cpp",
180 "tests/ElfInterfaceTest.cpp",
181 "tests/ElfTest.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700182 "tests/ElfTestUtils.cpp",
Christopher Ferrisea8e7d12019-07-17 15:47:32 -0700183 "tests/IsolatedSettings.cpp",
Christopher Ferris150db122017-12-20 18:49:01 -0800184 "tests/JitDebugTest.cpp",
David Srbeckyf1932fd2019-09-16 22:36:55 +0100185 "tests/LocalUpdatableMapsTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800186 "tests/LogFake.cpp",
Christopher Ferris9d5712c2018-10-01 21:01:09 -0700187 "tests/MapInfoCreateMemoryTest.cpp",
Christopher Ferrisbf373ed2019-01-16 17:23:39 -0800188 "tests/MapInfoGetBuildIDTest.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700189 "tests/MapInfoGetElfTest.cpp",
Christopher Ferrisb7de5f52017-12-01 21:37:37 -0800190 "tests/MapInfoGetLoadBiasTest.cpp",
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800191 "tests/MapInfoTest.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -0700192 "tests/MapsTest.cpp",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700193 "tests/MemoryBufferTest.cpp",
Christopher Ferrisef640102018-11-14 15:36:45 -0800194 "tests/MemoryCacheTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800195 "tests/MemoryFake.cpp",
196 "tests/MemoryFileTest.cpp",
197 "tests/MemoryLocalTest.cpp",
Christopher Ferris6633b0c2018-04-03 16:03:28 -0700198 "tests/MemoryOfflineBufferTest.cpp",
Josh Gaof4a94c42017-11-13 16:16:27 -0800199 "tests/MemoryOfflineTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800200 "tests/MemoryRangeTest.cpp",
Christopher Ferris9d5712c2018-10-01 21:01:09 -0700201 "tests/MemoryRangesTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800202 "tests/MemoryRemoteTest.cpp",
Christopher Ferris9744fb22017-07-07 12:18:16 -0700203 "tests/MemoryTest.cpp",
Christopher Ferris27866082018-08-02 15:21:37 -0700204 "tests/RegsInfoTest.cpp",
Josh Gao6f580d82017-09-22 12:57:15 -0700205 "tests/RegsIterateTest.cpp",
Christopher Ferriseb4a6db2017-07-19 12:37:45 -0700206 "tests/RegsStepIfSignalHandlerTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800207 "tests/RegsTest.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -0700208 "tests/SymbolsTest.cpp",
Christopher Ferrise1f7a632019-01-24 12:22:03 -0800209 "tests/TestUtils.cpp",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800210 "tests/UnwindOfflineTest.cpp",
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700211 "tests/UnwindTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700212 "tests/UnwinderTest.cpp",
Christopher Ferris71382322019-08-30 14:02:19 -0700213 "tests/VerifyBionicTerminationTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800214 ],
215
216 cflags: [
217 "-O0",
218 "-g",
219 ],
220
221 shared_libs: [
222 "libbase",
223 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700224 "liblzma",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700225 "libunwindstack",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000226 "libdexfile_support",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800227 ],
228
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700229 static_libs: [
230 "libgmock",
231 ],
232
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700233 test_suites: ["device-tests"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700234 data: [
Christopher Ferris570b76f2017-06-30 17:18:16 -0700235 "tests/files/elf32.xz",
236 "tests/files/elf64.xz",
Yabin Cui11e96fe2018-03-14 18:16:22 -0700237 "tests/files/offline/art_quick_osr_stub_arm/*",
Christopher Ferris1a141a02018-01-24 08:52:47 -0800238 "tests/files/offline/bad_eh_frame_hdr_arm64/*",
239 "tests/files/offline/debug_frame_first_x86/*",
Christopher Ferris4cc36d22018-06-06 14:47:31 -0700240 "tests/files/offline/debug_frame_load_bias_arm/*",
Christopher Ferris5838e532019-10-21 18:59:42 -0700241 "tests/files/offline/eh_frame_bias_x86/*",
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800242 "tests/files/offline/eh_frame_hdr_begin_x86_64/*",
Christopher Ferrisd49499d2019-06-10 18:37:32 -0700243 "tests/files/offline/invalid_elf_offset_arm/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800244 "tests/files/offline/jit_debug_arm/*",
245 "tests/files/offline/jit_debug_x86/*",
Yabin Cuid5b22c52018-02-22 17:11:31 -0800246 "tests/files/offline/jit_map_arm/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800247 "tests/files/offline/gnu_debugdata_arm/*",
Christopher Ferris819f1312019-10-03 13:35:48 -0700248 "tests/files/offline/load_bias_different_section_bias_arm64/*",
Florian Mayer249c90f2019-07-05 16:48:04 +0100249 "tests/files/offline/load_bias_ro_rx_x86_64/*",
Christopher Ferris239425b2018-05-17 18:37:38 -0700250 "tests/files/offline/offset_arm/*",
Christopher Ferris01040b12018-12-10 11:13:23 -0800251 "tests/files/offline/shared_lib_in_apk_arm64/*",
252 "tests/files/offline/shared_lib_in_apk_memory_only_arm64/*",
Christopher Ferris86f2d9d2019-03-12 15:17:36 -0700253 "tests/files/offline/shared_lib_in_apk_single_map_arm64/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800254 "tests/files/offline/straddle_arm/*",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800255 "tests/files/offline/straddle_arm64/*",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700256 ],
Christopher Ferris7aba5142019-09-03 10:18:42 -0700257}
258
259cc_test {
260 name: "libunwindstack_test",
261 defaults: ["libunwindstack_testlib_flags"],
262 isolated: true,
263
264 srcs: [
265 "tests/LocalUnwinderTest.cpp",
266 ],
Elliott Hughesf6d75942018-06-06 10:48:41 -0700267 required: [
268 "libunwindstack_local",
269 ],
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800270}
271
Christopher Ferris7aba5142019-09-03 10:18:42 -0700272// Skip LocalUnwinderTest until atest understands required properly.
273cc_test {
274 name: "libunwindstack_unit_test",
275 defaults: ["libunwindstack_testlib_flags"],
276 isolated: true,
277}
278
Christopher Ferris3958f802017-02-01 15:44:40 -0800279//-------------------------------------------------------------------------
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700280// Tools
Christopher Ferris3958f802017-02-01 15:44:40 -0800281//-------------------------------------------------------------------------
282cc_defaults {
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700283 name: "libunwindstack_tools",
Christopher Ferris3958f802017-02-01 15:44:40 -0800284 defaults: ["libunwindstack_flags"],
285
286 shared_libs: [
287 "libunwindstack",
288 "libbase",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700289 "liblzma",
Christopher Ferris3958f802017-02-01 15:44:40 -0800290 ],
Andreas Gampe8ccbe422018-05-21 08:24:20 -0700291 target: {
292 // Always disable optimizations for host to make it easier to debug.
293 host: {
294 cflags: [
295 "-O0",
296 "-g",
297 ],
298 },
299 },
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700300}
Christopher Ferris3958f802017-02-01 15:44:40 -0800301
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700302cc_binary {
303 name: "unwind",
304 defaults: ["libunwindstack_tools"],
305
306 srcs: [
307 "tools/unwind.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800308 ],
Christopher Ferris3958f802017-02-01 15:44:40 -0800309}
310
311cc_binary {
312 name: "unwind_info",
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700313 defaults: ["libunwindstack_tools"],
Christopher Ferris3958f802017-02-01 15:44:40 -0800314
315 srcs: [
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700316 "tools/unwind_info.cpp",
317 ],
318}
319
320cc_binary {
321 name: "unwind_symbols",
322 defaults: ["libunwindstack_tools"],
323
324 srcs: [
325 "tools/unwind_symbols.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800326 ],
327}
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700328
Christopher Ferris3dfd2ae2017-12-15 20:00:59 -0800329cc_binary {
330 name: "unwind_for_offline",
331 defaults: ["libunwindstack_tools"],
332
333 srcs: [
334 "tools/unwind_for_offline.cpp",
335 ],
336}
337
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800338cc_binary {
339 name: "unwind_reg_info",
340 defaults: ["libunwindstack_tools"],
341
342 srcs: [
343 "tools/unwind_reg_info.cpp",
344 ],
345}
346
Christopher Ferrisef640102018-11-14 15:36:45 -0800347//-------------------------------------------------------------------------
348// Benchmarks
349//-------------------------------------------------------------------------
350cc_benchmark {
351 name: "unwind_benchmarks",
352 host_supported: true,
353 defaults: ["libunwindstack_flags"],
354
355 // Disable optimizations so that all of the calls are not optimized away.
356 cflags: [
357 "-O0",
358 ],
359
360 srcs: [
361 "benchmarks/unwind_benchmarks.cpp",
362 ],
363
364 shared_libs: [
Christopher Ferrisbf373ed2019-01-16 17:23:39 -0800365 "libbase",
Christopher Ferrisef640102018-11-14 15:36:45 -0800366 "libunwindstack",
367 ],
368}
369
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700370// Generates the elf data for use in the tests for .gnu_debugdata frames.
371// Once these files are generated, use the xz command to compress the data.
372cc_binary_host {
373 name: "gen_gnudebugdata",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700374 defaults: ["libunwindstack_flags"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700375
376 srcs: [
377 "tests/GenGnuDebugdata.cpp",
378 ],
379}