blob: 7b6f6c067235fc555f8f954ed872deabe7e7da1b [file] [log] [blame]
Bob Badourd69ad692021-02-16 19:02:14 -08001package {
2 default_applicable_licenses: ["system_core_debuggerd_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18// See: http://go/android-license-faq
19license {
20 name: "system_core_debuggerd_license",
21 visibility: [":__subpackages__"],
22 license_kinds: [
23 "SPDX-license-identifier-Apache-2.0",
24 "SPDX-license-identifier-BSD",
25 ],
26 // large-scale-change unable to identify any license_text files
27}
28
Josh Gaocbe70cb2016-10-18 18:17:52 -070029cc_defaults {
30 name: "debuggerd_defaults",
31 cflags: [
32 "-Wall",
33 "-Wextra",
Josh Gaoc7fe0602017-03-13 14:13:29 -070034 "-Werror",
Josh Gao2b2ae0c2017-08-21 14:31:17 -070035 "-Wno-unused-argument",
36 "-Wno-unused-function",
Josh Gaocbe70cb2016-10-18 18:17:52 -070037 "-Wno-nullability-completeness",
38 "-Os",
39 ],
40
41 local_include_dirs: ["include"],
42}
43
Narayan Kamatha73df602017-05-24 15:07:25 +010044cc_library_headers {
45 name: "libdebuggerd_common_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080046 export_include_dirs: ["common/include"],
Jiyong Parka0e75042018-05-24 14:11:00 +090047 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -070048 vendor_ramdisk_available: true,
Narayan Kamatha73df602017-05-24 15:07:25 +010049}
50
Narayan Kamath2d377cd2017-05-10 10:58:59 +010051cc_library_shared {
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080052 name: "libtombstoned_client",
53 defaults: ["debuggerd_defaults"],
54 srcs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +010055 "tombstoned/tombstoned_client.cpp",
56 "util.cpp",
57 ],
58
Narayan Kamatha73df602017-05-24 15:07:25 +010059 header_libs: ["libdebuggerd_common_headers"],
60
Narayan Kamath2d377cd2017-05-10 10:58:59 +010061 static_libs: [
Narayan Kamatha73df602017-05-24 15:07:25 +010062 "libasync_safe",
Narayan Kamath2d377cd2017-05-10 10:58:59 +010063 ],
64
65 shared_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +010066 "libbase",
Narayan Kamatha73df602017-05-24 15:07:25 +010067 "libcutils",
Narayan Kamath2d377cd2017-05-10 10:58:59 +010068 ],
69
Narayan Kamatha73df602017-05-24 15:07:25 +010070 export_header_lib_headers: ["libdebuggerd_common_headers"],
Elliott Hughesdc699a22018-02-16 17:58:14 -080071 export_include_dirs: ["tombstoned/include"],
Narayan Kamath2d377cd2017-05-10 10:58:59 +010072}
73
Josh Gao9da1f512018-08-06 15:38:29 -070074// Utility library to talk to tombstoned and get an output fd.
Narayan Kamath2d377cd2017-05-10 10:58:59 +010075cc_library_static {
76 name: "libtombstoned_client_static",
77 defaults: ["debuggerd_defaults"],
Jiyong Park011ee122018-05-29 16:41:30 +090078 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -070079 vendor_ramdisk_available: true,
Narayan Kamath2d377cd2017-05-10 10:58:59 +010080 srcs: [
81 "tombstoned/tombstoned_client.cpp",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080082 "util.cpp",
83 ],
84
Narayan Kamatha73df602017-05-24 15:07:25 +010085 header_libs: ["libdebuggerd_common_headers"],
86
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080087 whole_static_libs: [
Christopher Ferrisac225782017-04-25 11:23:10 -070088 "libasync_safe",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080089 "libcutils",
90 "libbase",
91 ],
Narayan Kamath2d377cd2017-05-10 10:58:59 +010092
Narayan Kamatha73df602017-05-24 15:07:25 +010093 export_header_lib_headers: ["libdebuggerd_common_headers"],
Elliott Hughesdc699a22018-02-16 17:58:14 -080094 export_include_dirs: ["tombstoned/include"],
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080095}
96
97// Core implementation, linked into libdebuggerd_handler and the dynamic linker.
Josh Gao9c02dc52016-06-15 17:29:00 -070098cc_library_static {
Josh Gaoe73c9322017-02-08 16:06:26 -080099 name: "libdebuggerd_handler_core",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700100 defaults: ["debuggerd_defaults"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900101 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -0700102 vendor_ramdisk_available: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700103 srcs: ["handler/debuggerd_handler.cpp"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700104
Josh Gaofdf832d2017-08-25 18:00:18 -0700105 header_libs: [
106 "libbase_headers",
107 "libdebuggerd_common_headers",
Josh Gaoa48b41b2019-12-13 14:11:04 -0800108 "bionic_libc_platform_headers",
Josh Gaofdf832d2017-08-25 18:00:18 -0700109 ],
Narayan Kamatha73df602017-05-24 15:07:25 +0100110
Josh Gaoe73c9322017-02-08 16:06:26 -0800111 whole_static_libs: [
Christopher Ferrisac225782017-04-25 11:23:10 -0700112 "libasync_safe",
Josh Gao2b2ae0c2017-08-21 14:31:17 -0700113 "libcutils",
Josh Gaoe73c9322017-02-08 16:06:26 -0800114 "libdebuggerd",
115 ],
116
Narayan Kamatha73df602017-05-24 15:07:25 +0100117 export_header_lib_headers: ["libdebuggerd_common_headers"],
Josh Gaoe73c9322017-02-08 16:06:26 -0800118 export_include_dirs: ["include"],
119}
120
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800121// Implementation with a no-op fallback.
Josh Gaoe73c9322017-02-08 16:06:26 -0800122cc_library_static {
123 name: "libdebuggerd_handler",
124 defaults: ["debuggerd_defaults"],
125 srcs: ["handler/debuggerd_fallback_nop.cpp"],
126
Josh Gaoa48b41b2019-12-13 14:11:04 -0800127 header_libs: ["bionic_libc_platform_headers"],
128 export_header_lib_headers: ["bionic_libc_platform_headers"],
129
Josh Gaoe73c9322017-02-08 16:06:26 -0800130 whole_static_libs: [
131 "libdebuggerd_handler_core",
132 ],
133
134 export_include_dirs: ["include"],
135}
136
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100137// Fallback implementation, for use in the Bionic linker only.
Josh Gaoe73c9322017-02-08 16:06:26 -0800138cc_library_static {
139 name: "libdebuggerd_handler_fallback",
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100140 visibility: ["//bionic/linker"],
141 apex_available: [
142 "com.android.runtime",
143 "//apex_available:platform",
144 ],
Josh Gaoe73c9322017-02-08 16:06:26 -0800145 defaults: ["debuggerd_defaults"],
Jiyong Park011ee122018-05-29 16:41:30 +0900146 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -0700147 vendor_ramdisk_available: true,
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800148 srcs: [
149 "handler/debuggerd_fallback.cpp",
150 ],
Josh Gaoe73c9322017-02-08 16:06:26 -0800151
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800152 whole_static_libs: [
153 "libdebuggerd_handler_core",
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100154 "libtombstoned_client_static",
Christopher Ferrisac225782017-04-25 11:23:10 -0700155 "libasync_safe",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800156 "libbase",
Josh Gaoe73c9322017-02-08 16:06:26 -0800157 "libdebuggerd",
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100158 "libunwindstack_no_dex",
Josh Gaoe73c9322017-02-08 16:06:26 -0800159 "liblzma",
160 "libcutils",
161 ],
Josh Gaoa48b41b2019-12-13 14:11:04 -0800162
163 header_libs: ["bionic_libc_platform_headers"],
164 export_header_lib_headers: ["bionic_libc_platform_headers"],
165
Josh Gaocbe70cb2016-10-18 18:17:52 -0700166 export_include_dirs: ["include"],
167}
168
169cc_library {
170 name: "libdebuggerd_client",
171 defaults: ["debuggerd_defaults"],
172 srcs: [
173 "client/debuggerd_client.cpp",
174 "util.cpp",
175 ],
176
177 shared_libs: [
178 "libbase",
179 "libcutils",
Josh Gao4175cee2019-01-04 13:57:09 -0800180 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700181 ],
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800182
Josh Gaoa48b41b2019-12-13 14:11:04 -0800183 header_libs: [
184 "libdebuggerd_common_headers",
185 "bionic_libc_platform_headers",
186 ],
187 export_header_lib_headers: [
188 "libdebuggerd_common_headers",
189 "bionic_libc_platform_headers",
190 ],
191
Josh Gaocbe70cb2016-10-18 18:17:52 -0700192 export_include_dirs: ["include"],
193}
194
Josh Gaoe73c9322017-02-08 16:06:26 -0800195cc_library_static {
Josh Gaocbe70cb2016-10-18 18:17:52 -0700196 name: "libdebuggerd",
197 defaults: ["debuggerd_defaults"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900198 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -0700199 vendor_ramdisk_available: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700200
201 srcs: [
202 "libdebuggerd/backtrace.cpp",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800203 "libdebuggerd/gwp_asan.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700204 "libdebuggerd/open_files_list.cpp",
Peter Collingbournef8622522020-04-07 14:07:32 -0700205 "libdebuggerd/scudo.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700206 "libdebuggerd/tombstone.cpp",
Josh Gao76e1e302021-01-26 15:53:11 -0800207 "libdebuggerd/tombstone_proto.cpp",
208 "libdebuggerd/tombstone_proto_to_text.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700209 "libdebuggerd/utility.cpp",
210 ],
211
Josh Gaocbe70cb2016-10-18 18:17:52 -0700212 local_include_dirs: ["libdebuggerd/include"],
213 export_include_dirs: ["libdebuggerd/include"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700214
Peter Collingbournef8622522020-04-07 14:07:32 -0700215 include_dirs: [
216 // Needed for private/bionic_fdsan.h
217 "bionic/libc",
218
219 // Needed for scudo/interface.h
220 "external/scudo/standalone/include",
221 ],
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800222 header_libs: [
223 "bionic_libc_platform_headers",
224 "gwp_asan_headers",
225 ],
Josh Gaoce841d92018-08-06 18:26:42 -0700226
Josh Gaoe73c9322017-02-08 16:06:26 -0800227 static_libs: [
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100228 "libdexfile_support", // libunwindstack dependency
Christopher Ferris9a8c8552017-08-11 15:29:19 -0700229 "libunwindstack",
Josh Gaoe73c9322017-02-08 16:06:26 -0800230 "liblzma",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700231 "libbase",
232 "libcutils",
233 "liblog",
234 ],
Josh Gaoa48b41b2019-12-13 14:11:04 -0800235
Peter Collingbournef8622522020-04-07 14:07:32 -0700236 whole_static_libs: [
Josh Gao618cea32021-01-26 17:45:43 -0800237 "libasync_safe",
Peter Collingbournef8622522020-04-07 14:07:32 -0700238 "gwp_asan_crash_handler",
239 "libscudo",
Josh Gao76e1e302021-01-26 15:53:11 -0800240 "libtombstone_proto",
Josh Gaodbb83de2021-03-01 23:13:13 -0800241 "libprocinfo",
Josh Gao76e1e302021-01-26 15:53:11 -0800242 "libprotobuf-cpp-lite",
Peter Collingbournef8622522020-04-07 14:07:32 -0700243 ],
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800244
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000245 target: {
246 recovery: {
247 exclude_static_libs: [
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100248 "libdexfile_support",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000249 ],
250 },
Yifan Hong2ec92cf2020-10-27 16:25:45 -0700251 vendor_ramdisk: {
252 exclude_static_libs: [
253 "libdexfile_support",
254 ],
255 },
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000256 },
Christopher Ferris4ae266c2019-04-03 09:27:12 -0700257
258 product_variables: {
259 debuggable: {
260 cflags: ["-DROOT_POSSIBLE"],
261 },
262 },
Josh Gaocbe70cb2016-10-18 18:17:52 -0700263}
264
Josh Gao76e1e302021-01-26 15:53:11 -0800265cc_binary {
266 name: "pbtombstone",
267 defaults: ["debuggerd_defaults"],
268 srcs: ["pbtombstone.cpp"],
269 static_libs: [
270 "libbase",
271 "libdebuggerd",
272 "liblog",
273 "libprotobuf-cpp-lite",
274 "libtombstone_proto",
275 "libunwindstack",
276 ],
277}
278
Josh Gaocbe70cb2016-10-18 18:17:52 -0700279cc_test {
280 name: "debuggerd_test",
281 defaults: ["debuggerd_defaults"],
Josh Gao6cad1392019-08-27 16:02:38 -0700282 require_root: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700283
284 cflags: ["-Wno-missing-field-initializers"],
285 srcs: [
286 "libdebuggerd/test/dump_memory_test.cpp",
287 "libdebuggerd/test/elf_fake.cpp",
288 "libdebuggerd/test/log_fake.cpp",
289 "libdebuggerd/test/open_files_list_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700290 "libdebuggerd/test/tombstone_test.cpp",
291 ],
292
293 target: {
294 android: {
295 srcs: [
Josh Gaoae9d7672017-03-24 16:26:03 -0700296 "client/debuggerd_client_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700297 "debuggerd_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700298 ],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800299 static_libs: [
300 "libasync_safe",
301 "libtombstoned_client_static",
302 ],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700303 },
304 },
305
306 shared_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700307 "libbase",
308 "libcutils",
Josh Gaoae9d7672017-03-24 16:26:03 -0700309 "libdebuggerd_client",
Narayan Kamatha73df602017-05-24 15:07:25 +0100310 "liblog",
Elliott Hughesdc699a22018-02-16 17:58:14 -0800311 "libnativehelper",
Martin Stjernholm852b64e2019-02-20 17:01:24 +0000312 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700313 ],
314
315 static_libs: [
Josh Gao352a8452017-03-30 16:46:21 -0700316 "libdebuggerd",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800317 "libgmock",
Peter Collingbourned00a5772020-07-20 23:11:16 -0700318 "libminijail",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700319 ],
320
Josh Gaoa48b41b2019-12-13 14:11:04 -0800321 header_libs: [
322 "bionic_libc_platform_headers",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800323 "gwp_asan_headers",
Josh Gaoa48b41b2019-12-13 14:11:04 -0800324 ],
325
Peter Collingbournef8622522020-04-07 14:07:32 -0700326 include_dirs: [
327 "external/scudo/standalone/include",
328 ],
329
Josh Gaocbe70cb2016-10-18 18:17:52 -0700330 local_include_dirs: [
331 "libdebuggerd",
332 ],
333
334 compile_multilib: "both",
335 multilib: {
336 lib32: {
337 stem: "debuggerd_test32",
338 },
339 lib64: {
340 stem: "debuggerd_test64",
341 },
342 },
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700343
344 test_suites: ["device-tests"],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700345}
346
Josh Gaoa42314e2017-12-19 15:08:19 -0800347cc_benchmark {
348 name: "debuggerd_benchmark",
349 defaults: ["debuggerd_defaults"],
350 srcs: ["debuggerd_benchmark.cpp"],
351 shared_libs: [
352 "libbase",
353 "libdebuggerd_client",
354 ],
355}
356
Josh Gaocbe70cb2016-10-18 18:17:52 -0700357cc_binary {
358 name: "crash_dump",
359 srcs: [
360 "crash_dump.cpp",
361 "util.cpp",
362 ],
363 defaults: ["debuggerd_defaults"],
364
365 compile_multilib: "both",
366 multilib: {
367 lib32: {
368 suffix: "32",
369 },
370 lib64: {
371 suffix: "64",
372 },
373 },
374
Josh Gaoa48b41b2019-12-13 14:11:04 -0800375 header_libs: [
376 "bionic_libc_platform_headers",
377 ],
378
Josh Gaoe73c9322017-02-08 16:06:26 -0800379 static_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100380 "libtombstoned_client_static",
Josh Gaoe73c9322017-02-08 16:06:26 -0800381 "libdebuggerd",
382 "libcutils",
Josh Gao76e1e302021-01-26 15:53:11 -0800383
384 "libtombstone_proto",
385 "libprotobuf-cpp-lite",
Josh Gaoe73c9322017-02-08 16:06:26 -0800386 ],
387
Josh Gaocbe70cb2016-10-18 18:17:52 -0700388 shared_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700389 "libbase",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700390 "liblog",
391 "libprocinfo",
Josh Gao2b2ae0c2017-08-21 14:31:17 -0700392 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700393 ],
Peter Collingbourneb72e7482020-03-16 18:14:13 -0700394
395 apex_available: [
396 "com.android.runtime",
397 ],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700398}
399
400cc_binary {
401 name: "debuggerd",
402 srcs: [
403 "debuggerd.cpp",
404 ],
405 defaults: ["debuggerd_defaults"],
406
407 shared_libs: [
408 "libbase",
409 "libdebuggerd_client",
410 "liblog",
Josh Gao0915f232017-06-27 14:08:05 -0700411 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700412 ],
413
414 local_include_dirs: ["include"],
415}
416
417cc_binary {
418 name: "tombstoned",
419 srcs: [
420 "util.cpp",
421 "tombstoned/intercept_manager.cpp",
422 "tombstoned/tombstoned.cpp",
423 ],
424 defaults: ["debuggerd_defaults"],
425
Josh Gaoa48b41b2019-12-13 14:11:04 -0800426 header_libs: [
427 "bionic_libc_platform_headers",
428 "libdebuggerd_common_headers"
429 ],
Narayan Kamatha73df602017-05-24 15:07:25 +0100430
Josh Gaocbe70cb2016-10-18 18:17:52 -0700431 static_libs: [
432 "libbase",
433 "libcutils",
434 "libevent",
435 "liblog",
436 ],
437
Elliott Hughesdc699a22018-02-16 17:58:14 -0800438 init_rc: ["tombstoned/tombstoned.rc"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700439}
Ray Essickbd3ba782020-01-21 15:21:08 -0800440
441prebuilt_etc {
442 name: "crash_dump.policy",
443 sub_dir: "seccomp_policy",
444 filename_from_src: true,
445 arch: {
446 arm: {
447 src: "seccomp_policy/crash_dump.arm.policy",
448 },
449 arm64: {
450 src: "seccomp_policy/crash_dump.arm64.policy",
451 },
452 x86: {
453 src: "seccomp_policy/crash_dump.x86.policy",
454 },
455 x86_64: {
456 src: "seccomp_policy/crash_dump.x86_64.policy",
457 },
458 },
459 required: [
460 "crash_dump.policy_other",
461 ],
462}
463
464
465// NB -- this installs "the other" architecture. (puts 32 bit config in on 64 bit device)
466// or at least that is the intention so that we get both of them populated
467prebuilt_etc {
468 name: "crash_dump.policy_other",
469 sub_dir: "seccomp_policy",
470 filename_from_src: true,
471 arch: {
472 arm: {
473 src: "seccomp_policy/crash_dump.arm64.policy",
474 },
475 arm64: {
476 src: "seccomp_policy/crash_dump.arm.policy",
477 },
478 x86: {
479 src: "seccomp_policy/crash_dump.x86_64.policy",
480 },
481 x86_64: {
482 src: "seccomp_policy/crash_dump.x86.policy",
483 },
484 },
485}