1package { 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 29cc_defaults { 30 name: "debuggerd_defaults", 31 cflags: [ 32 "-Wall", 33 "-Wextra", 34 "-Werror", 35 "-Wno-unused-argument", 36 "-Wno-unused-function", 37 "-Wno-nullability-completeness", 38 "-Os", 39 ], 40 41 local_include_dirs: ["include"], 42} 43 44cc_library_headers { 45 name: "libdebuggerd_common_headers", 46 export_include_dirs: ["common/include"], 47 recovery_available: true, 48 vendor_ramdisk_available: true, 49} 50 51cc_library_shared { 52 name: "libtombstoned_client", 53 defaults: ["debuggerd_defaults"], 54 srcs: [ 55 "tombstoned/tombstoned_client.cpp", 56 "util.cpp", 57 ], 58 59 header_libs: ["libdebuggerd_common_headers"], 60 61 static_libs: [ 62 "libasync_safe", 63 ], 64 65 shared_libs: [ 66 "libbase", 67 "libcutils", 68 ], 69 70 export_header_lib_headers: ["libdebuggerd_common_headers"], 71 export_include_dirs: ["tombstoned/include"], 72} 73 74// Utility library to talk to tombstoned and get an output fd. 75cc_library_static { 76 name: "libtombstoned_client_static", 77 defaults: ["debuggerd_defaults"], 78 recovery_available: true, 79 vendor_ramdisk_available: true, 80 srcs: [ 81 "tombstoned/tombstoned_client.cpp", 82 "util.cpp", 83 ], 84 85 header_libs: ["libdebuggerd_common_headers"], 86 87 whole_static_libs: [ 88 "libasync_safe", 89 "libcutils", 90 "libbase", 91 ], 92 93 export_header_lib_headers: ["libdebuggerd_common_headers"], 94 export_include_dirs: ["tombstoned/include"], 95} 96 97// Core implementation, linked into libdebuggerd_handler and the dynamic linker. 98cc_library_static { 99 name: "libdebuggerd_handler_core", 100 defaults: ["debuggerd_defaults"], 101 recovery_available: true, 102 vendor_ramdisk_available: true, 103 srcs: ["handler/debuggerd_handler.cpp"], 104 105 header_libs: [ 106 "libbase_headers", 107 "libdebuggerd_common_headers", 108 "bionic_libc_platform_headers", 109 ], 110 111 whole_static_libs: [ 112 "libasync_safe", 113 "libcutils", 114 "libdebuggerd", 115 ], 116 117 export_header_lib_headers: ["libdebuggerd_common_headers"], 118 export_include_dirs: ["include"], 119} 120 121// Implementation with a no-op fallback. 122cc_library_static { 123 name: "libdebuggerd_handler", 124 defaults: ["debuggerd_defaults"], 125 srcs: ["handler/debuggerd_fallback_nop.cpp"], 126 127 header_libs: ["bionic_libc_platform_headers"], 128 export_header_lib_headers: ["bionic_libc_platform_headers"], 129 130 whole_static_libs: [ 131 "libdebuggerd_handler_core", 132 ], 133 134 export_include_dirs: ["include"], 135} 136 137// Fallback implementation, for use in the Bionic linker only. 138cc_library_static { 139 name: "libdebuggerd_handler_fallback", 140 visibility: ["//bionic/linker"], 141 apex_available: [ 142 "com.android.runtime", 143 "//apex_available:platform", 144 ], 145 defaults: ["debuggerd_defaults"], 146 recovery_available: true, 147 vendor_ramdisk_available: true, 148 srcs: [ 149 "handler/debuggerd_fallback.cpp", 150 ], 151 152 whole_static_libs: [ 153 "libdebuggerd_handler_core", 154 "libtombstoned_client_static", 155 "libasync_safe", 156 "libbase", 157 "libdebuggerd", 158 "libunwindstack_no_dex", 159 "liblzma", 160 "libcutils", 161 ], 162 163 header_libs: ["bionic_libc_platform_headers"], 164 export_header_lib_headers: ["bionic_libc_platform_headers"], 165 166 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", 180 "libprocinfo", 181 ], 182 183 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 192 export_include_dirs: ["include"], 193} 194 195cc_library_static { 196 name: "libdebuggerd", 197 defaults: ["debuggerd_defaults"], 198 recovery_available: true, 199 vendor_ramdisk_available: true, 200 201 srcs: [ 202 "libdebuggerd/backtrace.cpp", 203 "libdebuggerd/gwp_asan.cpp", 204 "libdebuggerd/open_files_list.cpp", 205 "libdebuggerd/scudo.cpp", 206 "libdebuggerd/tombstone.cpp", 207 "libdebuggerd/tombstone_proto.cpp", 208 "libdebuggerd/tombstone_proto_to_text.cpp", 209 "libdebuggerd/utility.cpp", 210 ], 211 212 local_include_dirs: ["libdebuggerd/include"], 213 export_include_dirs: ["libdebuggerd/include"], 214 215 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 ], 222 header_libs: [ 223 "bionic_libc_platform_headers", 224 "gwp_asan_headers", 225 ], 226 227 static_libs: [ 228 "libdexfile_support", // libunwindstack dependency 229 "libunwindstack", 230 "liblzma", 231 "libbase", 232 "libcutils", 233 "liblog", 234 ], 235 236 whole_static_libs: [ 237 "libasync_safe", 238 "gwp_asan_crash_handler", 239 "libscudo", 240 "libtombstone_proto", 241 "libprocinfo", 242 "libprotobuf-cpp-lite", 243 ], 244 245 target: { 246 recovery: { 247 exclude_static_libs: [ 248 "libdexfile_support", 249 ], 250 }, 251 vendor_ramdisk: { 252 exclude_static_libs: [ 253 "libdexfile_support", 254 ], 255 }, 256 }, 257 258 product_variables: { 259 debuggable: { 260 cflags: ["-DROOT_POSSIBLE"], 261 }, 262 }, 263} 264 265cc_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 279cc_test_library { 280 name: "libcrash_test", 281 defaults: ["debuggerd_defaults"], 282 srcs: ["crash_test.cpp"], 283} 284 285cc_test { 286 name: "debuggerd_test", 287 defaults: ["debuggerd_defaults"], 288 require_root: true, 289 290 cflags: ["-Wno-missing-field-initializers"], 291 srcs: [ 292 "libdebuggerd/test/dump_memory_test.cpp", 293 "libdebuggerd/test/elf_fake.cpp", 294 "libdebuggerd/test/log_fake.cpp", 295 "libdebuggerd/test/open_files_list_test.cpp", 296 "libdebuggerd/test/tombstone_test.cpp", 297 ], 298 299 target: { 300 android: { 301 srcs: [ 302 "client/debuggerd_client_test.cpp", 303 "debuggerd_test.cpp", 304 ], 305 static_libs: [ 306 "libasync_safe", 307 "libtombstoned_client_static", 308 ], 309 }, 310 }, 311 312 shared_libs: [ 313 "libbase", 314 "libcutils", 315 "libdebuggerd_client", 316 "liblog", 317 "libnativehelper", 318 "libunwindstack", 319 ], 320 321 static_libs: [ 322 "libdebuggerd", 323 "libgmock", 324 "libminijail", 325 ], 326 327 header_libs: [ 328 "bionic_libc_platform_headers", 329 "gwp_asan_headers", 330 ], 331 332 include_dirs: [ 333 "external/scudo/standalone/include", 334 ], 335 336 local_include_dirs: [ 337 "libdebuggerd", 338 ], 339 340 compile_multilib: "both", 341 multilib: { 342 lib32: { 343 stem: "debuggerd_test32", 344 }, 345 lib64: { 346 stem: "debuggerd_test64", 347 }, 348 }, 349 350 data: [ 351 ":libcrash_test", 352 ], 353 354 test_suites: ["device-tests"], 355} 356 357cc_benchmark { 358 name: "debuggerd_benchmark", 359 defaults: ["debuggerd_defaults"], 360 srcs: ["debuggerd_benchmark.cpp"], 361 shared_libs: [ 362 "libbase", 363 "libdebuggerd_client", 364 ], 365} 366 367cc_binary { 368 name: "crash_dump", 369 srcs: [ 370 "crash_dump.cpp", 371 "util.cpp", 372 ], 373 defaults: ["debuggerd_defaults"], 374 375 compile_multilib: "both", 376 multilib: { 377 lib32: { 378 suffix: "32", 379 }, 380 lib64: { 381 suffix: "64", 382 }, 383 }, 384 385 header_libs: [ 386 "bionic_libc_platform_headers", 387 ], 388 389 static_libs: [ 390 "libtombstoned_client_static", 391 "libdebuggerd", 392 "libcutils", 393 394 "libtombstone_proto", 395 "libprotobuf-cpp-lite", 396 ], 397 398 shared_libs: [ 399 "libbase", 400 "liblog", 401 "libprocinfo", 402 "libunwindstack", 403 ], 404 405 apex_available: [ 406 "com.android.runtime", 407 ], 408} 409 410cc_binary { 411 name: "debuggerd", 412 srcs: [ 413 "debuggerd.cpp", 414 ], 415 defaults: ["debuggerd_defaults"], 416 417 shared_libs: [ 418 "libbase", 419 "libdebuggerd_client", 420 "liblog", 421 "libprocinfo", 422 ], 423 424 local_include_dirs: ["include"], 425} 426 427cc_binary { 428 name: "tombstoned", 429 srcs: [ 430 "util.cpp", 431 "tombstoned/intercept_manager.cpp", 432 "tombstoned/tombstoned.cpp", 433 ], 434 defaults: ["debuggerd_defaults"], 435 436 header_libs: [ 437 "bionic_libc_platform_headers", 438 "libdebuggerd_common_headers" 439 ], 440 441 static_libs: [ 442 "libbase", 443 "libcutils", 444 "libevent", 445 "liblog", 446 ], 447 448 init_rc: ["tombstoned/tombstoned.rc"], 449} 450 451prebuilt_etc { 452 name: "crash_dump.policy", 453 sub_dir: "seccomp_policy", 454 filename_from_src: true, 455 arch: { 456 arm: { 457 src: "seccomp_policy/crash_dump.arm.policy", 458 }, 459 arm64: { 460 src: "seccomp_policy/crash_dump.arm64.policy", 461 }, 462 x86: { 463 src: "seccomp_policy/crash_dump.x86.policy", 464 }, 465 x86_64: { 466 src: "seccomp_policy/crash_dump.x86_64.policy", 467 }, 468 }, 469 required: [ 470 "crash_dump.policy_other", 471 ], 472} 473 474 475// NB -- this installs "the other" architecture. (puts 32 bit config in on 64 bit device) 476// or at least that is the intention so that we get both of them populated 477prebuilt_etc { 478 name: "crash_dump.policy_other", 479 sub_dir: "seccomp_policy", 480 filename_from_src: true, 481 arch: { 482 arm: { 483 src: "seccomp_policy/crash_dump.arm64.policy", 484 }, 485 arm64: { 486 src: "seccomp_policy/crash_dump.arm.policy", 487 }, 488 x86: { 489 src: "seccomp_policy/crash_dump.x86_64.policy", 490 }, 491 x86_64: { 492 src: "seccomp_policy/crash_dump.x86.policy", 493 }, 494 }, 495} 496