blob: 0602e0a87218f61c80020579333d6f509f0c7d44 [file] [log] [blame]
Josh Gaocbe70cb2016-10-18 18:17:52 -07001cc_defaults {
2 name: "debuggerd_defaults",
3 cflags: [
4 "-Wall",
5 "-Wextra",
Josh Gaoc7fe0602017-03-13 14:13:29 -07006 "-Werror",
Josh Gao2b2ae0c2017-08-21 14:31:17 -07007 "-Wno-unused-argument",
8 "-Wno-unused-function",
Josh Gaocbe70cb2016-10-18 18:17:52 -07009 "-Wno-nullability-completeness",
10 "-Os",
11 ],
12
13 local_include_dirs: ["include"],
14}
15
Narayan Kamatha73df602017-05-24 15:07:25 +010016cc_library_headers {
17 name: "libdebuggerd_common_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080018 export_include_dirs: ["common/include"],
Jiyong Parka0e75042018-05-24 14:11:00 +090019 recovery_available: true,
Narayan Kamatha73df602017-05-24 15:07:25 +010020}
21
Narayan Kamath2d377cd2017-05-10 10:58:59 +010022cc_library_shared {
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080023 name: "libtombstoned_client",
24 defaults: ["debuggerd_defaults"],
25 srcs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +010026 "tombstoned/tombstoned_client.cpp",
27 "util.cpp",
28 ],
29
Narayan Kamatha73df602017-05-24 15:07:25 +010030 header_libs: ["libdebuggerd_common_headers"],
31
Narayan Kamath2d377cd2017-05-10 10:58:59 +010032 static_libs: [
Narayan Kamatha73df602017-05-24 15:07:25 +010033 "libasync_safe",
Narayan Kamath2d377cd2017-05-10 10:58:59 +010034 ],
35
36 shared_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +010037 "libbase",
Narayan Kamatha73df602017-05-24 15:07:25 +010038 "libcutils",
Narayan Kamath2d377cd2017-05-10 10:58:59 +010039 ],
40
Narayan Kamatha73df602017-05-24 15:07:25 +010041 export_header_lib_headers: ["libdebuggerd_common_headers"],
Elliott Hughesdc699a22018-02-16 17:58:14 -080042 export_include_dirs: ["tombstoned/include"],
Narayan Kamath2d377cd2017-05-10 10:58:59 +010043}
44
Josh Gao9da1f512018-08-06 15:38:29 -070045// Utility library to talk to tombstoned and get an output fd.
Narayan Kamath2d377cd2017-05-10 10:58:59 +010046cc_library_static {
47 name: "libtombstoned_client_static",
48 defaults: ["debuggerd_defaults"],
Jiyong Park011ee122018-05-29 16:41:30 +090049 recovery_available: true,
Narayan Kamath2d377cd2017-05-10 10:58:59 +010050 srcs: [
51 "tombstoned/tombstoned_client.cpp",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080052 "util.cpp",
53 ],
54
Narayan Kamatha73df602017-05-24 15:07:25 +010055 header_libs: ["libdebuggerd_common_headers"],
56
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080057 whole_static_libs: [
Christopher Ferrisac225782017-04-25 11:23:10 -070058 "libasync_safe",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080059 "libcutils",
60 "libbase",
61 ],
Narayan Kamath2d377cd2017-05-10 10:58:59 +010062
Narayan Kamatha73df602017-05-24 15:07:25 +010063 export_header_lib_headers: ["libdebuggerd_common_headers"],
Elliott Hughesdc699a22018-02-16 17:58:14 -080064 export_include_dirs: ["tombstoned/include"],
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080065}
66
67// Core implementation, linked into libdebuggerd_handler and the dynamic linker.
Josh Gao9c02dc52016-06-15 17:29:00 -070068cc_library_static {
Josh Gaoe73c9322017-02-08 16:06:26 -080069 name: "libdebuggerd_handler_core",
Josh Gaocbe70cb2016-10-18 18:17:52 -070070 defaults: ["debuggerd_defaults"],
Jiyong Parka0e75042018-05-24 14:11:00 +090071 recovery_available: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -070072 srcs: ["handler/debuggerd_handler.cpp"],
Josh Gao9c02dc52016-06-15 17:29:00 -070073
Josh Gaofdf832d2017-08-25 18:00:18 -070074 header_libs: [
75 "libbase_headers",
76 "libdebuggerd_common_headers",
77 ],
Narayan Kamatha73df602017-05-24 15:07:25 +010078
Josh Gaoe73c9322017-02-08 16:06:26 -080079 whole_static_libs: [
Christopher Ferrisac225782017-04-25 11:23:10 -070080 "libasync_safe",
Josh Gao2b2ae0c2017-08-21 14:31:17 -070081 "libcutils",
Josh Gaoe73c9322017-02-08 16:06:26 -080082 "libdebuggerd",
83 ],
84
Narayan Kamatha73df602017-05-24 15:07:25 +010085 export_header_lib_headers: ["libdebuggerd_common_headers"],
Josh Gaoe73c9322017-02-08 16:06:26 -080086 export_include_dirs: ["include"],
87}
88
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080089// Implementation with a no-op fallback.
Josh Gaoe73c9322017-02-08 16:06:26 -080090cc_library_static {
91 name: "libdebuggerd_handler",
92 defaults: ["debuggerd_defaults"],
93 srcs: ["handler/debuggerd_fallback_nop.cpp"],
94
95 whole_static_libs: [
96 "libdebuggerd_handler_core",
97 ],
98
99 export_include_dirs: ["include"],
100}
101
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800102// Fallback implementation.
Josh Gaoe73c9322017-02-08 16:06:26 -0800103cc_library_static {
104 name: "libdebuggerd_handler_fallback",
105 defaults: ["debuggerd_defaults"],
Jiyong Park011ee122018-05-29 16:41:30 +0900106 recovery_available: true,
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800107 srcs: [
108 "handler/debuggerd_fallback.cpp",
109 ],
Josh Gaoe73c9322017-02-08 16:06:26 -0800110
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800111 whole_static_libs: [
112 "libdebuggerd_handler_core",
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100113 "libtombstoned_client_static",
Christopher Ferrisac225782017-04-25 11:23:10 -0700114 "libasync_safe",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800115 "libbase",
Josh Gaoe73c9322017-02-08 16:06:26 -0800116 "libdebuggerd",
Christopher Ferris9a8c8552017-08-11 15:29:19 -0700117 "libunwindstack",
Martin Stjernholme31cfb62019-02-05 04:59:07 +0000118 "libdexfile_support_static", // libunwindstack dependency
Josh Gaoe73c9322017-02-08 16:06:26 -0800119 "liblzma",
120 "libcutils",
121 ],
Jiyong Park011ee122018-05-29 16:41:30 +0900122 target: {
123 recovery: {
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000124 exclude_static_libs: [
Martin Stjernholme31cfb62019-02-05 04:59:07 +0000125 "libdexfile_support_static",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000126 ],
Jiyong Park011ee122018-05-29 16:41:30 +0900127 },
128 },
Josh Gao9c02dc52016-06-15 17:29:00 -0700129
Josh Gaocbe70cb2016-10-18 18:17:52 -0700130 export_include_dirs: ["include"],
131}
132
133cc_library {
134 name: "libdebuggerd_client",
135 defaults: ["debuggerd_defaults"],
136 srcs: [
137 "client/debuggerd_client.cpp",
138 "util.cpp",
139 ],
140
Narayan Kamatha73df602017-05-24 15:07:25 +0100141 header_libs: ["libdebuggerd_common_headers"],
142
Josh Gaocbe70cb2016-10-18 18:17:52 -0700143 shared_libs: [
144 "libbase",
145 "libcutils",
Josh Gao4175cee2019-01-04 13:57:09 -0800146 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700147 ],
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800148
Narayan Kamatha73df602017-05-24 15:07:25 +0100149 export_header_lib_headers: ["libdebuggerd_common_headers"],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700150 export_include_dirs: ["include"],
151}
152
Josh Gaoe73c9322017-02-08 16:06:26 -0800153cc_library_static {
Josh Gaocbe70cb2016-10-18 18:17:52 -0700154 name: "libdebuggerd",
155 defaults: ["debuggerd_defaults"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900156 recovery_available: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700157
158 srcs: [
159 "libdebuggerd/backtrace.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700160 "libdebuggerd/open_files_list.cpp",
161 "libdebuggerd/tombstone.cpp",
162 "libdebuggerd/utility.cpp",
163 ],
164
Josh Gaocbe70cb2016-10-18 18:17:52 -0700165 local_include_dirs: ["libdebuggerd/include"],
166 export_include_dirs: ["libdebuggerd/include"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700167
Josh Gaoce841d92018-08-06 18:26:42 -0700168 // Needed for private/bionic_fdsan.h
169 include_dirs: ["bionic/libc"],
170
Josh Gaoe73c9322017-02-08 16:06:26 -0800171 static_libs: [
Martin Stjernholme31cfb62019-02-05 04:59:07 +0000172 "libdexfile_support_static", // libunwindstack dependency
Christopher Ferris9a8c8552017-08-11 15:29:19 -0700173 "libunwindstack",
Josh Gaoe73c9322017-02-08 16:06:26 -0800174 "liblzma",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700175 "libbase",
176 "libcutils",
177 "liblog",
178 ],
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000179 target: {
180 recovery: {
181 exclude_static_libs: [
Martin Stjernholme31cfb62019-02-05 04:59:07 +0000182 "libdexfile_support_static",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000183 ],
184 },
185 },
Christopher Ferris4ae266c2019-04-03 09:27:12 -0700186
187 product_variables: {
188 debuggable: {
189 cflags: ["-DROOT_POSSIBLE"],
190 },
191 },
Josh Gaocbe70cb2016-10-18 18:17:52 -0700192}
193
194cc_test {
195 name: "debuggerd_test",
196 defaults: ["debuggerd_defaults"],
Josh Gao6cad1392019-08-27 16:02:38 -0700197 require_root: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700198
199 cflags: ["-Wno-missing-field-initializers"],
200 srcs: [
201 "libdebuggerd/test/dump_memory_test.cpp",
202 "libdebuggerd/test/elf_fake.cpp",
203 "libdebuggerd/test/log_fake.cpp",
204 "libdebuggerd/test/open_files_list_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700205 "libdebuggerd/test/tombstone_test.cpp",
206 ],
207
208 target: {
209 android: {
210 srcs: [
Josh Gaoae9d7672017-03-24 16:26:03 -0700211 "client/debuggerd_client_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700212 "debuggerd_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700213 ],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800214 static_libs: [
215 "libasync_safe",
216 "libtombstoned_client_static",
217 ],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700218 },
219 },
220
221 shared_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700222 "libbase",
223 "libcutils",
Josh Gaoae9d7672017-03-24 16:26:03 -0700224 "libdebuggerd_client",
Narayan Kamatha73df602017-05-24 15:07:25 +0100225 "liblog",
Josh Gaoe04ca272018-01-16 15:38:17 -0800226 "libminijail",
Elliott Hughesdc699a22018-02-16 17:58:14 -0800227 "libnativehelper",
Martin Stjernholm852b64e2019-02-20 17:01:24 +0000228 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700229 ],
230
231 static_libs: [
Josh Gao352a8452017-03-30 16:46:21 -0700232 "libdebuggerd",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700233 ],
234
235 local_include_dirs: [
236 "libdebuggerd",
237 ],
238
239 compile_multilib: "both",
240 multilib: {
241 lib32: {
242 stem: "debuggerd_test32",
243 },
244 lib64: {
245 stem: "debuggerd_test64",
246 },
247 },
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700248
249 test_suites: ["device-tests"],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700250}
251
Josh Gaoa42314e2017-12-19 15:08:19 -0800252cc_benchmark {
253 name: "debuggerd_benchmark",
254 defaults: ["debuggerd_defaults"],
255 srcs: ["debuggerd_benchmark.cpp"],
256 shared_libs: [
257 "libbase",
258 "libdebuggerd_client",
259 ],
260}
261
Josh Gaocbe70cb2016-10-18 18:17:52 -0700262cc_binary {
263 name: "crash_dump",
264 srcs: [
265 "crash_dump.cpp",
266 "util.cpp",
267 ],
268 defaults: ["debuggerd_defaults"],
269
270 compile_multilib: "both",
271 multilib: {
272 lib32: {
273 suffix: "32",
274 },
275 lib64: {
276 suffix: "64",
277 },
278 },
279
Josh Gaoe73c9322017-02-08 16:06:26 -0800280 static_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100281 "libtombstoned_client_static",
Josh Gaoe73c9322017-02-08 16:06:26 -0800282 "libdebuggerd",
283 "libcutils",
284 ],
285
Josh Gaocbe70cb2016-10-18 18:17:52 -0700286 shared_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700287 "libbase",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700288 "liblog",
289 "libprocinfo",
Josh Gao2b2ae0c2017-08-21 14:31:17 -0700290 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700291 ],
292}
293
294cc_binary {
295 name: "debuggerd",
296 srcs: [
297 "debuggerd.cpp",
298 ],
299 defaults: ["debuggerd_defaults"],
300
301 shared_libs: [
302 "libbase",
303 "libdebuggerd_client",
304 "liblog",
Josh Gao0915f232017-06-27 14:08:05 -0700305 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700306 ],
307
308 local_include_dirs: ["include"],
309}
310
311cc_binary {
312 name: "tombstoned",
313 srcs: [
314 "util.cpp",
315 "tombstoned/intercept_manager.cpp",
316 "tombstoned/tombstoned.cpp",
317 ],
318 defaults: ["debuggerd_defaults"],
319
Narayan Kamatha73df602017-05-24 15:07:25 +0100320 header_libs: ["libdebuggerd_common_headers"],
321
Josh Gaocbe70cb2016-10-18 18:17:52 -0700322 static_libs: [
323 "libbase",
324 "libcutils",
325 "libevent",
326 "liblog",
327 ],
328
Elliott Hughesdc699a22018-02-16 17:58:14 -0800329 init_rc: ["tombstoned/tombstoned.rc"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700330}
Elliott Hughes0ba53592017-02-01 16:59:15 -0800331
332subdirs = [
333 "crasher",
334]