blob: c90f5b271b9777d91e18cf9c490f4eafc7549fcd [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",
52 "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: [
80 "-Wexit-time-destructors",
81 ],
82
Christopher Ferris5f118512017-09-01 11:17:16 -070083 target: {
84 // Always disable optimizations for host to make it easier to debug.
Dan Willemsencd580882017-10-02 10:29:02 -070085 host: {
Elliott Hughesdc699a22018-02-16 17:58:14 -080086 cflags: [
87 "-O0",
88 "-g",
89 ],
Christopher Ferris5f118512017-09-01 11:17:16 -070090 },
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -080091 vendor: {
92 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
David Srbecky18121dc2018-03-12 19:54:22 +000093 exclude_srcs: [
94 "DexFile.cpp",
95 "DexFiles.cpp",
96 ],
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +000097 exclude_shared_libs: [
98 "libdexfile_external",
99 "libdexfile_support",
100 ],
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800101 },
Jiyong Parka0e75042018-05-24 14:11:00 +0900102 recovery: {
103 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
104 exclude_srcs: [
105 "DexFile.cpp",
106 "DexFiles.cpp",
107 ],
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000108 exclude_shared_libs: [
109 "libdexfile_external",
110 "libdexfile_support",
111 ],
Jiyong Parka0e75042018-05-24 14:11:00 +0900112 },
Christopher Ferris5f118512017-09-01 11:17:16 -0700113 },
114
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700115 arch: {
116 x86: {
117 srcs: ["AsmGetRegsX86.S"],
118 },
119 x86_64: {
120 srcs: ["AsmGetRegsX86_64.S"],
121 },
Douglas Leung61b1a1a2017-11-08 10:53:53 +0100122 mips: {
123 srcs: ["AsmGetRegsMips.S"],
124 },
125 mips64: {
126 srcs: ["AsmGetRegsMips64.S"],
127 },
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700128 },
129
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800130 whole_static_libs: [
131 "libdemangle"
132 ],
133
Yabin Cui3841acc2018-05-10 17:19:12 -0700134 static_libs: [
135 "libprocinfo",
136 ],
137
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800138 shared_libs: [
139 "libbase",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000140 "libdexfile_external",
141 "libdexfile_support",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800142 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700143 "liblzma",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800144 ],
145}
146
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800147//-------------------------------------------------------------------------
148// Unit Tests
149//-------------------------------------------------------------------------
Christopher Ferrisca9a54b2018-04-05 11:15:00 -0700150cc_test_library {
151 name: "libunwindstack_local",
152 defaults: ["libunwindstack_flags"],
153 srcs: ["tests/TestLocal.cpp"],
154
155 cflags: [
156 "-O0",
157 "-g",
158 ],
159
160 shared_libs: [
161 "libunwindstack",
162 ],
163}
164
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700165cc_test {
166 name: "libunwindstack_test",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800167 defaults: ["libunwindstack_flags"],
168
169 srcs: [
170 "tests/ArmExidxDecodeTest.cpp",
171 "tests/ArmExidxExtractTest.cpp",
David Srbecky18121dc2018-03-12 19:54:22 +0000172 "tests/DexFileTest.cpp",
173 "tests/DexFilesTest.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -0700174 "tests/DwarfCfaLogTest.cpp",
175 "tests/DwarfCfaTest.cpp",
Christopher Ferris61d40972017-06-12 19:14:20 -0700176 "tests/DwarfDebugFrameTest.cpp",
177 "tests/DwarfEhFrameTest.cpp",
Christopher Ferrisc9dee842017-11-03 14:50:27 -0700178 "tests/DwarfEhFrameWithHdrTest.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -0700179 "tests/DwarfMemoryTest.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -0700180 "tests/DwarfOpLogTest.cpp",
181 "tests/DwarfOpTest.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700182 "tests/DwarfSectionTest.cpp",
183 "tests/DwarfSectionImplTest.cpp",
Christopher Ferris0b79ae12018-01-25 12:15:56 -0800184 "tests/ElfCacheTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700185 "tests/ElfFake.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800186 "tests/ElfInterfaceArmTest.cpp",
187 "tests/ElfInterfaceTest.cpp",
188 "tests/ElfTest.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700189 "tests/ElfTestUtils.cpp",
Christopher Ferris150db122017-12-20 18:49:01 -0800190 "tests/JitDebugTest.cpp",
Christopher Ferrisca9a54b2018-04-05 11:15:00 -0700191 "tests/LocalUnwinderTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800192 "tests/LogFake.cpp",
Christopher Ferris9d5712c2018-10-01 21:01:09 -0700193 "tests/MapInfoCreateMemoryTest.cpp",
Christopher Ferrisbf373ed2019-01-16 17:23:39 -0800194 "tests/MapInfoGetBuildIDTest.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700195 "tests/MapInfoGetElfTest.cpp",
Christopher Ferrisb7de5f52017-12-01 21:37:37 -0800196 "tests/MapInfoGetLoadBiasTest.cpp",
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800197 "tests/MapInfoTest.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -0700198 "tests/MapsTest.cpp",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700199 "tests/MemoryBufferTest.cpp",
Christopher Ferrisef640102018-11-14 15:36:45 -0800200 "tests/MemoryCacheTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800201 "tests/MemoryFake.cpp",
202 "tests/MemoryFileTest.cpp",
203 "tests/MemoryLocalTest.cpp",
Christopher Ferris6633b0c2018-04-03 16:03:28 -0700204 "tests/MemoryOfflineBufferTest.cpp",
Josh Gaof4a94c42017-11-13 16:16:27 -0800205 "tests/MemoryOfflineTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800206 "tests/MemoryRangeTest.cpp",
Christopher Ferris9d5712c2018-10-01 21:01:09 -0700207 "tests/MemoryRangesTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800208 "tests/MemoryRemoteTest.cpp",
Christopher Ferris9744fb22017-07-07 12:18:16 -0700209 "tests/MemoryTest.cpp",
Christopher Ferris27866082018-08-02 15:21:37 -0700210 "tests/RegsInfoTest.cpp",
Josh Gao6f580d82017-09-22 12:57:15 -0700211 "tests/RegsIterateTest.cpp",
Christopher Ferriseb4a6db2017-07-19 12:37:45 -0700212 "tests/RegsStepIfSignalHandlerTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800213 "tests/RegsTest.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -0700214 "tests/SymbolsTest.cpp",
Christopher Ferrise1f7a632019-01-24 12:22:03 -0800215 "tests/TestUtils.cpp",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800216 "tests/UnwindOfflineTest.cpp",
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700217 "tests/UnwindTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700218 "tests/UnwinderTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800219 ],
220
221 cflags: [
222 "-O0",
223 "-g",
224 ],
225
226 shared_libs: [
227 "libbase",
228 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700229 "liblzma",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700230 "libunwindstack",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000231 "libdexfile_support",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800232 ],
233
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700234 static_libs: [
235 "libgmock",
236 ],
237
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700238 test_suites: ["device-tests"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700239 data: [
Christopher Ferris570b76f2017-06-30 17:18:16 -0700240 "tests/files/elf32.xz",
241 "tests/files/elf64.xz",
Yabin Cui11e96fe2018-03-14 18:16:22 -0700242 "tests/files/offline/art_quick_osr_stub_arm/*",
Christopher Ferris1a141a02018-01-24 08:52:47 -0800243 "tests/files/offline/bad_eh_frame_hdr_arm64/*",
244 "tests/files/offline/debug_frame_first_x86/*",
Christopher Ferris4cc36d22018-06-06 14:47:31 -0700245 "tests/files/offline/debug_frame_load_bias_arm/*",
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800246 "tests/files/offline/eh_frame_hdr_begin_x86_64/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800247 "tests/files/offline/jit_debug_arm/*",
248 "tests/files/offline/jit_debug_x86/*",
Yabin Cuid5b22c52018-02-22 17:11:31 -0800249 "tests/files/offline/jit_map_arm/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800250 "tests/files/offline/gnu_debugdata_arm/*",
Christopher Ferris239425b2018-05-17 18:37:38 -0700251 "tests/files/offline/offset_arm/*",
Christopher Ferris01040b12018-12-10 11:13:23 -0800252 "tests/files/offline/shared_lib_in_apk_arm64/*",
253 "tests/files/offline/shared_lib_in_apk_memory_only_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 ],
Elliott Hughesf6d75942018-06-06 10:48:41 -0700257 required: [
258 "libunwindstack_local",
259 ],
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800260}
261
Christopher Ferris3958f802017-02-01 15:44:40 -0800262//-------------------------------------------------------------------------
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700263// Tools
Christopher Ferris3958f802017-02-01 15:44:40 -0800264//-------------------------------------------------------------------------
265cc_defaults {
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700266 name: "libunwindstack_tools",
Christopher Ferris3958f802017-02-01 15:44:40 -0800267 defaults: ["libunwindstack_flags"],
268
269 shared_libs: [
270 "libunwindstack",
271 "libbase",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700272 "liblzma",
Christopher Ferris3958f802017-02-01 15:44:40 -0800273 ],
Andreas Gampe8ccbe422018-05-21 08:24:20 -0700274 target: {
275 // Always disable optimizations for host to make it easier to debug.
276 host: {
277 cflags: [
278 "-O0",
279 "-g",
280 ],
281 },
282 },
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700283}
Christopher Ferris3958f802017-02-01 15:44:40 -0800284
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700285cc_binary {
286 name: "unwind",
287 defaults: ["libunwindstack_tools"],
288
289 srcs: [
290 "tools/unwind.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800291 ],
Christopher Ferris3958f802017-02-01 15:44:40 -0800292}
293
294cc_binary {
295 name: "unwind_info",
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700296 defaults: ["libunwindstack_tools"],
Christopher Ferris3958f802017-02-01 15:44:40 -0800297
298 srcs: [
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700299 "tools/unwind_info.cpp",
300 ],
301}
302
303cc_binary {
304 name: "unwind_symbols",
305 defaults: ["libunwindstack_tools"],
306
307 srcs: [
308 "tools/unwind_symbols.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800309 ],
310}
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700311
Christopher Ferris3dfd2ae2017-12-15 20:00:59 -0800312cc_binary {
313 name: "unwind_for_offline",
314 defaults: ["libunwindstack_tools"],
315
316 srcs: [
317 "tools/unwind_for_offline.cpp",
318 ],
319}
320
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800321cc_binary {
322 name: "unwind_reg_info",
323 defaults: ["libunwindstack_tools"],
324
325 srcs: [
326 "tools/unwind_reg_info.cpp",
327 ],
328}
329
Christopher Ferrisef640102018-11-14 15:36:45 -0800330//-------------------------------------------------------------------------
331// Benchmarks
332//-------------------------------------------------------------------------
333cc_benchmark {
334 name: "unwind_benchmarks",
335 host_supported: true,
336 defaults: ["libunwindstack_flags"],
337
338 // Disable optimizations so that all of the calls are not optimized away.
339 cflags: [
340 "-O0",
341 ],
342
343 srcs: [
344 "benchmarks/unwind_benchmarks.cpp",
345 ],
346
347 shared_libs: [
Christopher Ferrisbf373ed2019-01-16 17:23:39 -0800348 "libbase",
Christopher Ferrisef640102018-11-14 15:36:45 -0800349 "libunwindstack",
350 ],
351}
352
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700353// Generates the elf data for use in the tests for .gnu_debugdata frames.
354// Once these files are generated, use the xz command to compress the data.
355cc_binary_host {
356 name: "gen_gnudebugdata",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700357 defaults: ["libunwindstack_flags"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700358
359 srcs: [
360 "tests/GenGnuDebugdata.cpp",
361 ],
362}