blob: 14ae44564b264e0bf4b6c70b9a43a6264ac92160 [file] [log] [blame]
Dan Willemsen2e1591b2016-07-12 17:20:18 -07001//
2// Copyright (C) 2014 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: "libbacktrace_common",
19
20 cflags: [
21 "-Wall",
22 "-Werror",
23 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070024
Colin Crossda9bd592016-12-14 17:24:46 -080025 // The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists.
Dan Willemsen2e1591b2016-07-12 17:20:18 -070026 clang_cflags: ["-Wno-inline-asm"],
27
Dan Willemsen2e1591b2016-07-12 17:20:18 -070028 include_dirs: ["external/libunwind/include/tdep"],
29
Dan Willemsen2e1591b2016-07-12 17:20:18 -070030
31 target: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070032 darwin: {
33 enabled: false,
34 },
35 },
36
37 multilib: {
38 lib32: {
39 suffix: "32",
40 },
41 lib64: {
42 suffix: "64",
43 },
44 }
45}
46
47libbacktrace_sources = [
48 "Backtrace.cpp",
49 "BacktraceCurrent.cpp",
50 "BacktracePtrace.cpp",
51 "thread_utils.c",
52 "ThreadEntry.cpp",
Christopher Ferris0b06a592018-01-19 10:26:36 -080053 "UnwindDexFile.cpp",
Christopher Ferris6f3981c2017-07-27 09:29:18 -070054 "UnwindStack.cpp",
55 "UnwindStackMap.cpp",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070056]
57
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070058cc_library_headers {
59 name: "libbacktrace_headers",
Steven Moreland4ad9d512017-04-13 21:01:40 -070060 vendor_available: true,
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070061 export_include_dirs: ["include"],
62}
63
Dan Willemsen2e1591b2016-07-12 17:20:18 -070064cc_library {
65 name: "libbacktrace",
Jiyong Parkb7d92c42017-08-23 13:25:21 +090066 vendor_available: false,
Justin Yun9ca92452017-07-31 15:41:10 +090067 vndk: {
68 enabled: true,
69 support_system_process: true,
70 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070071 defaults: ["libbacktrace_common"],
72 host_supported: true,
73
Josh Gaoe22701e2017-10-23 14:25:08 -070074 cflags: [
75 "-Wexit-time-destructors",
76 ],
77
Dan Willemsen2e1591b2016-07-12 17:20:18 -070078 srcs: [
79 "BacktraceMap.cpp",
80 ],
81
Vijay Venkatraman8f2c28d2017-04-11 11:22:43 -070082 export_include_dirs: ["include"],
83
Dan Willemsen2e1591b2016-07-12 17:20:18 -070084 target: {
85 darwin: {
86 enabled: true,
87 },
Dan Willemsenbdddcab2017-10-03 14:17:31 -070088 linux: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070089 srcs: libbacktrace_sources,
90
91 shared_libs: [
92 "libbase",
93 "liblog",
94 "libunwind",
Christopher Ferris6f3981c2017-07-27 09:29:18 -070095 "libunwindstack",
Christopher Ferris0b06a592018-01-19 10:26:36 -080096 "libdexfile",
Dan Willemsene0cd1e02017-03-15 15:23:36 -070097 ],
98
99 static_libs: ["libcutils"],
Christopher Ferris0b06a592018-01-19 10:26:36 -0800100
101 // libdexfile will eventually properly export headers, for now
102 // include these directly.
103 include_dirs: [
104 "art/runtime",
105 ],
106
107 header_libs: [ "jni_headers", ],
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700108 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700109 android: {
Dan Willemsenbdddcab2017-10-03 14:17:31 -0700110 static_libs: ["libasync_safe"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700111 },
Christopher Ferris0b06a592018-01-19 10:26:36 -0800112 vendor: {
113 cflags: ["-DNO_LIBDEXFILE"],
114 exclude_srcs: ["UnwindDexFile.cpp"],
115 exclude_shared_libs: ["libdexfile"],
116 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700117 },
Christopher Ferris7d0aea92017-06-01 14:15:09 -0700118 whole_static_libs: ["libdemangle"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700119}
120
121cc_library_shared {
122 name: "libbacktrace_test",
123 defaults: ["libbacktrace_common"],
124 host_supported: true,
125 strip: {
126 none: true,
127 },
128 cflags: ["-O0"],
Christopher Ferris5ea2c1f2017-03-23 14:55:01 -0700129 srcs: ["backtrace_testlib.cpp"],
Yabin Cui5d991bc2016-11-15 17:47:09 -0800130
Christopher Ferrisc8bec5a2017-12-11 17:44:33 -0800131 shared_libs: [
132 "libunwindstack",
Colin Crossda9bd592016-12-14 17:24:46 -0800133 ],
134}
135
136//-------------------------------------------------------------------------
137// The backtrace_test executable.
138//-------------------------------------------------------------------------
139cc_test {
140 name: "backtrace_test",
141 defaults: ["libbacktrace_common"],
142 host_supported: true,
143 srcs: [
144 "backtrace_offline_test.cpp",
145 "backtrace_test.cpp",
146 "GetPss.cpp",
147 "thread_utils.c",
Christopher Ferris0b06a592018-01-19 10:26:36 -0800148
149 "unwind_dex_test.cpp",
Colin Crossda9bd592016-12-14 17:24:46 -0800150 ],
151
152 cflags: [
153 "-fno-builtin",
154 "-O0",
155 "-g",
156 ],
157
158 shared_libs: [
159 "libbacktrace_test",
160 "libbacktrace",
Christopher Ferris0b06a592018-01-19 10:26:36 -0800161 "libdexfile",
Colin Crossda9bd592016-12-14 17:24:46 -0800162 "libbase",
163 "libcutils",
164 "liblog",
Christopher Ferris6f3981c2017-07-27 09:29:18 -0700165 "libunwindstack",
Colin Crossda9bd592016-12-14 17:24:46 -0800166 ],
167
168 group_static_libs: true,
169
Colin Crossda9bd592016-12-14 17:24:46 -0800170 target: {
171 android: {
172 cflags: ["-DENABLE_PSS_TESTS"],
173 shared_libs: [
Colin Crossda9bd592016-12-14 17:24:46 -0800174 "libutils",
175 ],
176 },
Dan Willemsen48529332017-10-02 10:38:16 -0700177 linux_glibc: {
Colin Crossda9bd592016-12-14 17:24:46 -0800178 static_libs: ["libutils"],
179 },
180 },
Christopher Ferris458cc662017-08-28 16:31:18 -0700181
Christopher Ferris0b06a592018-01-19 10:26:36 -0800182 // libdexfile will eventually properly export headers, for now
183 // include these directly.
184 include_dirs: [
185 "art/runtime",
186 ],
187
Christopher Ferris458cc662017-08-28 16:31:18 -0700188 data: [
189 "testdata/arm/*",
190 "testdata/arm64/*",
191 "testdata/x86/*",
192 "testdata/x86_64/*",
193 ],
Colin Crossda9bd592016-12-14 17:24:46 -0800194}
Christopher Ferris60521c72017-08-18 15:10:53 -0700195
196cc_benchmark {
197 name: "backtrace_benchmarks",
198 defaults: ["libbacktrace_common"],
199
200 srcs: [
201 "backtrace_benchmarks.cpp",
Christopher Ferrise3286732017-12-07 17:41:18 -0800202 "backtrace_read_benchmarks.cpp",
Christopher Ferris60521c72017-08-18 15:10:53 -0700203 ],
204
205 shared_libs: [
206 "libbacktrace",
207 "libbase",
Josh Gaob9670bb2017-10-25 15:12:24 -0700208 "libunwindstack",
Christopher Ferris60521c72017-08-18 15:10:53 -0700209 ],
210}