blob: 32ba692e332051b0ae8b65811d0ad5ede31cb0ce [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 },
32 },
Christopher Ferris723cf9b2017-01-19 20:08:48 -080033}
34
Christopher Ferrisf6d54312017-07-11 15:29:32 -070035cc_library {
36 name: "libunwindstack",
Christopher Ferris6f3981c2017-07-27 09:29:18 -070037 vendor_available: true,
Justin Yun73bd4f02017-08-04 17:33:54 +090038 vndk: {
39 enabled: true,
40 support_system_process: true,
41 },
Christopher Ferris723cf9b2017-01-19 20:08:48 -080042 defaults: ["libunwindstack_flags"],
Christopher Ferrisd226a512017-07-14 10:37:19 -070043 export_include_dirs: ["include"],
Christopher Ferris723cf9b2017-01-19 20:08:48 -080044
45 srcs: [
46 "ArmExidx.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -070047 "DwarfCfa.cpp",
Christopher Ferris61d40972017-06-12 19:14:20 -070048 "DwarfDebugFrame.cpp",
49 "DwarfEhFrame.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -070050 "DwarfMemory.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -070051 "DwarfOp.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -070052 "DwarfSection.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -080053 "Elf.cpp",
54 "ElfInterface.cpp",
55 "ElfInterfaceArm.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080056 "Log.cpp",
Christopher Ferris0d7cf3e2017-04-19 15:42:19 -070057 "MapInfo.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -070058 "Maps.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -080059 "Memory.cpp",
Christopher Ferrisbae69f12017-06-28 14:51:54 -070060 "Regs.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -070061 "Symbols.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080062 ],
63
Christopher Ferris5f118512017-09-01 11:17:16 -070064 target: {
65 // Always disable optimizations for host to make it easier to debug.
66 linux: {
67 cflags: ["-O0", "-g"],
68 },
69 },
70
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070071 arch: {
72 x86: {
73 srcs: ["AsmGetRegsX86.S"],
74 },
75 x86_64: {
76 srcs: ["AsmGetRegsX86_64.S"],
77 },
78 },
79
Christopher Ferris723cf9b2017-01-19 20:08:48 -080080 shared_libs: [
81 "libbase",
82 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -070083 "liblzma",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080084 ],
85}
86
Christopher Ferris723cf9b2017-01-19 20:08:48 -080087//-------------------------------------------------------------------------
88// Unit Tests
89//-------------------------------------------------------------------------
Christopher Ferrisf6d54312017-07-11 15:29:32 -070090cc_test {
91 name: "libunwindstack_test",
Christopher Ferris723cf9b2017-01-19 20:08:48 -080092 defaults: ["libunwindstack_flags"],
93
94 srcs: [
95 "tests/ArmExidxDecodeTest.cpp",
96 "tests/ArmExidxExtractTest.cpp",
Christopher Ferris8642fcb2017-04-24 11:14:39 -070097 "tests/DwarfCfaLogTest.cpp",
98 "tests/DwarfCfaTest.cpp",
Christopher Ferris61d40972017-06-12 19:14:20 -070099 "tests/DwarfDebugFrameTest.cpp",
100 "tests/DwarfEhFrameTest.cpp",
Christopher Ferris72a6fa62017-03-21 12:41:17 -0700101 "tests/DwarfMemoryTest.cpp",
Christopher Ferris55d22ef2017-04-04 10:41:31 -0700102 "tests/DwarfOpLogTest.cpp",
103 "tests/DwarfOpTest.cpp",
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700104 "tests/DwarfSectionTest.cpp",
105 "tests/DwarfSectionImplTest.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800106 "tests/ElfInterfaceArmTest.cpp",
107 "tests/ElfInterfaceTest.cpp",
108 "tests/ElfTest.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700109 "tests/ElfTestUtils.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800110 "tests/LogFake.cpp",
Christopher Ferris570b76f2017-06-30 17:18:16 -0700111 "tests/MapInfoGetElfTest.cpp",
Christopher Ferris09385e72017-04-05 13:25:04 -0700112 "tests/MapsTest.cpp",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700113 "tests/MemoryBufferTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800114 "tests/MemoryFake.cpp",
115 "tests/MemoryFileTest.cpp",
116 "tests/MemoryLocalTest.cpp",
117 "tests/MemoryRangeTest.cpp",
118 "tests/MemoryRemoteTest.cpp",
Christopher Ferris9744fb22017-07-07 12:18:16 -0700119 "tests/MemoryTest.cpp",
Christopher Ferriseb4a6db2017-07-19 12:37:45 -0700120 "tests/RegsStepIfSignalHandlerTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800121 "tests/RegsTest.cpp",
Christopher Ferrise7ba4cc2017-04-04 14:06:58 -0700122 "tests/SymbolsTest.cpp",
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700123 "tests/UnwindTest.cpp",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800124 ],
125
126 cflags: [
127 "-O0",
128 "-g",
129 ],
130
131 shared_libs: [
132 "libbase",
133 "liblog",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700134 "liblzma",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700135 "libunwindstack",
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800136 ],
137
Christopher Ferris53a3c9b2017-05-10 18:34:15 -0700138 static_libs: [
139 "libgmock",
140 ],
141
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800142 target: {
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800143 linux: {
144 host_ldlibs: [
145 "-lrt",
146 ],
147 },
148 },
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700149
150 data: [
Christopher Ferris570b76f2017-06-30 17:18:16 -0700151 "tests/files/elf32.xz",
152 "tests/files/elf64.xz",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700153 ],
Christopher Ferris723cf9b2017-01-19 20:08:48 -0800154}
155
Christopher Ferris3958f802017-02-01 15:44:40 -0800156//-------------------------------------------------------------------------
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700157// Tools
Christopher Ferris3958f802017-02-01 15:44:40 -0800158//-------------------------------------------------------------------------
159cc_defaults {
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700160 name: "libunwindstack_tools",
Christopher Ferris3958f802017-02-01 15:44:40 -0800161 defaults: ["libunwindstack_flags"],
162
163 shared_libs: [
164 "libunwindstack",
165 "libbase",
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700166 "liblzma",
Christopher Ferris3958f802017-02-01 15:44:40 -0800167 ],
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700168}
Christopher Ferris3958f802017-02-01 15:44:40 -0800169
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700170cc_binary {
171 name: "unwind",
172 defaults: ["libunwindstack_tools"],
173
174 srcs: [
175 "tools/unwind.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800176 ],
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700177
178 target: {
179 linux: {
180 host_ldlibs: [
181 "-lrt",
182 ],
183 },
184 },
Christopher Ferris3958f802017-02-01 15:44:40 -0800185}
186
187cc_binary {
188 name: "unwind_info",
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700189 defaults: ["libunwindstack_tools"],
Christopher Ferris3958f802017-02-01 15:44:40 -0800190
191 srcs: [
Christopher Ferrisb5d7a872017-07-12 15:40:52 -0700192 "tools/unwind_info.cpp",
193 ],
194}
195
196cc_binary {
197 name: "unwind_symbols",
198 defaults: ["libunwindstack_tools"],
199
200 srcs: [
201 "tools/unwind_symbols.cpp",
Christopher Ferris3958f802017-02-01 15:44:40 -0800202 ],
203}
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700204
205// Generates the elf data for use in the tests for .gnu_debugdata frames.
206// Once these files are generated, use the xz command to compress the data.
207cc_binary_host {
208 name: "gen_gnudebugdata",
Christopher Ferrisf6d54312017-07-11 15:29:32 -0700209 defaults: ["libunwindstack_flags"],
Christopher Ferrisbae69f12017-06-28 14:51:54 -0700210
211 srcs: [
212 "tests/GenGnuDebugdata.cpp",
213 ],
214}