blob: 2390d79797942b7fcc5c08e8072cad5e78539aa0 [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,
Yifan Hong2ec92cf2020-10-27 16:25:45 -070020 vendor_ramdisk_available: true,
Narayan Kamatha73df602017-05-24 15:07:25 +010021}
22
Narayan Kamath2d377cd2017-05-10 10:58:59 +010023cc_library_shared {
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080024 name: "libtombstoned_client",
25 defaults: ["debuggerd_defaults"],
26 srcs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +010027 "tombstoned/tombstoned_client.cpp",
28 "util.cpp",
29 ],
30
Narayan Kamatha73df602017-05-24 15:07:25 +010031 header_libs: ["libdebuggerd_common_headers"],
32
Narayan Kamath2d377cd2017-05-10 10:58:59 +010033 static_libs: [
Narayan Kamatha73df602017-05-24 15:07:25 +010034 "libasync_safe",
Narayan Kamath2d377cd2017-05-10 10:58:59 +010035 ],
36
37 shared_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +010038 "libbase",
Narayan Kamatha73df602017-05-24 15:07:25 +010039 "libcutils",
Narayan Kamath2d377cd2017-05-10 10:58:59 +010040 ],
41
Narayan Kamatha73df602017-05-24 15:07:25 +010042 export_header_lib_headers: ["libdebuggerd_common_headers"],
Elliott Hughesdc699a22018-02-16 17:58:14 -080043 export_include_dirs: ["tombstoned/include"],
Narayan Kamath2d377cd2017-05-10 10:58:59 +010044}
45
Josh Gao9da1f512018-08-06 15:38:29 -070046// Utility library to talk to tombstoned and get an output fd.
Narayan Kamath2d377cd2017-05-10 10:58:59 +010047cc_library_static {
48 name: "libtombstoned_client_static",
49 defaults: ["debuggerd_defaults"],
Jiyong Park011ee122018-05-29 16:41:30 +090050 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -070051 vendor_ramdisk_available: true,
Narayan Kamath2d377cd2017-05-10 10:58:59 +010052 srcs: [
53 "tombstoned/tombstoned_client.cpp",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080054 "util.cpp",
55 ],
56
Narayan Kamatha73df602017-05-24 15:07:25 +010057 header_libs: ["libdebuggerd_common_headers"],
58
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080059 whole_static_libs: [
Christopher Ferrisac225782017-04-25 11:23:10 -070060 "libasync_safe",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080061 "libcutils",
62 "libbase",
63 ],
Narayan Kamath2d377cd2017-05-10 10:58:59 +010064
Narayan Kamatha73df602017-05-24 15:07:25 +010065 export_header_lib_headers: ["libdebuggerd_common_headers"],
Elliott Hughesdc699a22018-02-16 17:58:14 -080066 export_include_dirs: ["tombstoned/include"],
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080067}
68
69// Core implementation, linked into libdebuggerd_handler and the dynamic linker.
Josh Gao9c02dc52016-06-15 17:29:00 -070070cc_library_static {
Josh Gaoe73c9322017-02-08 16:06:26 -080071 name: "libdebuggerd_handler_core",
Josh Gaocbe70cb2016-10-18 18:17:52 -070072 defaults: ["debuggerd_defaults"],
Jiyong Parka0e75042018-05-24 14:11:00 +090073 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -070074 vendor_ramdisk_available: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -070075 srcs: ["handler/debuggerd_handler.cpp"],
Josh Gao9c02dc52016-06-15 17:29:00 -070076
Josh Gaofdf832d2017-08-25 18:00:18 -070077 header_libs: [
78 "libbase_headers",
79 "libdebuggerd_common_headers",
Josh Gaoa48b41b2019-12-13 14:11:04 -080080 "bionic_libc_platform_headers",
Josh Gaofdf832d2017-08-25 18:00:18 -070081 ],
Narayan Kamatha73df602017-05-24 15:07:25 +010082
Josh Gaoe73c9322017-02-08 16:06:26 -080083 whole_static_libs: [
Christopher Ferrisac225782017-04-25 11:23:10 -070084 "libasync_safe",
Josh Gao2b2ae0c2017-08-21 14:31:17 -070085 "libcutils",
Josh Gaoe73c9322017-02-08 16:06:26 -080086 "libdebuggerd",
87 ],
88
Narayan Kamatha73df602017-05-24 15:07:25 +010089 export_header_lib_headers: ["libdebuggerd_common_headers"],
Josh Gaoe73c9322017-02-08 16:06:26 -080090 export_include_dirs: ["include"],
91}
92
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080093// Implementation with a no-op fallback.
Josh Gaoe73c9322017-02-08 16:06:26 -080094cc_library_static {
95 name: "libdebuggerd_handler",
96 defaults: ["debuggerd_defaults"],
97 srcs: ["handler/debuggerd_fallback_nop.cpp"],
98
Josh Gaoa48b41b2019-12-13 14:11:04 -080099 header_libs: ["bionic_libc_platform_headers"],
100 export_header_lib_headers: ["bionic_libc_platform_headers"],
101
Josh Gaoe73c9322017-02-08 16:06:26 -0800102 whole_static_libs: [
103 "libdebuggerd_handler_core",
104 ],
105
106 export_include_dirs: ["include"],
107}
108
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100109// Fallback implementation, for use in the Bionic linker only.
Josh Gaoe73c9322017-02-08 16:06:26 -0800110cc_library_static {
111 name: "libdebuggerd_handler_fallback",
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100112 visibility: ["//bionic/linker"],
113 apex_available: [
114 "com.android.runtime",
115 "//apex_available:platform",
116 ],
Josh Gaoe73c9322017-02-08 16:06:26 -0800117 defaults: ["debuggerd_defaults"],
Jiyong Park011ee122018-05-29 16:41:30 +0900118 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -0700119 vendor_ramdisk_available: true,
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800120 srcs: [
121 "handler/debuggerd_fallback.cpp",
122 ],
Josh Gaoe73c9322017-02-08 16:06:26 -0800123
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800124 whole_static_libs: [
125 "libdebuggerd_handler_core",
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100126 "libtombstoned_client_static",
Christopher Ferrisac225782017-04-25 11:23:10 -0700127 "libasync_safe",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800128 "libbase",
Josh Gaoe73c9322017-02-08 16:06:26 -0800129 "libdebuggerd",
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100130 "libunwindstack_no_dex",
Josh Gaoe73c9322017-02-08 16:06:26 -0800131 "liblzma",
132 "libcutils",
133 ],
Josh Gaoa48b41b2019-12-13 14:11:04 -0800134
135 header_libs: ["bionic_libc_platform_headers"],
136 export_header_lib_headers: ["bionic_libc_platform_headers"],
137
Josh Gaocbe70cb2016-10-18 18:17:52 -0700138 export_include_dirs: ["include"],
139}
140
141cc_library {
142 name: "libdebuggerd_client",
143 defaults: ["debuggerd_defaults"],
144 srcs: [
145 "client/debuggerd_client.cpp",
146 "util.cpp",
147 ],
148
149 shared_libs: [
150 "libbase",
151 "libcutils",
Josh Gao4175cee2019-01-04 13:57:09 -0800152 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700153 ],
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800154
Josh Gaoa48b41b2019-12-13 14:11:04 -0800155 header_libs: [
156 "libdebuggerd_common_headers",
157 "bionic_libc_platform_headers",
158 ],
159 export_header_lib_headers: [
160 "libdebuggerd_common_headers",
161 "bionic_libc_platform_headers",
162 ],
163
Josh Gaocbe70cb2016-10-18 18:17:52 -0700164 export_include_dirs: ["include"],
165}
166
Josh Gaoe73c9322017-02-08 16:06:26 -0800167cc_library_static {
Josh Gaocbe70cb2016-10-18 18:17:52 -0700168 name: "libdebuggerd",
169 defaults: ["debuggerd_defaults"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900170 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -0700171 vendor_ramdisk_available: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700172
173 srcs: [
174 "libdebuggerd/backtrace.cpp",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800175 "libdebuggerd/gwp_asan.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700176 "libdebuggerd/open_files_list.cpp",
Peter Collingbournef8622522020-04-07 14:07:32 -0700177 "libdebuggerd/scudo.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700178 "libdebuggerd/tombstone.cpp",
Josh Gao76e1e302021-01-26 15:53:11 -0800179 "libdebuggerd/tombstone_proto.cpp",
180 "libdebuggerd/tombstone_proto_to_text.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700181 "libdebuggerd/utility.cpp",
182 ],
183
Josh Gaocbe70cb2016-10-18 18:17:52 -0700184 local_include_dirs: ["libdebuggerd/include"],
185 export_include_dirs: ["libdebuggerd/include"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700186
Peter Collingbournef8622522020-04-07 14:07:32 -0700187 include_dirs: [
188 // Needed for private/bionic_fdsan.h
189 "bionic/libc",
190
191 // Needed for scudo/interface.h
192 "external/scudo/standalone/include",
193 ],
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800194 header_libs: [
195 "bionic_libc_platform_headers",
196 "gwp_asan_headers",
197 ],
Josh Gaoce841d92018-08-06 18:26:42 -0700198
Josh Gaoe73c9322017-02-08 16:06:26 -0800199 static_libs: [
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100200 "libdexfile_support", // libunwindstack dependency
Christopher Ferris9a8c8552017-08-11 15:29:19 -0700201 "libunwindstack",
Josh Gaoe73c9322017-02-08 16:06:26 -0800202 "liblzma",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700203 "libbase",
204 "libcutils",
205 "liblog",
206 ],
Josh Gaoa48b41b2019-12-13 14:11:04 -0800207
Peter Collingbournef8622522020-04-07 14:07:32 -0700208 whole_static_libs: [
209 "gwp_asan_crash_handler",
210 "libscudo",
Josh Gao76e1e302021-01-26 15:53:11 -0800211 "libtombstone_proto",
212 "libprotobuf-cpp-lite",
Peter Collingbournef8622522020-04-07 14:07:32 -0700213 ],
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800214
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000215 target: {
216 recovery: {
217 exclude_static_libs: [
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100218 "libdexfile_support",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000219 ],
220 },
Yifan Hong2ec92cf2020-10-27 16:25:45 -0700221 vendor_ramdisk: {
222 exclude_static_libs: [
223 "libdexfile_support",
224 ],
225 },
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000226 },
Christopher Ferris4ae266c2019-04-03 09:27:12 -0700227
228 product_variables: {
229 debuggable: {
230 cflags: ["-DROOT_POSSIBLE"],
231 },
232 },
Josh Gaocbe70cb2016-10-18 18:17:52 -0700233}
234
Josh Gao76e1e302021-01-26 15:53:11 -0800235cc_binary {
236 name: "pbtombstone",
237 defaults: ["debuggerd_defaults"],
238 srcs: ["pbtombstone.cpp"],
239 static_libs: [
240 "libbase",
241 "libdebuggerd",
242 "liblog",
243 "libprotobuf-cpp-lite",
244 "libtombstone_proto",
245 "libunwindstack",
246 ],
247}
248
Josh Gaocbe70cb2016-10-18 18:17:52 -0700249cc_test {
250 name: "debuggerd_test",
251 defaults: ["debuggerd_defaults"],
Josh Gao6cad1392019-08-27 16:02:38 -0700252 require_root: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700253
254 cflags: ["-Wno-missing-field-initializers"],
255 srcs: [
256 "libdebuggerd/test/dump_memory_test.cpp",
257 "libdebuggerd/test/elf_fake.cpp",
258 "libdebuggerd/test/log_fake.cpp",
259 "libdebuggerd/test/open_files_list_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700260 "libdebuggerd/test/tombstone_test.cpp",
261 ],
262
263 target: {
264 android: {
265 srcs: [
Josh Gaoae9d7672017-03-24 16:26:03 -0700266 "client/debuggerd_client_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700267 "debuggerd_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700268 ],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800269 static_libs: [
270 "libasync_safe",
271 "libtombstoned_client_static",
272 ],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700273 },
274 },
275
276 shared_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700277 "libbase",
278 "libcutils",
Josh Gaoae9d7672017-03-24 16:26:03 -0700279 "libdebuggerd_client",
Narayan Kamatha73df602017-05-24 15:07:25 +0100280 "liblog",
Elliott Hughesdc699a22018-02-16 17:58:14 -0800281 "libnativehelper",
Martin Stjernholm852b64e2019-02-20 17:01:24 +0000282 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700283 ],
284
285 static_libs: [
Josh Gao352a8452017-03-30 16:46:21 -0700286 "libdebuggerd",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800287 "libgmock",
Peter Collingbourned00a5772020-07-20 23:11:16 -0700288 "libminijail",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700289 ],
290
Josh Gaoa48b41b2019-12-13 14:11:04 -0800291 header_libs: [
292 "bionic_libc_platform_headers",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800293 "gwp_asan_headers",
Josh Gaoa48b41b2019-12-13 14:11:04 -0800294 ],
295
Peter Collingbournef8622522020-04-07 14:07:32 -0700296 include_dirs: [
297 "external/scudo/standalone/include",
298 ],
299
Josh Gaocbe70cb2016-10-18 18:17:52 -0700300 local_include_dirs: [
301 "libdebuggerd",
302 ],
303
304 compile_multilib: "both",
305 multilib: {
306 lib32: {
307 stem: "debuggerd_test32",
308 },
309 lib64: {
310 stem: "debuggerd_test64",
311 },
312 },
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700313
314 test_suites: ["device-tests"],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700315}
316
Josh Gaoa42314e2017-12-19 15:08:19 -0800317cc_benchmark {
318 name: "debuggerd_benchmark",
319 defaults: ["debuggerd_defaults"],
320 srcs: ["debuggerd_benchmark.cpp"],
321 shared_libs: [
322 "libbase",
323 "libdebuggerd_client",
324 ],
325}
326
Josh Gaocbe70cb2016-10-18 18:17:52 -0700327cc_binary {
328 name: "crash_dump",
329 srcs: [
330 "crash_dump.cpp",
331 "util.cpp",
332 ],
333 defaults: ["debuggerd_defaults"],
334
335 compile_multilib: "both",
336 multilib: {
337 lib32: {
338 suffix: "32",
339 },
340 lib64: {
341 suffix: "64",
342 },
343 },
344
Josh Gaoa48b41b2019-12-13 14:11:04 -0800345 header_libs: [
346 "bionic_libc_platform_headers",
347 ],
348
Josh Gaoe73c9322017-02-08 16:06:26 -0800349 static_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100350 "libtombstoned_client_static",
Josh Gaoe73c9322017-02-08 16:06:26 -0800351 "libdebuggerd",
352 "libcutils",
Josh Gao76e1e302021-01-26 15:53:11 -0800353
354 "libtombstone_proto",
355 "libprotobuf-cpp-lite",
Josh Gaoe73c9322017-02-08 16:06:26 -0800356 ],
357
Josh Gaocbe70cb2016-10-18 18:17:52 -0700358 shared_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700359 "libbase",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700360 "liblog",
361 "libprocinfo",
Josh Gao2b2ae0c2017-08-21 14:31:17 -0700362 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700363 ],
Peter Collingbourneb72e7482020-03-16 18:14:13 -0700364
365 apex_available: [
366 "com.android.runtime",
367 ],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700368}
369
370cc_binary {
371 name: "debuggerd",
372 srcs: [
373 "debuggerd.cpp",
374 ],
375 defaults: ["debuggerd_defaults"],
376
377 shared_libs: [
378 "libbase",
379 "libdebuggerd_client",
380 "liblog",
Josh Gao0915f232017-06-27 14:08:05 -0700381 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700382 ],
383
384 local_include_dirs: ["include"],
385}
386
387cc_binary {
388 name: "tombstoned",
389 srcs: [
390 "util.cpp",
391 "tombstoned/intercept_manager.cpp",
392 "tombstoned/tombstoned.cpp",
393 ],
394 defaults: ["debuggerd_defaults"],
395
Josh Gaoa48b41b2019-12-13 14:11:04 -0800396 header_libs: [
397 "bionic_libc_platform_headers",
398 "libdebuggerd_common_headers"
399 ],
Narayan Kamatha73df602017-05-24 15:07:25 +0100400
Josh Gaocbe70cb2016-10-18 18:17:52 -0700401 static_libs: [
402 "libbase",
403 "libcutils",
404 "libevent",
405 "liblog",
406 ],
407
Elliott Hughesdc699a22018-02-16 17:58:14 -0800408 init_rc: ["tombstoned/tombstoned.rc"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700409}
Ray Essickbd3ba782020-01-21 15:21:08 -0800410
411prebuilt_etc {
412 name: "crash_dump.policy",
413 sub_dir: "seccomp_policy",
414 filename_from_src: true,
415 arch: {
416 arm: {
417 src: "seccomp_policy/crash_dump.arm.policy",
418 },
419 arm64: {
420 src: "seccomp_policy/crash_dump.arm64.policy",
421 },
422 x86: {
423 src: "seccomp_policy/crash_dump.x86.policy",
424 },
425 x86_64: {
426 src: "seccomp_policy/crash_dump.x86_64.policy",
427 },
428 },
429 required: [
430 "crash_dump.policy_other",
431 ],
432}
433
434
435// NB -- this installs "the other" architecture. (puts 32 bit config in on 64 bit device)
436// or at least that is the intention so that we get both of them populated
437prebuilt_etc {
438 name: "crash_dump.policy_other",
439 sub_dir: "seccomp_policy",
440 filename_from_src: true,
441 arch: {
442 arm: {
443 src: "seccomp_policy/crash_dump.arm64.policy",
444 },
445 arm64: {
446 src: "seccomp_policy/crash_dump.arm.policy",
447 },
448 x86: {
449 src: "seccomp_policy/crash_dump.x86_64.policy",
450 },
451 x86_64: {
452 src: "seccomp_policy/crash_dump.x86.policy",
453 },
454 },
455}