blob: 435ed946299bf9b448712d848c99299826d7cffc [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,
Justin Yun73bd4f02017-08-04 17:33:54 +090041 vndk: {
42 enabled: true,
43 support_system_process: true,
44 },
Christopher Ferris723cf9b2017-01-19 20:08:48 -080045 defaults: ["libunwindstack_flags"],
Christopher Ferrisd226a512017-07-14 10:37:19 -070046 export_include_dirs: ["include"],
Christopher Ferris723cf9b2017-01-19 20:08:48 -080047
48 srcs: [
49 "ArmExidx.cpp",
David Srbecky18121dc2018-03-12 19:54:22 +000050 "DexFile.cpp",
51 "DexFiles.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -070052 "DwarfCfa.cpp",
Christopher Ferrisc9dee842017-11-03 14:50:27 -070053 "DwarfEhFrameWithHdr.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -070054 "DwarfMemory.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -070055 "DwarfOp.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -070056 "DwarfSection.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -080057 "Elf.cpp",
58 "ElfInterface.cpp",
59 "ElfInterfaceArm.cpp",
Christopher Ferris150db122017-12-20 18:49:01 -080060 "JitDebug.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080061 "Log.cpp",
Christopher Ferris0d7cf3e2017-04-19 15:42:19 -070062 "MapInfo.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -070063 "Maps.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -080064 "Memory.cpp",
Christopher Ferrisca9a54b2018-04-05 11:15:00 -070065 "LocalUnwinder.cpp",
Christopher Ferrisbae69f12017-06-28 14:51:54 -070066 "Regs.cpp",
Christopher Ferrisd06001d2017-11-30 18:56:01 -080067 "RegsArm.cpp",
68 "RegsArm64.cpp",
69 "RegsX86.cpp",
70 "RegsX86_64.cpp",
Douglas Leung61b1a1a2017-11-08 10:53:53 +010071 "RegsMips.cpp",
72 "RegsMips64.cpp",
Christopher Ferrisb9de87f2017-09-20 13:37:24 -070073 "Unwinder.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -070074 "Symbols.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080075 ],
76
Josh Gaoe22701e2017-10-23 14:25:08 -070077 cflags: [
78 "-Wexit-time-destructors",
79 ],
80
Christopher Ferris5f118512017-09-01 11:17:16 -070081 target: {
82 // Always disable optimizations for host to make it easier to debug.
Dan Willemsencd580882017-10-02 10:29:02 -070083 host: {
Elliott Hughesdc699a22018-02-16 17:58:14 -080084 cflags: [
85 "-O0",
86 "-g",
87 ],
Christopher Ferris5f118512017-09-01 11:17:16 -070088 },
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -080089 vendor: {
90 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
David Srbecky18121dc2018-03-12 19:54:22 +000091 exclude_srcs: [
92 "DexFile.cpp",
93 "DexFiles.cpp",
94 ],
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -080095 exclude_shared_libs: ["libdexfile"],
96 },
Christopher Ferris5f118512017-09-01 11:17:16 -070097 },
98
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070099 arch: {
100 x86: {
101 srcs: ["AsmGetRegsX86.S"],
102 },
103 x86_64: {
104 srcs: ["AsmGetRegsX86_64.S"],
105 },
Douglas Leung61b1a1a2017-11-08 10:53:53 +0100106 mips: {
107 srcs: ["AsmGetRegsMips.S"],
108 },
109 mips64: {
110 srcs: ["AsmGetRegsMips64.S"],
111 },
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700112 },
113
Yabin Cui3841acc2018-05-10 17:19:12 -0700114 static_libs: [
115 "libprocinfo",
116 ],
117
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800118 shared_libs: [
119 "libbase",
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800120 "libdexfile",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800121 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700122 "liblzma",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800123 ],
124}
125
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800126//-------------------------------------------------------------------------
127// Unit Tests
128//-------------------------------------------------------------------------
Christopher Ferrisca9a54b2018-04-05 11:15:00 -0700129cc_test_library {
130 name: "libunwindstack_local",
131 defaults: ["libunwindstack_flags"],
132 srcs: ["tests/TestLocal.cpp"],
133
134 cflags: [
135 "-O0",
136 "-g",
137 ],
138
139 shared_libs: [
140 "libunwindstack",
141 ],
142}
143
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700144cc_test {
145 name: "libunwindstack_test",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800146 defaults: ["libunwindstack_flags"],
147
148 srcs: [
149 "tests/ArmExidxDecodeTest.cpp",
150 "tests/ArmExidxExtractTest.cpp",
David Srbecky18121dc2018-03-12 19:54:22 +0000151 "tests/DexFileTest.cpp",
152 "tests/DexFilesTest.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -0700153 "tests/DwarfCfaLogTest.cpp",
154 "tests/DwarfCfaTest.cpp",
Christopher Ferris61d40972017-06-12 19:14:20 -0700155 "tests/DwarfDebugFrameTest.cpp",
156 "tests/DwarfEhFrameTest.cpp",
Christopher Ferrisc9dee842017-11-03 14:50:27 -0700157 "tests/DwarfEhFrameWithHdrTest.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -0700158 "tests/DwarfMemoryTest.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -0700159 "tests/DwarfOpLogTest.cpp",
160 "tests/DwarfOpTest.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700161 "tests/DwarfSectionTest.cpp",
162 "tests/DwarfSectionImplTest.cpp",
Christopher Ferris0b79ae12018-01-25 12:15:56 -0800163 "tests/ElfCacheTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700164 "tests/ElfFake.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800165 "tests/ElfInterfaceArmTest.cpp",
166 "tests/ElfInterfaceTest.cpp",
167 "tests/ElfTest.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700168 "tests/ElfTestUtils.cpp",
Christopher Ferris150db122017-12-20 18:49:01 -0800169 "tests/JitDebugTest.cpp",
Christopher Ferrisca9a54b2018-04-05 11:15:00 -0700170 "tests/LocalUnwinderTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800171 "tests/LogFake.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700172 "tests/MapInfoGetElfTest.cpp",
Christopher Ferrisb7de5f52017-12-01 21:37:37 -0800173 "tests/MapInfoGetLoadBiasTest.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -0700174 "tests/MapsTest.cpp",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700175 "tests/MemoryBufferTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800176 "tests/MemoryFake.cpp",
177 "tests/MemoryFileTest.cpp",
178 "tests/MemoryLocalTest.cpp",
Christopher Ferris6633b0c2018-04-03 16:03:28 -0700179 "tests/MemoryOfflineBufferTest.cpp",
Josh Gaof4a94c42017-11-13 16:16:27 -0800180 "tests/MemoryOfflineTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800181 "tests/MemoryRangeTest.cpp",
182 "tests/MemoryRemoteTest.cpp",
Christopher Ferris9744fb22017-07-07 12:18:16 -0700183 "tests/MemoryTest.cpp",
Josh Gao6f580d82017-09-22 12:57:15 -0700184 "tests/RegsIterateTest.cpp",
Christopher Ferriseb4a6db2017-07-19 12:37:45 -0700185 "tests/RegsStepIfSignalHandlerTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800186 "tests/RegsTest.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -0700187 "tests/SymbolsTest.cpp",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800188 "tests/UnwindOfflineTest.cpp",
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700189 "tests/UnwindTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700190 "tests/UnwinderTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800191 ],
192
193 cflags: [
194 "-O0",
195 "-g",
196 ],
197
198 shared_libs: [
199 "libbase",
200 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700201 "liblzma",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700202 "libunwindstack",
David Srbecky18121dc2018-03-12 19:54:22 +0000203 "libdexfile",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800204 ],
205
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700206 static_libs: [
207 "libgmock",
208 ],
209
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700210 test_suites: ["device-tests"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700211 data: [
Christopher Ferris570b76f2017-06-30 17:18:16 -0700212 "tests/files/elf32.xz",
213 "tests/files/elf64.xz",
Yabin Cui11e96fe2018-03-14 18:16:22 -0700214 "tests/files/offline/art_quick_osr_stub_arm/*",
Christopher Ferris1a141a02018-01-24 08:52:47 -0800215 "tests/files/offline/bad_eh_frame_hdr_arm64/*",
216 "tests/files/offline/debug_frame_first_x86/*",
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800217 "tests/files/offline/eh_frame_hdr_begin_x86_64/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800218 "tests/files/offline/jit_debug_arm/*",
219 "tests/files/offline/jit_debug_x86/*",
Yabin Cuid5b22c52018-02-22 17:11:31 -0800220 "tests/files/offline/jit_map_arm/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800221 "tests/files/offline/gnu_debugdata_arm/*",
Christopher Ferris239425b2018-05-17 18:37:38 -0700222 "tests/files/offline/offset_arm/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800223 "tests/files/offline/straddle_arm/*",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800224 "tests/files/offline/straddle_arm64/*",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700225 ],
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800226}
227
Christopher Ferris3958f802017-02-01 15:44:40 -0800228//-------------------------------------------------------------------------
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700229// Tools
Christopher Ferris3958f802017-02-01 15:44:40 -0800230//-------------------------------------------------------------------------
231cc_defaults {
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700232 name: "libunwindstack_tools",
Christopher Ferris3958f802017-02-01 15:44:40 -0800233 defaults: ["libunwindstack_flags"],
234
235 shared_libs: [
236 "libunwindstack",
237 "libbase",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700238 "liblzma",
Christopher Ferris3958f802017-02-01 15:44:40 -0800239 ],
Andreas Gampe8ccbe422018-05-21 08:24:20 -0700240 target: {
241 // Always disable optimizations for host to make it easier to debug.
242 host: {
243 cflags: [
244 "-O0",
245 "-g",
246 ],
247 },
248 },
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700249}
Christopher Ferris3958f802017-02-01 15:44:40 -0800250
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700251cc_binary {
252 name: "unwind",
253 defaults: ["libunwindstack_tools"],
254
255 srcs: [
256 "tools/unwind.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800257 ],
Christopher Ferris3958f802017-02-01 15:44:40 -0800258}
259
260cc_binary {
261 name: "unwind_info",
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700262 defaults: ["libunwindstack_tools"],
Christopher Ferris3958f802017-02-01 15:44:40 -0800263
264 srcs: [
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700265 "tools/unwind_info.cpp",
266 ],
267}
268
269cc_binary {
270 name: "unwind_symbols",
271 defaults: ["libunwindstack_tools"],
272
273 srcs: [
274 "tools/unwind_symbols.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800275 ],
276}
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700277
Christopher Ferris3dfd2ae2017-12-15 20:00:59 -0800278cc_binary {
279 name: "unwind_for_offline",
280 defaults: ["libunwindstack_tools"],
281
282 srcs: [
283 "tools/unwind_for_offline.cpp",
284 ],
285}
286
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800287cc_binary {
288 name: "unwind_reg_info",
289 defaults: ["libunwindstack_tools"],
290
291 srcs: [
292 "tools/unwind_reg_info.cpp",
293 ],
294}
295
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700296// Generates the elf data for use in the tests for .gnu_debugdata frames.
297// Once these files are generated, use the xz command to compress the data.
298cc_binary_host {
299 name: "gen_gnudebugdata",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700300 defaults: ["libunwindstack_flags"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700301
302 srcs: [
303 "tests/GenGnuDebugdata.cpp",
304 ],
305}