blob: c7bd1a83bd71fa63e370b8e9440db6eef4d18802 [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",
Josh Gaoa48b41b2019-12-13 14:11:04 -080077 "bionic_libc_platform_headers",
Josh Gaofdf832d2017-08-25 18:00:18 -070078 ],
Narayan Kamatha73df602017-05-24 15:07:25 +010079
Josh Gaoe73c9322017-02-08 16:06:26 -080080 whole_static_libs: [
Christopher Ferrisac225782017-04-25 11:23:10 -070081 "libasync_safe",
Josh Gao2b2ae0c2017-08-21 14:31:17 -070082 "libcutils",
Josh Gaoe73c9322017-02-08 16:06:26 -080083 "libdebuggerd",
84 ],
85
Narayan Kamatha73df602017-05-24 15:07:25 +010086 export_header_lib_headers: ["libdebuggerd_common_headers"],
Josh Gaoe73c9322017-02-08 16:06:26 -080087 export_include_dirs: ["include"],
88}
89
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080090// Implementation with a no-op fallback.
Josh Gaoe73c9322017-02-08 16:06:26 -080091cc_library_static {
92 name: "libdebuggerd_handler",
93 defaults: ["debuggerd_defaults"],
94 srcs: ["handler/debuggerd_fallback_nop.cpp"],
95
Josh Gaoa48b41b2019-12-13 14:11:04 -080096 header_libs: ["bionic_libc_platform_headers"],
97 export_header_lib_headers: ["bionic_libc_platform_headers"],
98
Josh Gaoe73c9322017-02-08 16:06:26 -080099 whole_static_libs: [
100 "libdebuggerd_handler_core",
101 ],
102
103 export_include_dirs: ["include"],
104}
105
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100106// Fallback implementation, for use in the Bionic linker only.
Josh Gaoe73c9322017-02-08 16:06:26 -0800107cc_library_static {
108 name: "libdebuggerd_handler_fallback",
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100109 visibility: ["//bionic/linker"],
110 apex_available: [
111 "com.android.runtime",
112 "//apex_available:platform",
113 ],
Josh Gaoe73c9322017-02-08 16:06:26 -0800114 defaults: ["debuggerd_defaults"],
Jiyong Park011ee122018-05-29 16:41:30 +0900115 recovery_available: true,
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800116 srcs: [
117 "handler/debuggerd_fallback.cpp",
118 ],
Josh Gaoe73c9322017-02-08 16:06:26 -0800119
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800120 whole_static_libs: [
121 "libdebuggerd_handler_core",
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100122 "libtombstoned_client_static",
Christopher Ferrisac225782017-04-25 11:23:10 -0700123 "libasync_safe",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800124 "libbase",
Josh Gaoe73c9322017-02-08 16:06:26 -0800125 "libdebuggerd",
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100126 "libunwindstack_no_dex",
Josh Gaoe73c9322017-02-08 16:06:26 -0800127 "liblzma",
128 "libcutils",
129 ],
Josh Gaoa48b41b2019-12-13 14:11:04 -0800130
131 header_libs: ["bionic_libc_platform_headers"],
132 export_header_lib_headers: ["bionic_libc_platform_headers"],
133
Josh Gaocbe70cb2016-10-18 18:17:52 -0700134 export_include_dirs: ["include"],
135}
136
137cc_library {
138 name: "libdebuggerd_client",
139 defaults: ["debuggerd_defaults"],
140 srcs: [
141 "client/debuggerd_client.cpp",
142 "util.cpp",
143 ],
144
145 shared_libs: [
146 "libbase",
147 "libcutils",
Josh Gao4175cee2019-01-04 13:57:09 -0800148 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700149 ],
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800150
Josh Gaoa48b41b2019-12-13 14:11:04 -0800151 header_libs: [
152 "libdebuggerd_common_headers",
153 "bionic_libc_platform_headers",
154 ],
155 export_header_lib_headers: [
156 "libdebuggerd_common_headers",
157 "bionic_libc_platform_headers",
158 ],
159
Josh Gaocbe70cb2016-10-18 18:17:52 -0700160 export_include_dirs: ["include"],
161}
162
Josh Gaoe73c9322017-02-08 16:06:26 -0800163cc_library_static {
Josh Gaocbe70cb2016-10-18 18:17:52 -0700164 name: "libdebuggerd",
165 defaults: ["debuggerd_defaults"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900166 recovery_available: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700167
168 srcs: [
169 "libdebuggerd/backtrace.cpp",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800170 "libdebuggerd/gwp_asan.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700171 "libdebuggerd/open_files_list.cpp",
172 "libdebuggerd/tombstone.cpp",
173 "libdebuggerd/utility.cpp",
174 ],
175
Josh Gaocbe70cb2016-10-18 18:17:52 -0700176 local_include_dirs: ["libdebuggerd/include"],
177 export_include_dirs: ["libdebuggerd/include"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700178
Josh Gaoce841d92018-08-06 18:26:42 -0700179 // Needed for private/bionic_fdsan.h
180 include_dirs: ["bionic/libc"],
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800181 header_libs: [
182 "bionic_libc_platform_headers",
183 "gwp_asan_headers",
184 ],
Josh Gaoce841d92018-08-06 18:26:42 -0700185
Josh Gaoe73c9322017-02-08 16:06:26 -0800186 static_libs: [
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100187 "libdexfile_support", // libunwindstack dependency
Christopher Ferris9a8c8552017-08-11 15:29:19 -0700188 "libunwindstack",
Josh Gaoe73c9322017-02-08 16:06:26 -0800189 "liblzma",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700190 "libbase",
191 "libcutils",
192 "liblog",
193 ],
Josh Gaoa48b41b2019-12-13 14:11:04 -0800194
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800195 whole_static_libs: ["gwp_asan_crash_handler"],
196
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000197 target: {
198 recovery: {
199 exclude_static_libs: [
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100200 "libdexfile_support",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000201 ],
202 },
203 },
Christopher Ferris4ae266c2019-04-03 09:27:12 -0700204
205 product_variables: {
206 debuggable: {
207 cflags: ["-DROOT_POSSIBLE"],
208 },
209 },
Josh Gaocbe70cb2016-10-18 18:17:52 -0700210}
211
212cc_test {
213 name: "debuggerd_test",
214 defaults: ["debuggerd_defaults"],
Josh Gao6cad1392019-08-27 16:02:38 -0700215 require_root: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700216
217 cflags: ["-Wno-missing-field-initializers"],
218 srcs: [
219 "libdebuggerd/test/dump_memory_test.cpp",
220 "libdebuggerd/test/elf_fake.cpp",
221 "libdebuggerd/test/log_fake.cpp",
222 "libdebuggerd/test/open_files_list_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700223 "libdebuggerd/test/tombstone_test.cpp",
224 ],
225
226 target: {
227 android: {
228 srcs: [
Josh Gaoae9d7672017-03-24 16:26:03 -0700229 "client/debuggerd_client_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700230 "debuggerd_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700231 ],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800232 static_libs: [
233 "libasync_safe",
234 "libtombstoned_client_static",
235 ],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700236 },
237 },
238
239 shared_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700240 "libbase",
241 "libcutils",
Josh Gaoae9d7672017-03-24 16:26:03 -0700242 "libdebuggerd_client",
Narayan Kamatha73df602017-05-24 15:07:25 +0100243 "liblog",
Josh Gaoe04ca272018-01-16 15:38:17 -0800244 "libminijail",
Elliott Hughesdc699a22018-02-16 17:58:14 -0800245 "libnativehelper",
Martin Stjernholm852b64e2019-02-20 17:01:24 +0000246 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700247 ],
248
249 static_libs: [
Josh Gao352a8452017-03-30 16:46:21 -0700250 "libdebuggerd",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800251 "libgmock",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700252 ],
253
Josh Gaoa48b41b2019-12-13 14:11:04 -0800254 header_libs: [
255 "bionic_libc_platform_headers",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800256 "gwp_asan_headers",
Josh Gaoa48b41b2019-12-13 14:11:04 -0800257 ],
258
Josh Gaocbe70cb2016-10-18 18:17:52 -0700259 local_include_dirs: [
260 "libdebuggerd",
261 ],
262
263 compile_multilib: "both",
264 multilib: {
265 lib32: {
266 stem: "debuggerd_test32",
267 },
268 lib64: {
269 stem: "debuggerd_test64",
270 },
271 },
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700272
273 test_suites: ["device-tests"],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700274}
275
Josh Gaoa42314e2017-12-19 15:08:19 -0800276cc_benchmark {
277 name: "debuggerd_benchmark",
278 defaults: ["debuggerd_defaults"],
279 srcs: ["debuggerd_benchmark.cpp"],
280 shared_libs: [
281 "libbase",
282 "libdebuggerd_client",
283 ],
284}
285
Josh Gaocbe70cb2016-10-18 18:17:52 -0700286cc_binary {
287 name: "crash_dump",
288 srcs: [
289 "crash_dump.cpp",
290 "util.cpp",
291 ],
292 defaults: ["debuggerd_defaults"],
293
294 compile_multilib: "both",
295 multilib: {
296 lib32: {
297 suffix: "32",
298 },
299 lib64: {
300 suffix: "64",
301 },
302 },
303
Josh Gaoa48b41b2019-12-13 14:11:04 -0800304 header_libs: [
305 "bionic_libc_platform_headers",
306 ],
307
Josh Gaoe73c9322017-02-08 16:06:26 -0800308 static_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100309 "libtombstoned_client_static",
Josh Gaoe73c9322017-02-08 16:06:26 -0800310 "libdebuggerd",
311 "libcutils",
312 ],
313
Josh Gaocbe70cb2016-10-18 18:17:52 -0700314 shared_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700315 "libbase",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700316 "liblog",
317 "libprocinfo",
Josh Gao2b2ae0c2017-08-21 14:31:17 -0700318 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700319 ],
320}
321
322cc_binary {
323 name: "debuggerd",
324 srcs: [
325 "debuggerd.cpp",
326 ],
327 defaults: ["debuggerd_defaults"],
328
329 shared_libs: [
330 "libbase",
331 "libdebuggerd_client",
332 "liblog",
Josh Gao0915f232017-06-27 14:08:05 -0700333 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700334 ],
335
336 local_include_dirs: ["include"],
337}
338
339cc_binary {
340 name: "tombstoned",
341 srcs: [
342 "util.cpp",
343 "tombstoned/intercept_manager.cpp",
344 "tombstoned/tombstoned.cpp",
345 ],
346 defaults: ["debuggerd_defaults"],
347
Josh Gaoa48b41b2019-12-13 14:11:04 -0800348 header_libs: [
349 "bionic_libc_platform_headers",
350 "libdebuggerd_common_headers"
351 ],
Narayan Kamatha73df602017-05-24 15:07:25 +0100352
Josh Gaocbe70cb2016-10-18 18:17:52 -0700353 static_libs: [
354 "libbase",
355 "libcutils",
356 "libevent",
357 "liblog",
358 ],
359
Elliott Hughesdc699a22018-02-16 17:58:14 -0800360 init_rc: ["tombstoned/tombstoned.rc"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700361}
Ray Essickbd3ba782020-01-21 15:21:08 -0800362
363prebuilt_etc {
364 name: "crash_dump.policy",
365 sub_dir: "seccomp_policy",
366 filename_from_src: true,
367 arch: {
368 arm: {
369 src: "seccomp_policy/crash_dump.arm.policy",
370 },
371 arm64: {
372 src: "seccomp_policy/crash_dump.arm64.policy",
373 },
374 x86: {
375 src: "seccomp_policy/crash_dump.x86.policy",
376 },
377 x86_64: {
378 src: "seccomp_policy/crash_dump.x86_64.policy",
379 },
380 },
381 required: [
382 "crash_dump.policy_other",
383 ],
384}
385
386
387// NB -- this installs "the other" architecture. (puts 32 bit config in on 64 bit device)
388// or at least that is the intention so that we get both of them populated
389prebuilt_etc {
390 name: "crash_dump.policy_other",
391 sub_dir: "seccomp_policy",
392 filename_from_src: true,
393 arch: {
394 arm: {
395 src: "seccomp_policy/crash_dump.arm64.policy",
396 },
397 arm64: {
398 src: "seccomp_policy/crash_dump.arm.policy",
399 },
400 x86: {
401 src: "seccomp_policy/crash_dump.x86_64.policy",
402 },
403 x86_64: {
404 src: "seccomp_policy/crash_dump.x86.policy",
405 },
406 },
407}