blob: 7ab6699ca77871ec382f0dd7f91ff3f94335f355 [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 Ferris61d40972017-06-12 19:14:20 -070051 "DwarfDebugFrame.cpp",
52 "DwarfEhFrame.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -070053 "DwarfMemory.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -070054 "DwarfOp.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -070055 "DwarfSection.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -080056 "Elf.cpp",
57 "ElfInterface.cpp",
58 "ElfInterfaceArm.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 Ferrisb9de87f2017-09-20 13:37:24 -070064 "Unwinder.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -070065 "Symbols.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080066 ],
67
Christopher Ferris5f118512017-09-01 11:17:16 -070068 target: {
69 // Always disable optimizations for host to make it easier to debug.
Dan Willemsencd580882017-10-02 10:29:02 -070070 host: {
Christopher Ferris5f118512017-09-01 11:17:16 -070071 cflags: ["-O0", "-g"],
72 },
73 },
74
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070075 arch: {
76 x86: {
77 srcs: ["AsmGetRegsX86.S"],
78 },
79 x86_64: {
80 srcs: ["AsmGetRegsX86_64.S"],
81 },
82 },
83
Christopher Ferris723cf9b2017-01-19 20:08:48 -080084 shared_libs: [
85 "libbase",
86 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -070087 "liblzma",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080088 ],
89}
90
Christopher Ferris723cf9b2017-01-19 20:08:48 -080091//-------------------------------------------------------------------------
92// Unit Tests
93//-------------------------------------------------------------------------
Christopher Ferrisf6d54312017-07-11 15:29:32 -070094cc_test {
95 name: "libunwindstack_test",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080096 defaults: ["libunwindstack_flags"],
97
98 srcs: [
99 "tests/ArmExidxDecodeTest.cpp",
100 "tests/ArmExidxExtractTest.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -0700101 "tests/DwarfCfaLogTest.cpp",
102 "tests/DwarfCfaTest.cpp",
Christopher Ferris61d40972017-06-12 19:14:20 -0700103 "tests/DwarfDebugFrameTest.cpp",
104 "tests/DwarfEhFrameTest.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -0700105 "tests/DwarfMemoryTest.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -0700106 "tests/DwarfOpLogTest.cpp",
107 "tests/DwarfOpTest.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700108 "tests/DwarfSectionTest.cpp",
109 "tests/DwarfSectionImplTest.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800110 "tests/ElfInterfaceArmTest.cpp",
111 "tests/ElfInterfaceTest.cpp",
112 "tests/ElfTest.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700113 "tests/ElfTestUtils.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800114 "tests/LogFake.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700115 "tests/MapInfoGetElfTest.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -0700116 "tests/MapsTest.cpp",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700117 "tests/MemoryBufferTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800118 "tests/MemoryFake.cpp",
119 "tests/MemoryFileTest.cpp",
120 "tests/MemoryLocalTest.cpp",
121 "tests/MemoryRangeTest.cpp",
122 "tests/MemoryRemoteTest.cpp",
Christopher Ferris9744fb22017-07-07 12:18:16 -0700123 "tests/MemoryTest.cpp",
Christopher Ferriseb4a6db2017-07-19 12:37:45 -0700124 "tests/RegsStepIfSignalHandlerTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800125 "tests/RegsTest.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -0700126 "tests/SymbolsTest.cpp",
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700127 "tests/UnwindTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800128 ],
129
130 cflags: [
131 "-O0",
132 "-g",
133 ],
134
135 shared_libs: [
136 "libbase",
137 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700138 "liblzma",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700139 "libunwindstack",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800140 ],
141
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700142 static_libs: [
143 "libgmock",
144 ],
145
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700146 data: [
Christopher Ferris570b76f2017-06-30 17:18:16 -0700147 "tests/files/elf32.xz",
148 "tests/files/elf64.xz",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700149 ],
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800150}
151
Christopher Ferris3958f802017-02-01 15:44:40 -0800152//-------------------------------------------------------------------------
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700153// Tools
Christopher Ferris3958f802017-02-01 15:44:40 -0800154//-------------------------------------------------------------------------
155cc_defaults {
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700156 name: "libunwindstack_tools",
Christopher Ferris3958f802017-02-01 15:44:40 -0800157 defaults: ["libunwindstack_flags"],
158
159 shared_libs: [
160 "libunwindstack",
161 "libbase",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700162 "liblzma",
Christopher Ferris3958f802017-02-01 15:44:40 -0800163 ],
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700164}
Christopher Ferris3958f802017-02-01 15:44:40 -0800165
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700166cc_binary {
167 name: "unwind",
168 defaults: ["libunwindstack_tools"],
169
170 srcs: [
171 "tools/unwind.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800172 ],
Christopher Ferris3958f802017-02-01 15:44:40 -0800173}
174
175cc_binary {
176 name: "unwind_info",
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700177 defaults: ["libunwindstack_tools"],
Christopher Ferris3958f802017-02-01 15:44:40 -0800178
179 srcs: [
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700180 "tools/unwind_info.cpp",
181 ],
182}
183
184cc_binary {
185 name: "unwind_symbols",
186 defaults: ["libunwindstack_tools"],
187
188 srcs: [
189 "tools/unwind_symbols.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800190 ],
191}
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700192
193// Generates the elf data for use in the tests for .gnu_debugdata frames.
194// Once these files are generated, use the xz command to compress the data.
195cc_binary_host {
196 name: "gen_gnudebugdata",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700197 defaults: ["libunwindstack_flags"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700198
199 srcs: [
200 "tests/GenGnuDebugdata.cpp",
201 ],
202}