blob: 74930d6ebe6bfd4c05648223273ad9ff7eba6872 [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 Ferris723cf9b2017-01-19 20:08:48 -080058 "Log.cpp",
Christopher Ferris0d7cf3e2017-04-19 15:42:19 -070059 "MapInfo.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -070060 "Maps.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -080061 "Memory.cpp",
Christopher Ferrisbae69f12017-06-28 14:51:54 -070062 "Regs.cpp",
Christopher Ferrisb9de87f2017-09-20 13:37:24 -070063 "Unwinder.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -070064 "Symbols.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080065 ],
66
Josh Gaoe22701e2017-10-23 14:25:08 -070067 cflags: [
68 "-Wexit-time-destructors",
69 ],
70
Christopher Ferris5f118512017-09-01 11:17:16 -070071 target: {
72 // Always disable optimizations for host to make it easier to debug.
Dan Willemsencd580882017-10-02 10:29:02 -070073 host: {
Christopher Ferris5f118512017-09-01 11:17:16 -070074 cflags: ["-O0", "-g"],
75 },
76 },
77
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070078 arch: {
79 x86: {
80 srcs: ["AsmGetRegsX86.S"],
81 },
82 x86_64: {
83 srcs: ["AsmGetRegsX86_64.S"],
84 },
85 },
86
Christopher Ferris723cf9b2017-01-19 20:08:48 -080087 shared_libs: [
88 "libbase",
89 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -070090 "liblzma",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080091 ],
92}
93
Christopher Ferris723cf9b2017-01-19 20:08:48 -080094//-------------------------------------------------------------------------
95// Unit Tests
96//-------------------------------------------------------------------------
Christopher Ferrisf6d54312017-07-11 15:29:32 -070097cc_test {
98 name: "libunwindstack_test",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080099 defaults: ["libunwindstack_flags"],
100
101 srcs: [
102 "tests/ArmExidxDecodeTest.cpp",
103 "tests/ArmExidxExtractTest.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -0700104 "tests/DwarfCfaLogTest.cpp",
105 "tests/DwarfCfaTest.cpp",
Christopher Ferris61d40972017-06-12 19:14:20 -0700106 "tests/DwarfDebugFrameTest.cpp",
107 "tests/DwarfEhFrameTest.cpp",
Christopher Ferrisc9dee842017-11-03 14:50:27 -0700108 "tests/DwarfEhFrameWithHdrTest.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -0700109 "tests/DwarfMemoryTest.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -0700110 "tests/DwarfOpLogTest.cpp",
111 "tests/DwarfOpTest.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700112 "tests/DwarfSectionTest.cpp",
113 "tests/DwarfSectionImplTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700114 "tests/ElfFake.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800115 "tests/ElfInterfaceArmTest.cpp",
116 "tests/ElfInterfaceTest.cpp",
117 "tests/ElfTest.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700118 "tests/ElfTestUtils.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800119 "tests/LogFake.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700120 "tests/MapInfoGetElfTest.cpp",
Christopher Ferrisb7de5f52017-12-01 21:37:37 -0800121 "tests/MapInfoGetLoadBiasTest.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -0700122 "tests/MapsTest.cpp",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700123 "tests/MemoryBufferTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800124 "tests/MemoryFake.cpp",
125 "tests/MemoryFileTest.cpp",
126 "tests/MemoryLocalTest.cpp",
127 "tests/MemoryRangeTest.cpp",
128 "tests/MemoryRemoteTest.cpp",
Christopher Ferris9744fb22017-07-07 12:18:16 -0700129 "tests/MemoryTest.cpp",
Josh Gao6f580d82017-09-22 12:57:15 -0700130 "tests/RegsIterateTest.cpp",
Christopher Ferriseb4a6db2017-07-19 12:37:45 -0700131 "tests/RegsStepIfSignalHandlerTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800132 "tests/RegsTest.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -0700133 "tests/SymbolsTest.cpp",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800134 "tests/UnwindOfflineTest.cpp",
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700135 "tests/UnwindTest.cpp",
Christopher Ferrisf6f691b2017-09-25 19:23:07 -0700136 "tests/UnwinderTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800137 ],
138
139 cflags: [
140 "-O0",
141 "-g",
142 ],
143
144 shared_libs: [
145 "libbase",
146 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700147 "liblzma",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700148 "libunwindstack",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800149 ],
150
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700151 static_libs: [
152 "libgmock",
153 ],
154
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700155 data: [
Christopher Ferris570b76f2017-06-30 17:18:16 -0700156 "tests/files/elf32.xz",
157 "tests/files/elf64.xz",
Christopher Ferrisc3d79f72017-11-28 19:14:54 -0800158 "tests/files/offline/straddle_arm32/*",
159 "tests/files/offline/straddle_arm64/*",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700160 ],
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800161}
162
Christopher Ferris3958f802017-02-01 15:44:40 -0800163//-------------------------------------------------------------------------
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700164// Tools
Christopher Ferris3958f802017-02-01 15:44:40 -0800165//-------------------------------------------------------------------------
166cc_defaults {
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700167 name: "libunwindstack_tools",
Christopher Ferris3958f802017-02-01 15:44:40 -0800168 defaults: ["libunwindstack_flags"],
169
170 shared_libs: [
171 "libunwindstack",
172 "libbase",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700173 "liblzma",
Christopher Ferris3958f802017-02-01 15:44:40 -0800174 ],
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700175}
Christopher Ferris3958f802017-02-01 15:44:40 -0800176
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700177cc_binary {
178 name: "unwind",
179 defaults: ["libunwindstack_tools"],
180
181 srcs: [
182 "tools/unwind.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800183 ],
Christopher Ferris3958f802017-02-01 15:44:40 -0800184}
185
186cc_binary {
187 name: "unwind_info",
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700188 defaults: ["libunwindstack_tools"],
Christopher Ferris3958f802017-02-01 15:44:40 -0800189
190 srcs: [
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700191 "tools/unwind_info.cpp",
192 ],
193}
194
195cc_binary {
196 name: "unwind_symbols",
197 defaults: ["libunwindstack_tools"],
198
199 srcs: [
200 "tools/unwind_symbols.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800201 ],
202}
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700203
204// Generates the elf data for use in the tests for .gnu_debugdata frames.
205// Once these files are generated, use the xz command to compress the data.
206cc_binary_host {
207 name: "gen_gnudebugdata",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700208 defaults: ["libunwindstack_flags"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700209
210 srcs: [
211 "tests/GenGnuDebugdata.cpp",
212 ],
213}