blob: 0e62ceb8f61b8bcc566bdf7e17f7777ef9aa869b [file] [log] [blame]
Bob Badourd69ad692021-02-16 19:02:14 -08001package {
Elliott Hughes813fd6d2021-06-25 14:42:51 -07002 default_applicable_licenses: ["Android-Apache-2.0"],
Bob Badourd69ad692021-02-16 19:02:14 -08003}
4
Josh Gaocbe70cb2016-10-18 18:17:52 -07005cc_defaults {
6 name: "debuggerd_defaults",
7 cflags: [
8 "-Wall",
9 "-Wextra",
Josh Gaoc7fe0602017-03-13 14:13:29 -070010 "-Werror",
Kalesh Singha9ea7e52021-06-17 15:49:50 -040011 "-Wno-gcc-compat",
Josh Gao2b2ae0c2017-08-21 14:31:17 -070012 "-Wno-unused-argument",
13 "-Wno-unused-function",
Josh Gaocbe70cb2016-10-18 18:17:52 -070014 "-Wno-nullability-completeness",
Christopher Ferrisf58b0092023-09-12 13:01:10 -070015 "-Wno-reorder-init-list",
Josh Gaocbe70cb2016-10-18 18:17:52 -070016 "-Os",
Yabin Cuie90a9442021-08-11 13:21:11 -070017 "-fno-finite-loops",
Alessandra Loro7bd6dca2022-09-01 10:33:35 +000018 "-DANDROID_DEBUGGABLE=0",
Josh Gaocbe70cb2016-10-18 18:17:52 -070019 ],
20
21 local_include_dirs: ["include"],
Alessandra Loro7bd6dca2022-09-01 10:33:35 +000022 product_variables: {
23 debuggable: {
Christopher Ferris2bf7db32024-02-26 13:29:20 -080024 cflags: [
25 "-UANDROID_DEBUGGABLE",
26 "-DANDROID_DEBUGGABLE=1",
27 ],
28 },
Alessandra Loro7bd6dca2022-09-01 10:33:35 +000029 },
Josh Gaocbe70cb2016-10-18 18:17:52 -070030}
31
Narayan Kamatha73df602017-05-24 15:07:25 +010032cc_library_headers {
33 name: "libdebuggerd_common_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080034 export_include_dirs: ["common/include"],
Jiyong Parka0e75042018-05-24 14:11:00 +090035 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -070036 vendor_ramdisk_available: true,
Shikha Panwar757f2992022-03-25 19:43:14 +000037 apex_available: [
Spandan Dase6bc0262024-01-02 22:39:00 +000038 "com.android.runtime",
Shikha Panwar757f2992022-03-25 19:43:14 +000039 "com.android.virt",
40 "//apex_available:platform",
Spandan Dase6bc0262024-01-02 22:39:00 +000041 ],
Narayan Kamatha73df602017-05-24 15:07:25 +010042}
43
Narayan Kamath2d377cd2017-05-10 10:58:59 +010044cc_library_shared {
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080045 name: "libtombstoned_client",
46 defaults: ["debuggerd_defaults"],
47 srcs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +010048 "tombstoned/tombstoned_client.cpp",
49 "util.cpp",
50 ],
51
Narayan Kamatha73df602017-05-24 15:07:25 +010052 header_libs: ["libdebuggerd_common_headers"],
53
Narayan Kamath2d377cd2017-05-10 10:58:59 +010054 static_libs: [
Narayan Kamatha73df602017-05-24 15:07:25 +010055 "libasync_safe",
Narayan Kamath2d377cd2017-05-10 10:58:59 +010056 ],
57
58 shared_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +010059 "libbase",
Narayan Kamatha73df602017-05-24 15:07:25 +010060 "libcutils",
Narayan Kamath2d377cd2017-05-10 10:58:59 +010061 ],
Shikha Panwar757f2992022-03-25 19:43:14 +000062 apex_available: [
63 "com.android.virt",
64 "//apex_available:platform",
65 ],
Narayan Kamath2d377cd2017-05-10 10:58:59 +010066
Narayan Kamatha73df602017-05-24 15:07:25 +010067 export_header_lib_headers: ["libdebuggerd_common_headers"],
Elliott Hughesdc699a22018-02-16 17:58:14 -080068 export_include_dirs: ["tombstoned/include"],
Narayan Kamath2d377cd2017-05-10 10:58:59 +010069}
70
Josh Gao9da1f512018-08-06 15:38:29 -070071// Utility library to talk to tombstoned and get an output fd.
Narayan Kamath2d377cd2017-05-10 10:58:59 +010072cc_library_static {
73 name: "libtombstoned_client_static",
74 defaults: ["debuggerd_defaults"],
Jiyong Park011ee122018-05-29 16:41:30 +090075 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -070076 vendor_ramdisk_available: true,
Narayan Kamath2d377cd2017-05-10 10:58:59 +010077 srcs: [
78 "tombstoned/tombstoned_client.cpp",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080079 "util.cpp",
80 ],
81
Narayan Kamatha73df602017-05-24 15:07:25 +010082 header_libs: ["libdebuggerd_common_headers"],
83
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080084 whole_static_libs: [
Christopher Ferrisac225782017-04-25 11:23:10 -070085 "libasync_safe",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080086 "libcutils",
87 "libbase",
88 ],
Narayan Kamath2d377cd2017-05-10 10:58:59 +010089
Narayan Kamatha73df602017-05-24 15:07:25 +010090 export_header_lib_headers: ["libdebuggerd_common_headers"],
Elliott Hughesdc699a22018-02-16 17:58:14 -080091 export_include_dirs: ["tombstoned/include"],
Spandan Das2e5cfbc2024-01-04 01:34:40 +000092 apex_available: ["com.android.runtime"],
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080093}
94
95// Core implementation, linked into libdebuggerd_handler and the dynamic linker.
Josh Gao9c02dc52016-06-15 17:29:00 -070096cc_library_static {
Josh Gaoe73c9322017-02-08 16:06:26 -080097 name: "libdebuggerd_handler_core",
Josh Gaocbe70cb2016-10-18 18:17:52 -070098 defaults: ["debuggerd_defaults"],
Jiyong Parka0e75042018-05-24 14:11:00 +090099 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -0700100 vendor_ramdisk_available: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700101 srcs: ["handler/debuggerd_handler.cpp"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700102
Josh Gaofdf832d2017-08-25 18:00:18 -0700103 header_libs: [
104 "libbase_headers",
105 "libdebuggerd_common_headers",
Josh Gaoa48b41b2019-12-13 14:11:04 -0800106 "bionic_libc_platform_headers",
Mitch Phillips18ce5422023-01-19 14:23:49 -0800107 "gwp_asan_headers",
Josh Gaofdf832d2017-08-25 18:00:18 -0700108 ],
Narayan Kamatha73df602017-05-24 15:07:25 +0100109
Josh Gaoe73c9322017-02-08 16:06:26 -0800110 whole_static_libs: [
Christopher Ferrisac225782017-04-25 11:23:10 -0700111 "libasync_safe",
Josh Gao2b2ae0c2017-08-21 14:31:17 -0700112 "libcutils",
Josh Gaoe73c9322017-02-08 16:06:26 -0800113 "libdebuggerd",
114 ],
115
Narayan Kamatha73df602017-05-24 15:07:25 +0100116 export_header_lib_headers: ["libdebuggerd_common_headers"],
Josh Gaoe73c9322017-02-08 16:06:26 -0800117 export_include_dirs: ["include"],
Spandan Dase6bc0262024-01-02 22:39:00 +0000118 apex_available: [
119 "com.android.runtime",
120 ],
Josh Gaoe73c9322017-02-08 16:06:26 -0800121}
122
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800123// Implementation with a no-op fallback.
Josh Gaoe73c9322017-02-08 16:06:26 -0800124cc_library_static {
125 name: "libdebuggerd_handler",
126 defaults: ["debuggerd_defaults"],
127 srcs: ["handler/debuggerd_fallback_nop.cpp"],
128
Josh Gaoa48b41b2019-12-13 14:11:04 -0800129 header_libs: ["bionic_libc_platform_headers"],
130 export_header_lib_headers: ["bionic_libc_platform_headers"],
131
Josh Gaoe73c9322017-02-08 16:06:26 -0800132 whole_static_libs: [
133 "libdebuggerd_handler_core",
134 ],
135
136 export_include_dirs: ["include"],
137}
138
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100139// Fallback implementation, for use in the Bionic linker only.
Josh Gaoe73c9322017-02-08 16:06:26 -0800140cc_library_static {
141 name: "libdebuggerd_handler_fallback",
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100142 visibility: ["//bionic/linker"],
143 apex_available: [
144 "com.android.runtime",
145 "//apex_available:platform",
146 ],
Josh Gaoe73c9322017-02-08 16:06:26 -0800147 defaults: ["debuggerd_defaults"],
Jiyong Park011ee122018-05-29 16:41:30 +0900148 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -0700149 vendor_ramdisk_available: true,
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800150 srcs: [
151 "handler/debuggerd_fallback.cpp",
152 ],
Josh Gaoe73c9322017-02-08 16:06:26 -0800153
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800154 whole_static_libs: [
155 "libdebuggerd_handler_core",
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100156 "libtombstoned_client_static",
Christopher Ferrisac225782017-04-25 11:23:10 -0700157 "libasync_safe",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800158 "libbase",
Josh Gaoe73c9322017-02-08 16:06:26 -0800159 "libdebuggerd",
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100160 "libunwindstack_no_dex",
Josh Gaoe73c9322017-02-08 16:06:26 -0800161 "liblzma",
162 "libcutils",
163 ],
Josh Gaoa48b41b2019-12-13 14:11:04 -0800164
165 header_libs: ["bionic_libc_platform_headers"],
166 export_header_lib_headers: ["bionic_libc_platform_headers"],
167
Josh Gaocbe70cb2016-10-18 18:17:52 -0700168 export_include_dirs: ["include"],
169}
170
171cc_library {
172 name: "libdebuggerd_client",
173 defaults: ["debuggerd_defaults"],
174 srcs: [
175 "client/debuggerd_client.cpp",
176 "util.cpp",
177 ],
178
179 shared_libs: [
180 "libbase",
181 "libcutils",
Josh Gao4175cee2019-01-04 13:57:09 -0800182 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700183 ],
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800184
Josh Gaoa48b41b2019-12-13 14:11:04 -0800185 header_libs: [
186 "libdebuggerd_common_headers",
187 "bionic_libc_platform_headers",
188 ],
189 export_header_lib_headers: [
190 "libdebuggerd_common_headers",
191 "bionic_libc_platform_headers",
192 ],
193
Josh Gaocbe70cb2016-10-18 18:17:52 -0700194 export_include_dirs: ["include"],
195}
196
Siim Sammulc08a34e2023-11-17 17:06:15 +0000197cc_library {
198 name: "libdebuggerd_tombstone_proto_to_text",
199 defaults: ["debuggerd_defaults"],
200 ramdisk_available: true,
201 recovery_available: true,
202 vendor_ramdisk_available: true,
Peter Collingbourne39a17302024-03-07 17:50:10 -0800203 host_supported: true,
Siim Sammulc08a34e2023-11-17 17:06:15 +0000204
205 local_include_dirs: ["libdebuggerd/include"],
206 export_include_dirs: ["libdebuggerd/include"],
207
208 srcs: [
209 "libdebuggerd/tombstone_proto_to_text.cpp",
Peter Collingbourne39a17302024-03-07 17:50:10 -0800210 "libdebuggerd/utility_host.cpp",
Siim Sammulc08a34e2023-11-17 17:06:15 +0000211 ],
212
213 static_libs: [
214 "libbase",
Siim Sammulc08a34e2023-11-17 17:06:15 +0000215 ],
216
217 whole_static_libs: [
218 "libtombstone_proto",
219 "libprotobuf-cpp-lite",
220 ],
221
Peter Collingbourne39a17302024-03-07 17:50:10 -0800222 shared_libs: [
223 "liblog",
224 ],
225
Siim Sammulc08a34e2023-11-17 17:06:15 +0000226 apex_available: [
227 "//apex_available:platform",
228 "com.android.runtime",
229 ],
230}
231
Josh Gaoe73c9322017-02-08 16:06:26 -0800232cc_library_static {
Josh Gaocbe70cb2016-10-18 18:17:52 -0700233 name: "libdebuggerd",
234 defaults: ["debuggerd_defaults"],
Christopher Ferris48d6e042023-07-31 14:24:01 -0700235 ramdisk_available: true,
Jiyong Parka0e75042018-05-24 14:11:00 +0900236 recovery_available: true,
Yifan Hong2ec92cf2020-10-27 16:25:45 -0700237 vendor_ramdisk_available: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700238
239 srcs: [
240 "libdebuggerd/backtrace.cpp",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800241 "libdebuggerd/gwp_asan.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700242 "libdebuggerd/open_files_list.cpp",
Christopher Ferris1c46a002024-04-23 17:24:26 -0700243 "libdebuggerd/scudo.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700244 "libdebuggerd/tombstone.cpp",
Josh Gao76e1e302021-01-26 15:53:11 -0800245 "libdebuggerd/tombstone_proto.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700246 "libdebuggerd/utility.cpp",
247 ],
248
Christopher Ferris1c46a002024-04-23 17:24:26 -0700249 cflags: [
250 "-DUSE_SCUDO",
251 ],
252
Josh Gaocbe70cb2016-10-18 18:17:52 -0700253 local_include_dirs: ["libdebuggerd/include"],
254 export_include_dirs: ["libdebuggerd/include"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700255
Peter Collingbournef8622522020-04-07 14:07:32 -0700256 include_dirs: [
257 // Needed for private/bionic_fdsan.h
258 "bionic/libc",
Peter Collingbournef8622522020-04-07 14:07:32 -0700259 ],
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800260 header_libs: [
261 "bionic_libc_platform_headers",
262 "gwp_asan_headers",
Jiyong Parkeb769d62022-08-19 13:21:02 +0900263 "liblog_headers",
Christopher Ferris1c46a002024-04-23 17:24:26 -0700264 "scudo_headers",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800265 ],
Josh Gaoce841d92018-08-06 18:26:42 -0700266
Josh Gaoe73c9322017-02-08 16:06:26 -0800267 static_libs: [
Christopher Ferris2bf7db32024-02-26 13:29:20 -0800268 "libdexfile_support", // libunwindstack dependency
Christopher Ferris9a8c8552017-08-11 15:29:19 -0700269 "libunwindstack",
Josh Gaoe73c9322017-02-08 16:06:26 -0800270 "liblzma",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700271 "libbase",
272 "libcutils",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700273 ],
Josh Gaoa48b41b2019-12-13 14:11:04 -0800274
Peter Collingbournef8622522020-04-07 14:07:32 -0700275 whole_static_libs: [
Siim Sammulc08a34e2023-11-17 17:06:15 +0000276 "libdebuggerd_tombstone_proto_to_text",
Josh Gao618cea32021-01-26 17:45:43 -0800277 "libasync_safe",
Peter Collingbournef8622522020-04-07 14:07:32 -0700278 "gwp_asan_crash_handler",
Josh Gao76e1e302021-01-26 15:53:11 -0800279 "libtombstone_proto",
Josh Gaodbb83de2021-03-01 23:13:13 -0800280 "libprocinfo",
Josh Gao76e1e302021-01-26 15:53:11 -0800281 "libprotobuf-cpp-lite",
Christopher Ferris1c46a002024-04-23 17:24:26 -0700282 "libscudo",
Peter Collingbournef8622522020-04-07 14:07:32 -0700283 ],
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800284
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000285 target: {
286 recovery: {
287 exclude_static_libs: [
Martin Stjernholma2cc8932019-10-23 21:32:43 +0100288 "libdexfile_support",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000289 ],
Martin Stjernholm3784b9d2021-08-26 21:18:43 +0100290 exclude_runtime_libs: [
291 "libdexfile",
292 ],
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000293 },
Yifan Hong2ec92cf2020-10-27 16:25:45 -0700294 vendor_ramdisk: {
295 exclude_static_libs: [
296 "libdexfile_support",
297 ],
Martin Stjernholm3784b9d2021-08-26 21:18:43 +0100298 exclude_runtime_libs: [
299 "libdexfile",
300 ],
Yifan Hong2ec92cf2020-10-27 16:25:45 -0700301 },
Christopher Ferris48d6e042023-07-31 14:24:01 -0700302 ramdisk: {
303 exclude_static_libs: [
304 "libdexfile_support",
305 ],
306 exclude_runtime_libs: [
307 "libdexfile",
308 ],
309 },
310 android: {
311 runtime_libs: [
Christopher Ferris2bf7db32024-02-26 13:29:20 -0800312 "libdexfile", // libdexfile_support dependency
Christopher Ferris48d6e042023-07-31 14:24:01 -0700313 ],
314 },
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000315 },
Christopher Ferris4ae266c2019-04-03 09:27:12 -0700316
317 product_variables: {
318 debuggable: {
319 cflags: ["-DROOT_POSSIBLE"],
320 },
Christopher Ferris7aad2562021-09-24 00:06:38 -0700321
Christopher Ferris1c46a002024-04-23 17:24:26 -0700322 malloc_low_memory: {
323 cflags: ["-UUSE_SCUDO"],
324 exclude_static_libs: ["libscudo"],
Christopher Ferris7aad2562021-09-24 00:06:38 -0700325 },
Christopher Ferris4ae266c2019-04-03 09:27:12 -0700326 },
Spandan Dase6bc0262024-01-02 22:39:00 +0000327 apex_available: [
328 "com.android.runtime",
329 ],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700330}
331
Josh Gao76e1e302021-01-26 15:53:11 -0800332cc_binary {
333 name: "pbtombstone",
Peter Collingbourne39a17302024-03-07 17:50:10 -0800334 host_supported: true,
Josh Gao76e1e302021-01-26 15:53:11 -0800335 defaults: ["debuggerd_defaults"],
Peter Collingbournecf9f0872024-03-07 17:56:14 -0800336 srcs: [
337 "pbtombstone.cpp",
338 "tombstone_symbolize.cpp",
339 ],
Josh Gao76e1e302021-01-26 15:53:11 -0800340 static_libs: [
341 "libbase",
Peter Collingbourne39a17302024-03-07 17:50:10 -0800342 "libdebuggerd_tombstone_proto_to_text",
Josh Gao76e1e302021-01-26 15:53:11 -0800343 "liblog",
344 "libprotobuf-cpp-lite",
345 "libtombstone_proto",
Josh Gao76e1e302021-01-26 15:53:11 -0800346 ],
347}
348
Christopher Ferrisfe751c52021-04-16 09:40:40 -0700349cc_test_library {
350 name: "libcrash_test",
351 defaults: ["debuggerd_defaults"],
352 srcs: ["crash_test.cpp"],
353}
354
Josh Gaocbe70cb2016-10-18 18:17:52 -0700355cc_test {
356 name: "debuggerd_test",
357 defaults: ["debuggerd_defaults"],
Josh Gao6cad1392019-08-27 16:02:38 -0700358 require_root: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700359
360 cflags: ["-Wno-missing-field-initializers"],
361 srcs: [
362 "libdebuggerd/test/dump_memory_test.cpp",
363 "libdebuggerd/test/elf_fake.cpp",
364 "libdebuggerd/test/log_fake.cpp",
Florian Mayere3e7bc72024-04-26 09:38:50 -0700365 "libdebuggerd/test/mte_stack_record_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700366 "libdebuggerd/test/open_files_list_test.cpp",
Siim Sammulc08a34e2023-11-17 17:06:15 +0000367 "libdebuggerd/test/tombstone_proto_to_text_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700368 ],
369
370 target: {
371 android: {
372 srcs: [
Josh Gaoae9d7672017-03-24 16:26:03 -0700373 "client/debuggerd_client_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700374 "debuggerd_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700375 ],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800376 static_libs: [
377 "libasync_safe",
378 "libtombstoned_client_static",
379 ],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700380 },
381 },
382
Florian Mayere6462f92024-02-28 11:12:11 -0800383 sanitize: {
384 memtag_heap: true,
Florian Mayere6462f92024-02-28 11:12:11 -0800385 },
386
Josh Gaocbe70cb2016-10-18 18:17:52 -0700387 shared_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700388 "libbase",
389 "libcutils",
Josh Gaoae9d7672017-03-24 16:26:03 -0700390 "libdebuggerd_client",
Narayan Kamatha73df602017-05-24 15:07:25 +0100391 "liblog",
Elliott Hughesdc699a22018-02-16 17:58:14 -0800392 "libnativehelper",
Martin Stjernholm852b64e2019-02-20 17:01:24 +0000393 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700394 ],
395
396 static_libs: [
Josh Gao352a8452017-03-30 16:46:21 -0700397 "libdebuggerd",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800398 "libgmock",
Peter Collingbourned00a5772020-07-20 23:11:16 -0700399 "libminijail",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700400 ],
401
Josh Gaoa48b41b2019-12-13 14:11:04 -0800402 header_libs: [
403 "bionic_libc_platform_headers",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800404 "gwp_asan_headers",
Josh Gaoa48b41b2019-12-13 14:11:04 -0800405 ],
406
Josh Gaocbe70cb2016-10-18 18:17:52 -0700407 local_include_dirs: [
408 "libdebuggerd",
409 ],
410
411 compile_multilib: "both",
412 multilib: {
413 lib32: {
414 stem: "debuggerd_test32",
415 },
416 lib64: {
417 stem: "debuggerd_test64",
418 },
419 },
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700420
Christopher Ferrisfe751c52021-04-16 09:40:40 -0700421 data: [
422 ":libcrash_test",
423 ],
424
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700425 test_suites: ["device-tests"],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700426}
427
Josh Gaoa42314e2017-12-19 15:08:19 -0800428cc_benchmark {
429 name: "debuggerd_benchmark",
430 defaults: ["debuggerd_defaults"],
431 srcs: ["debuggerd_benchmark.cpp"],
432 shared_libs: [
433 "libbase",
434 "libdebuggerd_client",
435 ],
436}
437
Josh Gaocbe70cb2016-10-18 18:17:52 -0700438cc_binary {
439 name: "crash_dump",
440 srcs: [
441 "crash_dump.cpp",
Shikha Panwarabde59e2023-02-03 15:05:18 +0000442 "tombstone_handler.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700443 "util.cpp",
444 ],
445 defaults: ["debuggerd_defaults"],
446
447 compile_multilib: "both",
448 multilib: {
449 lib32: {
450 suffix: "32",
451 },
452 lib64: {
453 suffix: "64",
454 },
455 },
456
Josh Gaoa48b41b2019-12-13 14:11:04 -0800457 header_libs: [
458 "bionic_libc_platform_headers",
Sijie Chencb53fe12024-05-10 18:40:48 +0000459 "libnative_bridge_support_accessor_headers",
Josh Gaoa48b41b2019-12-13 14:11:04 -0800460 ],
461
Josh Gaoe73c9322017-02-08 16:06:26 -0800462 static_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100463 "libtombstoned_client_static",
Josh Gaoe73c9322017-02-08 16:06:26 -0800464 "libdebuggerd",
465 "libcutils",
Josh Gao76e1e302021-01-26 15:53:11 -0800466
467 "libtombstone_proto",
468 "libprotobuf-cpp-lite",
Sijie Chencb53fe12024-05-10 18:40:48 +0000469
470 "libnative_bridge_guest_state_accessor",
Josh Gaoe73c9322017-02-08 16:06:26 -0800471 ],
472
Josh Gaocbe70cb2016-10-18 18:17:52 -0700473 shared_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700474 "libbase",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700475 "liblog",
476 "libprocinfo",
Josh Gao2b2ae0c2017-08-21 14:31:17 -0700477 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700478 ],
Peter Collingbourneb72e7482020-03-16 18:14:13 -0700479
480 apex_available: [
481 "com.android.runtime",
482 ],
Peter Collingbournea2739da2022-02-02 17:00:42 -0800483
484 // Required for tests.
485 required: ["crash_dump.policy"],
Sijie Chencb53fe12024-05-10 18:40:48 +0000486
487 target: {
488 android: {
489 header_libs: [
490 "libnative_bridge_support_accessor_headers", // For dlext_namespaces.h
491 ],
492 shared_libs: ["libdl_android"], // For android_get_exported_namespace implementation
493 },
494 },
Josh Gaocbe70cb2016-10-18 18:17:52 -0700495}
496
497cc_binary {
498 name: "debuggerd",
499 srcs: [
500 "debuggerd.cpp",
501 ],
502 defaults: ["debuggerd_defaults"],
503
504 shared_libs: [
505 "libbase",
506 "libdebuggerd_client",
507 "liblog",
T.J. Mercierfdd861e2024-12-06 17:52:29 +0000508 "libprocessgroup",
Josh Gao0915f232017-06-27 14:08:05 -0700509 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700510 ],
511
512 local_include_dirs: ["include"],
513}
514
Nikita Ioffe75be7842022-10-24 15:31:11 +0100515cc_defaults {
516 name: "tombstoned_defaults",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700517 srcs: [
518 "util.cpp",
519 "tombstoned/intercept_manager.cpp",
520 "tombstoned/tombstoned.cpp",
521 ],
522 defaults: ["debuggerd_defaults"],
523
Josh Gaoa48b41b2019-12-13 14:11:04 -0800524 header_libs: [
525 "bionic_libc_platform_headers",
Christopher Ferris2bf7db32024-02-26 13:29:20 -0800526 "libdebuggerd_common_headers",
Josh Gaoa48b41b2019-12-13 14:11:04 -0800527 ],
Narayan Kamatha73df602017-05-24 15:07:25 +0100528
Josh Gaocbe70cb2016-10-18 18:17:52 -0700529 static_libs: [
530 "libbase",
531 "libcutils",
532 "libevent",
533 "liblog",
534 ],
Nikita Ioffe75be7842022-10-24 15:31:11 +0100535}
Josh Gaocbe70cb2016-10-18 18:17:52 -0700536
Nikita Ioffe75be7842022-10-24 15:31:11 +0100537cc_binary {
538 name: "tombstoned",
539 defaults: ["tombstoned_defaults"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800540 init_rc: ["tombstoned/tombstoned.rc"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700541}
Ray Essickbd3ba782020-01-21 15:21:08 -0800542
Nikita Ioffe75be7842022-10-24 15:31:11 +0100543cc_binary {
544 name: "tombstoned.microdroid",
545 defaults: ["tombstoned_defaults"],
546 init_rc: ["tombstoned/tombstoned.microdroid.rc"],
547}
548
Ray Essickbd3ba782020-01-21 15:21:08 -0800549prebuilt_etc {
550 name: "crash_dump.policy",
551 sub_dir: "seccomp_policy",
552 filename_from_src: true,
553 arch: {
554 arm: {
555 src: "seccomp_policy/crash_dump.arm.policy",
Elliott Hughes2f883312022-11-14 20:02:28 +0000556 required: [
557 "crash_dump.policy_other",
558 ],
Ray Essickbd3ba782020-01-21 15:21:08 -0800559 },
560 arm64: {
561 src: "seccomp_policy/crash_dump.arm64.policy",
Elliott Hughes2f883312022-11-14 20:02:28 +0000562 required: [
563 "crash_dump.policy_other",
564 ],
Ray Essickbd3ba782020-01-21 15:21:08 -0800565 },
Chen Guoyina22af662022-10-12 22:32:55 +0800566 riscv64: {
567 src: "seccomp_policy/crash_dump.riscv64.policy",
568 },
Ray Essickbd3ba782020-01-21 15:21:08 -0800569 x86: {
570 src: "seccomp_policy/crash_dump.x86.policy",
Elliott Hughes2f883312022-11-14 20:02:28 +0000571 required: [
572 "crash_dump.policy_other",
573 ],
Ray Essickbd3ba782020-01-21 15:21:08 -0800574 },
575 x86_64: {
576 src: "seccomp_policy/crash_dump.x86_64.policy",
Elliott Hughes2f883312022-11-14 20:02:28 +0000577 required: [
578 "crash_dump.policy_other",
579 ],
Ray Essickbd3ba782020-01-21 15:21:08 -0800580 },
581 },
Ray Essickbd3ba782020-01-21 15:21:08 -0800582}
583
Elliott Hughes2f883312022-11-14 20:02:28 +0000584// This installs the "other" architecture (so 32-bit on 64-bit device).
Ray Essickbd3ba782020-01-21 15:21:08 -0800585prebuilt_etc {
586 name: "crash_dump.policy_other",
587 sub_dir: "seccomp_policy",
588 filename_from_src: true,
589 arch: {
590 arm: {
591 src: "seccomp_policy/crash_dump.arm64.policy",
592 },
593 arm64: {
594 src: "seccomp_policy/crash_dump.arm.policy",
595 },
Elliott Hughes857e29c2023-03-20 15:48:30 -0700596 riscv64: {
597 enabled: false,
598 },
Ray Essickbd3ba782020-01-21 15:21:08 -0800599 x86: {
600 src: "seccomp_policy/crash_dump.x86_64.policy",
601 },
602 x86_64: {
603 src: "seccomp_policy/crash_dump.x86.policy",
604 },
605 },
606}