blob: d4cef7cde86537381389baf77f00d6ceb9e2a974 [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 Ferris150db122017-12-20 18:49:01 -080061 "JitDebug.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080062 "Log.cpp",
Christopher Ferris0d7cf3e2017-04-19 15:42:19 -070063 "MapInfo.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -070064 "Maps.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -080065 "Memory.cpp",
Christopher Ferrisca9a54b2018-04-05 11:15:00 -070066 "LocalUnwinder.cpp",
Christopher Ferrisbae69f12017-06-28 14:51:54 -070067 "Regs.cpp",
Christopher Ferrisd06001d2017-11-30 18:56:01 -080068 "RegsArm.cpp",
69 "RegsArm64.cpp",
70 "RegsX86.cpp",
71 "RegsX86_64.cpp",
Douglas Leung61b1a1a2017-11-08 10:53:53 +010072 "RegsMips.cpp",
73 "RegsMips64.cpp",
Christopher Ferrisb9de87f2017-09-20 13:37:24 -070074 "Unwinder.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -070075 "Symbols.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080076 ],
77
Josh Gaoe22701e2017-10-23 14:25:08 -070078 cflags: [
79 "-Wexit-time-destructors",
80 ],
81
Christopher Ferris5f118512017-09-01 11:17:16 -070082 target: {
83 // Always disable optimizations for host to make it easier to debug.
Dan Willemsencd580882017-10-02 10:29:02 -070084 host: {
Elliott Hughesdc699a22018-02-16 17:58:14 -080085 cflags: [
86 "-O0",
87 "-g",
88 ],
Christopher Ferris5f118512017-09-01 11:17:16 -070089 },
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -080090 vendor: {
91 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
David Srbecky18121dc2018-03-12 19:54:22 +000092 exclude_srcs: [
93 "DexFile.cpp",
94 "DexFiles.cpp",
95 ],
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -080096 exclude_shared_libs: ["libdexfile"],
97 },
Jiyong Parka0e75042018-05-24 14:11:00 +090098 recovery: {
99 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
100 exclude_srcs: [
101 "DexFile.cpp",
102 "DexFiles.cpp",
103 ],
104 exclude_shared_libs: ["libdexfile"],
105 },
Christopher Ferris5f118512017-09-01 11:17:16 -0700106 },
107
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700108 arch: {
109 x86: {
110 srcs: ["AsmGetRegsX86.S"],
111 },
112 x86_64: {
113 srcs: ["AsmGetRegsX86_64.S"],
114 },
Douglas Leung61b1a1a2017-11-08 10:53:53 +0100115 mips: {
116 srcs: ["AsmGetRegsMips.S"],
117 },
118 mips64: {
119 srcs: ["AsmGetRegsMips64.S"],
120 },
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700121 },
122
Yabin Cui3841acc2018-05-10 17:19:12 -0700123 static_libs: [
124 "libprocinfo",
125 ],
126
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800127 shared_libs: [
128 "libbase",
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800129 "libdexfile",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800130 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700131 "liblzma",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800132 ],
133}
134
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800135//-------------------------------------------------------------------------
136// Unit Tests
137//-------------------------------------------------------------------------
Christopher Ferrisca9a54b2018-04-05 11:15:00 -0700138cc_test_library {
139 name: "libunwindstack_local",
140 defaults: ["libunwindstack_flags"],
141 srcs: ["tests/TestLocal.cpp"],
142
143 cflags: [
144 "-O0",
145 "-g",
146 ],
147
148 shared_libs: [
149 "libunwindstack",
150 ],
151}
152
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700153cc_test {
154 name: "libunwindstack_test",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800155 defaults: ["libunwindstack_flags"],
156
157 srcs: [
158 "tests/ArmExidxDecodeTest.cpp",
159 "tests/ArmExidxExtractTest.cpp",
David Srbecky18121dc2018-03-12 19:54:22 +0000160 "tests/DexFileTest.cpp",
161 "tests/DexFilesTest.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -0700162 "tests/DwarfCfaLogTest.cpp",
163 "tests/DwarfCfaTest.cpp",
Christopher Ferris61d40972017-06-12 19:14:20 -0700164 "tests/DwarfDebugFrameTest.cpp",
165 "tests/DwarfEhFrameTest.cpp",
Christopher Ferrisc9dee842017-11-03 14:50:27 -0700166 "tests/DwarfEhFrameWithHdrTest.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -0700167 "tests/DwarfMemoryTest.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -0700168 "tests/DwarfOpLogTest.cpp",
169 "tests/DwarfOpTest.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700170 "tests/DwarfSectionTest.cpp",
171 "tests/DwarfSectionImplTest.cpp",
Christopher Ferris0b79ae12018-01-25 12:15:56 -0800172 "tests/ElfCacheTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700173 "tests/ElfFake.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800174 "tests/ElfInterfaceArmTest.cpp",
175 "tests/ElfInterfaceTest.cpp",
176 "tests/ElfTest.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700177 "tests/ElfTestUtils.cpp",
Christopher Ferris150db122017-12-20 18:49:01 -0800178 "tests/JitDebugTest.cpp",
Christopher Ferrisca9a54b2018-04-05 11:15:00 -0700179 "tests/LocalUnwinderTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800180 "tests/LogFake.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700181 "tests/MapInfoGetElfTest.cpp",
Christopher Ferrisb7de5f52017-12-01 21:37:37 -0800182 "tests/MapInfoGetLoadBiasTest.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -0700183 "tests/MapsTest.cpp",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700184 "tests/MemoryBufferTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800185 "tests/MemoryFake.cpp",
186 "tests/MemoryFileTest.cpp",
187 "tests/MemoryLocalTest.cpp",
Christopher Ferris6633b0c2018-04-03 16:03:28 -0700188 "tests/MemoryOfflineBufferTest.cpp",
Josh Gaof4a94c42017-11-13 16:16:27 -0800189 "tests/MemoryOfflineTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800190 "tests/MemoryRangeTest.cpp",
191 "tests/MemoryRemoteTest.cpp",
Christopher Ferris9744fb22017-07-07 12:18:16 -0700192 "tests/MemoryTest.cpp",
Josh Gao6f580d82017-09-22 12:57:15 -0700193 "tests/RegsIterateTest.cpp",
Christopher Ferriseb4a6db2017-07-19 12:37:45 -0700194 "tests/RegsStepIfSignalHandlerTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800195 "tests/RegsTest.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -0700196 "tests/SymbolsTest.cpp",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800197 "tests/UnwindOfflineTest.cpp",
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700198 "tests/UnwindTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700199 "tests/UnwinderTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800200 ],
201
202 cflags: [
203 "-O0",
204 "-g",
205 ],
206
207 shared_libs: [
208 "libbase",
209 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700210 "liblzma",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700211 "libunwindstack",
David Srbecky18121dc2018-03-12 19:54:22 +0000212 "libdexfile",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800213 ],
214
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700215 static_libs: [
216 "libgmock",
217 ],
218
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700219 test_suites: ["device-tests"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700220 data: [
Christopher Ferris570b76f2017-06-30 17:18:16 -0700221 "tests/files/elf32.xz",
222 "tests/files/elf64.xz",
Yabin Cui11e96fe2018-03-14 18:16:22 -0700223 "tests/files/offline/art_quick_osr_stub_arm/*",
Christopher Ferris1a141a02018-01-24 08:52:47 -0800224 "tests/files/offline/bad_eh_frame_hdr_arm64/*",
225 "tests/files/offline/debug_frame_first_x86/*",
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800226 "tests/files/offline/eh_frame_hdr_begin_x86_64/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800227 "tests/files/offline/jit_debug_arm/*",
228 "tests/files/offline/jit_debug_x86/*",
Yabin Cuid5b22c52018-02-22 17:11:31 -0800229 "tests/files/offline/jit_map_arm/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800230 "tests/files/offline/gnu_debugdata_arm/*",
Christopher Ferris239425b2018-05-17 18:37:38 -0700231 "tests/files/offline/offset_arm/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800232 "tests/files/offline/straddle_arm/*",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800233 "tests/files/offline/straddle_arm64/*",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700234 ],
Elliott Hughesf6d75942018-06-06 10:48:41 -0700235 required: [
236 "libunwindstack_local",
237 ],
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800238}
239
Christopher Ferris3958f802017-02-01 15:44:40 -0800240//-------------------------------------------------------------------------
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700241// Tools
Christopher Ferris3958f802017-02-01 15:44:40 -0800242//-------------------------------------------------------------------------
243cc_defaults {
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700244 name: "libunwindstack_tools",
Christopher Ferris3958f802017-02-01 15:44:40 -0800245 defaults: ["libunwindstack_flags"],
246
247 shared_libs: [
248 "libunwindstack",
249 "libbase",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700250 "liblzma",
Christopher Ferris3958f802017-02-01 15:44:40 -0800251 ],
Andreas Gampe8ccbe422018-05-21 08:24:20 -0700252 target: {
253 // Always disable optimizations for host to make it easier to debug.
254 host: {
255 cflags: [
256 "-O0",
257 "-g",
258 ],
259 },
260 },
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700261}
Christopher Ferris3958f802017-02-01 15:44:40 -0800262
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700263cc_binary {
264 name: "unwind",
265 defaults: ["libunwindstack_tools"],
266
267 srcs: [
268 "tools/unwind.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800269 ],
Christopher Ferris3958f802017-02-01 15:44:40 -0800270}
271
272cc_binary {
273 name: "unwind_info",
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700274 defaults: ["libunwindstack_tools"],
Christopher Ferris3958f802017-02-01 15:44:40 -0800275
276 srcs: [
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700277 "tools/unwind_info.cpp",
278 ],
279}
280
281cc_binary {
282 name: "unwind_symbols",
283 defaults: ["libunwindstack_tools"],
284
285 srcs: [
286 "tools/unwind_symbols.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800287 ],
288}
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700289
Christopher Ferris3dfd2ae2017-12-15 20:00:59 -0800290cc_binary {
291 name: "unwind_for_offline",
292 defaults: ["libunwindstack_tools"],
293
294 srcs: [
295 "tools/unwind_for_offline.cpp",
296 ],
297}
298
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800299cc_binary {
300 name: "unwind_reg_info",
301 defaults: ["libunwindstack_tools"],
302
303 srcs: [
304 "tools/unwind_reg_info.cpp",
305 ],
306}
307
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700308// Generates the elf data for use in the tests for .gnu_debugdata frames.
309// Once these files are generated, use the xz command to compress the data.
310cc_binary_host {
311 name: "gen_gnudebugdata",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700312 defaults: ["libunwindstack_flags"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700313
314 srcs: [
315 "tests/GenGnuDebugdata.cpp",
316 ],
317}