blob: 3246dcccd74fc38fca13eb61895616b57dc034ec [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
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800106// Fallback implementation.
Josh Gaoe73c9322017-02-08 16:06:26 -0800107cc_library_static {
108 name: "libdebuggerd_handler_fallback",
109 defaults: ["debuggerd_defaults"],
Jiyong Park011ee122018-05-29 16:41:30 +0900110 recovery_available: true,
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800111 srcs: [
112 "handler/debuggerd_fallback.cpp",
113 ],
Josh Gaoe73c9322017-02-08 16:06:26 -0800114
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800115 whole_static_libs: [
116 "libdebuggerd_handler_core",
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100117 "libtombstoned_client_static",
Christopher Ferrisac225782017-04-25 11:23:10 -0700118 "libasync_safe",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800119 "libbase",
Josh Gaoe73c9322017-02-08 16:06:26 -0800120 "libdebuggerd",
Christopher Ferris9a8c8552017-08-11 15:29:19 -0700121 "libunwindstack",
Martin Stjernholme31cfb62019-02-05 04:59:07 +0000122 "libdexfile_support_static", // libunwindstack dependency
Josh Gaoe73c9322017-02-08 16:06:26 -0800123 "liblzma",
124 "libcutils",
125 ],
Josh Gaoa48b41b2019-12-13 14:11:04 -0800126
127 header_libs: ["bionic_libc_platform_headers"],
128 export_header_lib_headers: ["bionic_libc_platform_headers"],
129
Jiyong Park011ee122018-05-29 16:41:30 +0900130 target: {
131 recovery: {
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000132 exclude_static_libs: [
Martin Stjernholme31cfb62019-02-05 04:59:07 +0000133 "libdexfile_support_static",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000134 ],
Jiyong Park011ee122018-05-29 16:41:30 +0900135 },
136 },
Josh Gao9c02dc52016-06-15 17:29:00 -0700137
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,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700171
172 srcs: [
173 "libdebuggerd/backtrace.cpp",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800174 "libdebuggerd/gwp_asan.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700175 "libdebuggerd/open_files_list.cpp",
176 "libdebuggerd/tombstone.cpp",
177 "libdebuggerd/utility.cpp",
178 ],
179
Josh Gaocbe70cb2016-10-18 18:17:52 -0700180 local_include_dirs: ["libdebuggerd/include"],
181 export_include_dirs: ["libdebuggerd/include"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700182
Josh Gaoce841d92018-08-06 18:26:42 -0700183 // Needed for private/bionic_fdsan.h
184 include_dirs: ["bionic/libc"],
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800185 header_libs: [
186 "bionic_libc_platform_headers",
187 "gwp_asan_headers",
188 ],
Josh Gaoce841d92018-08-06 18:26:42 -0700189
Josh Gaoe73c9322017-02-08 16:06:26 -0800190 static_libs: [
Martin Stjernholme31cfb62019-02-05 04:59:07 +0000191 "libdexfile_support_static", // libunwindstack dependency
Christopher Ferris9a8c8552017-08-11 15:29:19 -0700192 "libunwindstack",
Josh Gaoe73c9322017-02-08 16:06:26 -0800193 "liblzma",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700194 "libbase",
195 "libcutils",
196 "liblog",
197 ],
Josh Gaoa48b41b2019-12-13 14:11:04 -0800198
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800199 whole_static_libs: ["gwp_asan_crash_handler"],
200
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000201 target: {
202 recovery: {
203 exclude_static_libs: [
Martin Stjernholme31cfb62019-02-05 04:59:07 +0000204 "libdexfile_support_static",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000205 ],
206 },
207 },
Christopher Ferris4ae266c2019-04-03 09:27:12 -0700208
209 product_variables: {
210 debuggable: {
211 cflags: ["-DROOT_POSSIBLE"],
212 },
213 },
Josh Gaocbe70cb2016-10-18 18:17:52 -0700214}
215
216cc_test {
217 name: "debuggerd_test",
218 defaults: ["debuggerd_defaults"],
Josh Gao6cad1392019-08-27 16:02:38 -0700219 require_root: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700220
221 cflags: ["-Wno-missing-field-initializers"],
222 srcs: [
223 "libdebuggerd/test/dump_memory_test.cpp",
224 "libdebuggerd/test/elf_fake.cpp",
225 "libdebuggerd/test/log_fake.cpp",
226 "libdebuggerd/test/open_files_list_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700227 "libdebuggerd/test/tombstone_test.cpp",
228 ],
229
230 target: {
231 android: {
232 srcs: [
Josh Gaoae9d7672017-03-24 16:26:03 -0700233 "client/debuggerd_client_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700234 "debuggerd_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700235 ],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800236 static_libs: [
237 "libasync_safe",
238 "libtombstoned_client_static",
239 ],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700240 },
241 },
242
243 shared_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700244 "libbase",
245 "libcutils",
Josh Gaoae9d7672017-03-24 16:26:03 -0700246 "libdebuggerd_client",
Narayan Kamatha73df602017-05-24 15:07:25 +0100247 "liblog",
Josh Gaoe04ca272018-01-16 15:38:17 -0800248 "libminijail",
Elliott Hughesdc699a22018-02-16 17:58:14 -0800249 "libnativehelper",
Martin Stjernholm852b64e2019-02-20 17:01:24 +0000250 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700251 ],
252
253 static_libs: [
Josh Gao352a8452017-03-30 16:46:21 -0700254 "libdebuggerd",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800255 "libgmock",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700256 ],
257
Josh Gaoa48b41b2019-12-13 14:11:04 -0800258 header_libs: [
259 "bionic_libc_platform_headers",
Mitch Phillipse0b4bb12020-02-14 14:54:31 -0800260 "gwp_asan_headers",
Josh Gaoa48b41b2019-12-13 14:11:04 -0800261 ],
262
Josh Gaocbe70cb2016-10-18 18:17:52 -0700263 local_include_dirs: [
264 "libdebuggerd",
265 ],
266
267 compile_multilib: "both",
268 multilib: {
269 lib32: {
270 stem: "debuggerd_test32",
271 },
272 lib64: {
273 stem: "debuggerd_test64",
274 },
275 },
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700276
277 test_suites: ["device-tests"],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700278}
279
Josh Gaoa42314e2017-12-19 15:08:19 -0800280cc_benchmark {
281 name: "debuggerd_benchmark",
282 defaults: ["debuggerd_defaults"],
283 srcs: ["debuggerd_benchmark.cpp"],
284 shared_libs: [
285 "libbase",
286 "libdebuggerd_client",
287 ],
288}
289
Josh Gaocbe70cb2016-10-18 18:17:52 -0700290cc_binary {
291 name: "crash_dump",
292 srcs: [
293 "crash_dump.cpp",
294 "util.cpp",
295 ],
296 defaults: ["debuggerd_defaults"],
297
298 compile_multilib: "both",
299 multilib: {
300 lib32: {
301 suffix: "32",
302 },
303 lib64: {
304 suffix: "64",
305 },
306 },
307
Josh Gaoa48b41b2019-12-13 14:11:04 -0800308 header_libs: [
309 "bionic_libc_platform_headers",
310 ],
311
Josh Gaoe73c9322017-02-08 16:06:26 -0800312 static_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100313 "libtombstoned_client_static",
Josh Gaoe73c9322017-02-08 16:06:26 -0800314 "libdebuggerd",
315 "libcutils",
316 ],
317
Josh Gaocbe70cb2016-10-18 18:17:52 -0700318 shared_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700319 "libbase",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700320 "liblog",
321 "libprocinfo",
Josh Gao2b2ae0c2017-08-21 14:31:17 -0700322 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700323 ],
Peter Collingbourneb72e7482020-03-16 18:14:13 -0700324
325 apex_available: [
326 "com.android.runtime",
327 ],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700328}
329
330cc_binary {
331 name: "debuggerd",
332 srcs: [
333 "debuggerd.cpp",
334 ],
335 defaults: ["debuggerd_defaults"],
336
337 shared_libs: [
338 "libbase",
339 "libdebuggerd_client",
340 "liblog",
Josh Gao0915f232017-06-27 14:08:05 -0700341 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700342 ],
343
344 local_include_dirs: ["include"],
345}
346
347cc_binary {
348 name: "tombstoned",
349 srcs: [
350 "util.cpp",
351 "tombstoned/intercept_manager.cpp",
352 "tombstoned/tombstoned.cpp",
353 ],
354 defaults: ["debuggerd_defaults"],
355
Josh Gaoa48b41b2019-12-13 14:11:04 -0800356 header_libs: [
357 "bionic_libc_platform_headers",
358 "libdebuggerd_common_headers"
359 ],
Narayan Kamatha73df602017-05-24 15:07:25 +0100360
Josh Gaocbe70cb2016-10-18 18:17:52 -0700361 static_libs: [
362 "libbase",
363 "libcutils",
364 "libevent",
365 "liblog",
366 ],
367
Elliott Hughesdc699a22018-02-16 17:58:14 -0800368 init_rc: ["tombstoned/tombstoned.rc"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700369}
Ray Essickbd3ba782020-01-21 15:21:08 -0800370
371prebuilt_etc {
372 name: "crash_dump.policy",
373 sub_dir: "seccomp_policy",
374 filename_from_src: true,
375 arch: {
376 arm: {
377 src: "seccomp_policy/crash_dump.arm.policy",
378 },
379 arm64: {
380 src: "seccomp_policy/crash_dump.arm64.policy",
381 },
382 x86: {
383 src: "seccomp_policy/crash_dump.x86.policy",
384 },
385 x86_64: {
386 src: "seccomp_policy/crash_dump.x86_64.policy",
387 },
388 },
389 required: [
390 "crash_dump.policy_other",
391 ],
392}
393
394
395// NB -- this installs "the other" architecture. (puts 32 bit config in on 64 bit device)
396// or at least that is the intention so that we get both of them populated
397prebuilt_etc {
398 name: "crash_dump.policy_other",
399 sub_dir: "seccomp_policy",
400 filename_from_src: true,
401 arch: {
402 arm: {
403 src: "seccomp_policy/crash_dump.arm64.policy",
404 },
405 arm64: {
406 src: "seccomp_policy/crash_dump.arm.policy",
407 },
408 x86: {
409 src: "seccomp_policy/crash_dump.x86_64.policy",
410 },
411 x86_64: {
412 src: "seccomp_policy/crash_dump.x86.policy",
413 },
414 },
415}