blob: a7bdd2e6df0a35b4ce51869c6c461dde617954be [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",
Christopher Ferris8642fcb2017-04-24 11:14:39 -070050 "DwarfCfa.cpp",
Christopher Ferrisc9dee842017-11-03 14:50:27 -070051 "DwarfEhFrameWithHdr.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -070052 "DwarfMemory.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -070053 "DwarfOp.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -070054 "DwarfSection.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -080055 "Elf.cpp",
56 "ElfInterface.cpp",
57 "ElfInterfaceArm.cpp",
Christopher Ferris150db122017-12-20 18:49:01 -080058 "JitDebug.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080059 "Log.cpp",
Christopher Ferris0d7cf3e2017-04-19 15:42:19 -070060 "MapInfo.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -070061 "Maps.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -080062 "Memory.cpp",
Christopher Ferrisbae69f12017-06-28 14:51:54 -070063 "Regs.cpp",
Christopher Ferrisd06001d2017-11-30 18:56:01 -080064 "RegsArm.cpp",
65 "RegsArm64.cpp",
66 "RegsX86.cpp",
67 "RegsX86_64.cpp",
Douglas Leung61b1a1a2017-11-08 10:53:53 +010068 "RegsMips.cpp",
69 "RegsMips64.cpp",
Christopher Ferrisb9de87f2017-09-20 13:37:24 -070070 "Unwinder.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -070071 "Symbols.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080072 ],
73
Josh Gaoe22701e2017-10-23 14:25:08 -070074 cflags: [
75 "-Wexit-time-destructors",
76 ],
77
Christopher Ferris5f118512017-09-01 11:17:16 -070078 target: {
79 // Always disable optimizations for host to make it easier to debug.
Dan Willemsencd580882017-10-02 10:29:02 -070080 host: {
Christopher Ferris5f118512017-09-01 11:17:16 -070081 cflags: ["-O0", "-g"],
82 },
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -080083 vendor: {
84 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
85 exclude_static_libs: ["libunwindstack_dex"],
86 exclude_shared_libs: ["libdexfile"],
87 },
Christopher Ferris5f118512017-09-01 11:17:16 -070088 },
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -080089 whole_static_libs: ["libunwindstack_dex"],
Christopher Ferris5f118512017-09-01 11:17:16 -070090
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070091 arch: {
92 x86: {
93 srcs: ["AsmGetRegsX86.S"],
94 },
95 x86_64: {
96 srcs: ["AsmGetRegsX86_64.S"],
97 },
Douglas Leung61b1a1a2017-11-08 10:53:53 +010098 mips: {
99 srcs: ["AsmGetRegsMips.S"],
100 },
101 mips64: {
102 srcs: ["AsmGetRegsMips64.S"],
103 },
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700104 },
105
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800106 shared_libs: [
107 "libbase",
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800108 "libdexfile",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800109 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700110 "liblzma",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800111 ],
112}
113
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800114// Isolate the dex file processing into a separate library. Currently,
115// it is necessary to add art include directories directly, which also
116// adds the art elf.h file in the include path, overriding the system one.
117// Work to isolate libdexfile is b/72216369.
118cc_library_static {
119 name: "libunwindstack_dex",
120 vendor_available: false,
121 defaults: ["libunwindstack_flags"],
122
123 cflags: [
124 "-Wexit-time-destructors",
125 ],
126
127 srcs: [
128 "DexFile.cpp",
129 "DexFiles.cpp",
130 ],
Christopher Ferris7747b602018-01-31 19:05:19 -0800131 target: {
132 // Always disable optimizations for host to make it easier to debug.
133 host: {
134 cflags: ["-O0", "-g"],
135 },
136 },
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800137
138 shared_libs: [
139 "libbase",
140 "libdexfile",
141 ],
142 local_include_dirs: ["include"],
143 allow_undefined_symbols: true,
144
145 // libdexfile will eventually properly export headers, for now include
146 // these directly.
147 include_dirs: [
148 "art/runtime",
149 ],
150}
151
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800152//-------------------------------------------------------------------------
153// Unit Tests
154//-------------------------------------------------------------------------
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800155cc_test_library {
156 name: "libunwindstack_dex_test",
157 vendor_available: false,
158 defaults: ["libunwindstack_flags"],
159
Christopher Ferris7747b602018-01-31 19:05:19 -0800160 shared: {
161 enabled: false,
162 },
163
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800164 srcs: [
165 "tests/DexFileTest.cpp",
Christopher Ferris7747b602018-01-31 19:05:19 -0800166 "tests/DexFilesTest.cpp",
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800167 ],
168 local_include_dirs: ["include"],
169 allow_undefined_symbols: true,
170
171 shared_libs: [
172 "libbase",
173 "libunwindstack",
David Sehr3a26c272018-02-13 16:29:01 -0800174 "libdexfile",
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800175 ],
176
177 // libdexfile will eventually properly export headers, for now include
178 // these directly.
179 include_dirs: [
180 "art/runtime",
181 ],
182}
183
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700184cc_test {
185 name: "libunwindstack_test",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800186 defaults: ["libunwindstack_flags"],
187
188 srcs: [
189 "tests/ArmExidxDecodeTest.cpp",
190 "tests/ArmExidxExtractTest.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -0700191 "tests/DwarfCfaLogTest.cpp",
192 "tests/DwarfCfaTest.cpp",
Christopher Ferris61d40972017-06-12 19:14:20 -0700193 "tests/DwarfDebugFrameTest.cpp",
194 "tests/DwarfEhFrameTest.cpp",
Christopher Ferrisc9dee842017-11-03 14:50:27 -0700195 "tests/DwarfEhFrameWithHdrTest.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -0700196 "tests/DwarfMemoryTest.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -0700197 "tests/DwarfOpLogTest.cpp",
198 "tests/DwarfOpTest.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700199 "tests/DwarfSectionTest.cpp",
200 "tests/DwarfSectionImplTest.cpp",
Christopher Ferris0b79ae12018-01-25 12:15:56 -0800201 "tests/ElfCacheTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700202 "tests/ElfFake.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800203 "tests/ElfInterfaceArmTest.cpp",
204 "tests/ElfInterfaceTest.cpp",
205 "tests/ElfTest.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700206 "tests/ElfTestUtils.cpp",
Christopher Ferris150db122017-12-20 18:49:01 -0800207 "tests/JitDebugTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800208 "tests/LogFake.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700209 "tests/MapInfoGetElfTest.cpp",
Christopher Ferrisb7de5f52017-12-01 21:37:37 -0800210 "tests/MapInfoGetLoadBiasTest.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -0700211 "tests/MapsTest.cpp",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700212 "tests/MemoryBufferTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800213 "tests/MemoryFake.cpp",
214 "tests/MemoryFileTest.cpp",
215 "tests/MemoryLocalTest.cpp",
Josh Gaof4a94c42017-11-13 16:16:27 -0800216 "tests/MemoryOfflineTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800217 "tests/MemoryRangeTest.cpp",
218 "tests/MemoryRemoteTest.cpp",
Christopher Ferris9744fb22017-07-07 12:18:16 -0700219 "tests/MemoryTest.cpp",
Josh Gao6f580d82017-09-22 12:57:15 -0700220 "tests/RegsIterateTest.cpp",
Christopher Ferriseb4a6db2017-07-19 12:37:45 -0700221 "tests/RegsStepIfSignalHandlerTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800222 "tests/RegsTest.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -0700223 "tests/SymbolsTest.cpp",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800224 "tests/UnwindOfflineTest.cpp",
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700225 "tests/UnwindTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700226 "tests/UnwinderTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800227 ],
228
229 cflags: [
230 "-O0",
231 "-g",
232 ],
233
234 shared_libs: [
235 "libbase",
236 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700237 "liblzma",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700238 "libunwindstack",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800239 ],
240
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700241 static_libs: [
242 "libgmock",
243 ],
244
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800245 whole_static_libs: ["libunwindstack_dex_test"],
246
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700247 data: [
Christopher Ferris570b76f2017-06-30 17:18:16 -0700248 "tests/files/elf32.xz",
249 "tests/files/elf64.xz",
Christopher Ferris1a141a02018-01-24 08:52:47 -0800250 "tests/files/offline/bad_eh_frame_hdr_arm64/*",
251 "tests/files/offline/debug_frame_first_x86/*",
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800252 "tests/files/offline/eh_frame_hdr_begin_x86_64/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800253 "tests/files/offline/jit_debug_arm/*",
254 "tests/files/offline/jit_debug_x86/*",
255 "tests/files/offline/gnu_debugdata_arm/*",
256 "tests/files/offline/straddle_arm/*",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800257 "tests/files/offline/straddle_arm64/*",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700258 ],
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800259}
260
Christopher Ferris3958f802017-02-01 15:44:40 -0800261//-------------------------------------------------------------------------
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700262// Tools
Christopher Ferris3958f802017-02-01 15:44:40 -0800263//-------------------------------------------------------------------------
264cc_defaults {
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700265 name: "libunwindstack_tools",
Christopher Ferris3958f802017-02-01 15:44:40 -0800266 defaults: ["libunwindstack_flags"],
267
268 shared_libs: [
269 "libunwindstack",
270 "libbase",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700271 "liblzma",
Christopher Ferris3958f802017-02-01 15:44:40 -0800272 ],
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700273}
Christopher Ferris3958f802017-02-01 15:44:40 -0800274
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700275cc_binary {
276 name: "unwind",
277 defaults: ["libunwindstack_tools"],
278
279 srcs: [
280 "tools/unwind.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800281 ],
Christopher Ferris3958f802017-02-01 15:44:40 -0800282}
283
284cc_binary {
285 name: "unwind_info",
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700286 defaults: ["libunwindstack_tools"],
Christopher Ferris3958f802017-02-01 15:44:40 -0800287
288 srcs: [
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700289 "tools/unwind_info.cpp",
290 ],
291}
292
293cc_binary {
294 name: "unwind_symbols",
295 defaults: ["libunwindstack_tools"],
296
297 srcs: [
298 "tools/unwind_symbols.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800299 ],
300}
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700301
Christopher Ferris3dfd2ae2017-12-15 20:00:59 -0800302cc_binary {
303 name: "unwind_for_offline",
304 defaults: ["libunwindstack_tools"],
305
306 srcs: [
307 "tools/unwind_for_offline.cpp",
308 ],
309}
310
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800311cc_binary {
312 name: "unwind_reg_info",
313 defaults: ["libunwindstack_tools"],
314
315 srcs: [
316 "tools/unwind_reg_info.cpp",
317 ],
318}
319
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700320// Generates the elf data for use in the tests for .gnu_debugdata frames.
321// Once these files are generated, use the xz command to compress the data.
322cc_binary_host {
323 name: "gen_gnudebugdata",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700324 defaults: ["libunwindstack_flags"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700325
326 srcs: [
327 "tests/GenGnuDebugdata.cpp",
328 ],
329}