blob: 87172836bd70dcbaa0625ec534cb45c4484383dc [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 Ferrisbae69f12017-06-28 14:51:54 -070065 "Regs.cpp",
Christopher Ferrisd06001d2017-11-30 18:56:01 -080066 "RegsArm.cpp",
67 "RegsArm64.cpp",
68 "RegsX86.cpp",
69 "RegsX86_64.cpp",
Douglas Leung61b1a1a2017-11-08 10:53:53 +010070 "RegsMips.cpp",
71 "RegsMips64.cpp",
Christopher Ferrisb9de87f2017-09-20 13:37:24 -070072 "Unwinder.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -070073 "Symbols.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080074 ],
75
Josh Gaoe22701e2017-10-23 14:25:08 -070076 cflags: [
77 "-Wexit-time-destructors",
78 ],
79
Christopher Ferris5f118512017-09-01 11:17:16 -070080 target: {
81 // Always disable optimizations for host to make it easier to debug.
Dan Willemsencd580882017-10-02 10:29:02 -070082 host: {
Elliott Hughesdc699a22018-02-16 17:58:14 -080083 cflags: [
84 "-O0",
85 "-g",
86 ],
Christopher Ferris5f118512017-09-01 11:17:16 -070087 },
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -080088 vendor: {
89 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
David Srbecky18121dc2018-03-12 19:54:22 +000090 exclude_srcs: [
91 "DexFile.cpp",
92 "DexFiles.cpp",
93 ],
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -080094 exclude_shared_libs: ["libdexfile"],
95 },
Christopher Ferris5f118512017-09-01 11:17:16 -070096 },
97
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070098 arch: {
99 x86: {
100 srcs: ["AsmGetRegsX86.S"],
101 },
102 x86_64: {
103 srcs: ["AsmGetRegsX86_64.S"],
104 },
Douglas Leung61b1a1a2017-11-08 10:53:53 +0100105 mips: {
106 srcs: ["AsmGetRegsMips.S"],
107 },
108 mips64: {
109 srcs: ["AsmGetRegsMips64.S"],
110 },
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700111 },
112
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800113 shared_libs: [
114 "libbase",
Christopher Ferrisd70ea5e2018-01-30 19:47:24 -0800115 "libdexfile",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800116 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700117 "liblzma",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800118 ],
119}
120
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800121//-------------------------------------------------------------------------
122// Unit Tests
123//-------------------------------------------------------------------------
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700124cc_test {
125 name: "libunwindstack_test",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800126 defaults: ["libunwindstack_flags"],
127
128 srcs: [
129 "tests/ArmExidxDecodeTest.cpp",
130 "tests/ArmExidxExtractTest.cpp",
David Srbecky18121dc2018-03-12 19:54:22 +0000131 "tests/DexFileTest.cpp",
132 "tests/DexFilesTest.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -0700133 "tests/DwarfCfaLogTest.cpp",
134 "tests/DwarfCfaTest.cpp",
Christopher Ferris61d40972017-06-12 19:14:20 -0700135 "tests/DwarfDebugFrameTest.cpp",
136 "tests/DwarfEhFrameTest.cpp",
Christopher Ferrisc9dee842017-11-03 14:50:27 -0700137 "tests/DwarfEhFrameWithHdrTest.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -0700138 "tests/DwarfMemoryTest.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -0700139 "tests/DwarfOpLogTest.cpp",
140 "tests/DwarfOpTest.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700141 "tests/DwarfSectionTest.cpp",
142 "tests/DwarfSectionImplTest.cpp",
Christopher Ferris0b79ae12018-01-25 12:15:56 -0800143 "tests/ElfCacheTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700144 "tests/ElfFake.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800145 "tests/ElfInterfaceArmTest.cpp",
146 "tests/ElfInterfaceTest.cpp",
147 "tests/ElfTest.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700148 "tests/ElfTestUtils.cpp",
Christopher Ferris150db122017-12-20 18:49:01 -0800149 "tests/JitDebugTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800150 "tests/LogFake.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700151 "tests/MapInfoGetElfTest.cpp",
Christopher Ferrisb7de5f52017-12-01 21:37:37 -0800152 "tests/MapInfoGetLoadBiasTest.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -0700153 "tests/MapsTest.cpp",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700154 "tests/MemoryBufferTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800155 "tests/MemoryFake.cpp",
156 "tests/MemoryFileTest.cpp",
157 "tests/MemoryLocalTest.cpp",
Josh Gaof4a94c42017-11-13 16:16:27 -0800158 "tests/MemoryOfflineTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800159 "tests/MemoryRangeTest.cpp",
160 "tests/MemoryRemoteTest.cpp",
Christopher Ferris9744fb22017-07-07 12:18:16 -0700161 "tests/MemoryTest.cpp",
Josh Gao6f580d82017-09-22 12:57:15 -0700162 "tests/RegsIterateTest.cpp",
Christopher Ferriseb4a6db2017-07-19 12:37:45 -0700163 "tests/RegsStepIfSignalHandlerTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800164 "tests/RegsTest.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -0700165 "tests/SymbolsTest.cpp",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800166 "tests/UnwindOfflineTest.cpp",
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700167 "tests/UnwindTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700168 "tests/UnwinderTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800169 ],
170
171 cflags: [
172 "-O0",
173 "-g",
174 ],
175
176 shared_libs: [
177 "libbase",
178 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700179 "liblzma",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700180 "libunwindstack",
David Srbecky18121dc2018-03-12 19:54:22 +0000181 "libdexfile",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800182 ],
183
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700184 static_libs: [
185 "libgmock",
186 ],
187
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700188 data: [
Christopher Ferris570b76f2017-06-30 17:18:16 -0700189 "tests/files/elf32.xz",
190 "tests/files/elf64.xz",
Christopher Ferris1a141a02018-01-24 08:52:47 -0800191 "tests/files/offline/bad_eh_frame_hdr_arm64/*",
192 "tests/files/offline/debug_frame_first_x86/*",
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800193 "tests/files/offline/eh_frame_hdr_begin_x86_64/*",
Christopher Ferris5f5cb232018-02-05 13:07:06 -0800194 "tests/files/offline/jit_debug_arm/*",
195 "tests/files/offline/jit_debug_x86/*",
196 "tests/files/offline/gnu_debugdata_arm/*",
197 "tests/files/offline/straddle_arm/*",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800198 "tests/files/offline/straddle_arm64/*",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700199 ],
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800200}
201
Christopher Ferris3958f802017-02-01 15:44:40 -0800202//-------------------------------------------------------------------------
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700203// Tools
Christopher Ferris3958f802017-02-01 15:44:40 -0800204//-------------------------------------------------------------------------
205cc_defaults {
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700206 name: "libunwindstack_tools",
Christopher Ferris3958f802017-02-01 15:44:40 -0800207 defaults: ["libunwindstack_flags"],
208
209 shared_libs: [
210 "libunwindstack",
211 "libbase",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700212 "liblzma",
Christopher Ferris3958f802017-02-01 15:44:40 -0800213 ],
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700214}
Christopher Ferris3958f802017-02-01 15:44:40 -0800215
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700216cc_binary {
217 name: "unwind",
218 defaults: ["libunwindstack_tools"],
219
220 srcs: [
221 "tools/unwind.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800222 ],
Christopher Ferris3958f802017-02-01 15:44:40 -0800223}
224
225cc_binary {
226 name: "unwind_info",
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700227 defaults: ["libunwindstack_tools"],
Christopher Ferris3958f802017-02-01 15:44:40 -0800228
229 srcs: [
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700230 "tools/unwind_info.cpp",
231 ],
232}
233
234cc_binary {
235 name: "unwind_symbols",
236 defaults: ["libunwindstack_tools"],
237
238 srcs: [
239 "tools/unwind_symbols.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800240 ],
241}
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700242
Christopher Ferris3dfd2ae2017-12-15 20:00:59 -0800243cc_binary {
244 name: "unwind_for_offline",
245 defaults: ["libunwindstack_tools"],
246
247 srcs: [
248 "tools/unwind_for_offline.cpp",
249 ],
250}
251
Christopher Ferrise37e2d02018-02-09 15:57:39 -0800252cc_binary {
253 name: "unwind_reg_info",
254 defaults: ["libunwindstack_tools"],
255
256 srcs: [
257 "tools/unwind_reg_info.cpp",
258 ],
259}
260
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700261// Generates the elf data for use in the tests for .gnu_debugdata frames.
262// Once these files are generated, use the xz command to compress the data.
263cc_binary_host {
264 name: "gen_gnudebugdata",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700265 defaults: ["libunwindstack_flags"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700266
267 srcs: [
268 "tests/GenGnuDebugdata.cpp",
269 ],
270}