1cc_defaults { 2 name: "debuggerd_defaults", 3 cflags: [ 4 "-Wall", 5 "-Wextra", 6 "-Werror", 7 "-Wno-unused-argument", 8 "-Wno-unused-function", 9 "-Wno-nullability-completeness", 10 "-Os", 11 ], 12 13 local_include_dirs: ["include"], 14} 15 16cc_library_headers { 17 name: "libdebuggerd_common_headers", 18 export_include_dirs: ["common/include"], 19 recovery_available: true, 20} 21 22cc_library_shared { 23 name: "libtombstoned_client", 24 defaults: ["debuggerd_defaults"], 25 srcs: [ 26 "tombstoned/tombstoned_client.cpp", 27 "util.cpp", 28 ], 29 30 header_libs: ["libdebuggerd_common_headers"], 31 32 static_libs: [ 33 "libasync_safe", 34 ], 35 36 shared_libs: [ 37 "libbase", 38 "libcutils", 39 ], 40 41 export_header_lib_headers: ["libdebuggerd_common_headers"], 42 export_include_dirs: ["tombstoned/include"], 43} 44 45// Utility library to talk to tombstoned and get an output fd. 46cc_library_static { 47 name: "libtombstoned_client_static", 48 defaults: ["debuggerd_defaults"], 49 recovery_available: true, 50 srcs: [ 51 "tombstoned/tombstoned_client.cpp", 52 "util.cpp", 53 ], 54 55 header_libs: ["libdebuggerd_common_headers"], 56 57 whole_static_libs: [ 58 "libasync_safe", 59 "libcutils", 60 "libbase", 61 ], 62 63 export_header_lib_headers: ["libdebuggerd_common_headers"], 64 export_include_dirs: ["tombstoned/include"], 65} 66 67// Core implementation, linked into libdebuggerd_handler and the dynamic linker. 68cc_library_static { 69 name: "libdebuggerd_handler_core", 70 defaults: ["debuggerd_defaults"], 71 recovery_available: true, 72 srcs: ["handler/debuggerd_handler.cpp"], 73 74 header_libs: [ 75 "libbase_headers", 76 "libdebuggerd_common_headers", 77 "bionic_libc_platform_headers", 78 ], 79 80 whole_static_libs: [ 81 "libasync_safe", 82 "libcutils", 83 "libdebuggerd", 84 ], 85 86 export_header_lib_headers: ["libdebuggerd_common_headers"], 87 export_include_dirs: ["include"], 88} 89 90// Implementation with a no-op fallback. 91cc_library_static { 92 name: "libdebuggerd_handler", 93 defaults: ["debuggerd_defaults"], 94 srcs: ["handler/debuggerd_fallback_nop.cpp"], 95 96 header_libs: ["bionic_libc_platform_headers"], 97 export_header_lib_headers: ["bionic_libc_platform_headers"], 98 99 whole_static_libs: [ 100 "libdebuggerd_handler_core", 101 ], 102 103 export_include_dirs: ["include"], 104} 105 106// Fallback implementation, for use in the Bionic linker only. 107cc_library_static { 108 name: "libdebuggerd_handler_fallback", 109 visibility: ["//bionic/linker"], 110 apex_available: [ 111 "com.android.runtime", 112 "//apex_available:platform", 113 ], 114 defaults: ["debuggerd_defaults"], 115 recovery_available: true, 116 srcs: [ 117 "handler/debuggerd_fallback.cpp", 118 ], 119 120 whole_static_libs: [ 121 "libdebuggerd_handler_core", 122 "libtombstoned_client_static", 123 "libasync_safe", 124 "libbase", 125 "libdebuggerd", 126 "libunwindstack_no_dex", 127 "liblzma", 128 "libcutils", 129 ], 130 131 header_libs: ["bionic_libc_platform_headers"], 132 export_header_lib_headers: ["bionic_libc_platform_headers"], 133 134 export_include_dirs: ["include"], 135} 136 137cc_library { 138 name: "libdebuggerd_client", 139 defaults: ["debuggerd_defaults"], 140 srcs: [ 141 "client/debuggerd_client.cpp", 142 "util.cpp", 143 ], 144 145 shared_libs: [ 146 "libbase", 147 "libcutils", 148 "libprocinfo", 149 ], 150 151 header_libs: [ 152 "libdebuggerd_common_headers", 153 "bionic_libc_platform_headers", 154 ], 155 export_header_lib_headers: [ 156 "libdebuggerd_common_headers", 157 "bionic_libc_platform_headers", 158 ], 159 160 export_include_dirs: ["include"], 161} 162 163cc_library_static { 164 name: "libdebuggerd", 165 defaults: ["debuggerd_defaults"], 166 recovery_available: true, 167 168 srcs: [ 169 "libdebuggerd/backtrace.cpp", 170 "libdebuggerd/gwp_asan.cpp", 171 "libdebuggerd/open_files_list.cpp", 172 "libdebuggerd/scudo.cpp", 173 "libdebuggerd/tombstone.cpp", 174 "libdebuggerd/utility.cpp", 175 ], 176 177 local_include_dirs: ["libdebuggerd/include"], 178 export_include_dirs: ["libdebuggerd/include"], 179 180 include_dirs: [ 181 // Needed for private/bionic_fdsan.h 182 "bionic/libc", 183 184 // Needed for scudo/interface.h 185 "external/scudo/standalone/include", 186 ], 187 header_libs: [ 188 "bionic_libc_platform_headers", 189 "gwp_asan_headers", 190 ], 191 192 static_libs: [ 193 "libdexfile_support", // libunwindstack dependency 194 "libunwindstack", 195 "liblzma", 196 "libbase", 197 "libcutils", 198 "liblog", 199 ], 200 201 whole_static_libs: [ 202 "gwp_asan_crash_handler", 203 "libscudo", 204 ], 205 206 target: { 207 recovery: { 208 exclude_static_libs: [ 209 "libdexfile_support", 210 ], 211 }, 212 }, 213 214 product_variables: { 215 debuggable: { 216 cflags: ["-DROOT_POSSIBLE"], 217 }, 218 experimental_mte: { 219 cflags: ["-DANDROID_EXPERIMENTAL_MTE"], 220 }, 221 }, 222} 223 224cc_test { 225 name: "debuggerd_test", 226 defaults: ["debuggerd_defaults"], 227 require_root: true, 228 229 cflags: ["-Wno-missing-field-initializers"], 230 srcs: [ 231 "libdebuggerd/test/dump_memory_test.cpp", 232 "libdebuggerd/test/elf_fake.cpp", 233 "libdebuggerd/test/log_fake.cpp", 234 "libdebuggerd/test/open_files_list_test.cpp", 235 "libdebuggerd/test/tombstone_test.cpp", 236 ], 237 238 target: { 239 android: { 240 srcs: [ 241 "client/debuggerd_client_test.cpp", 242 "debuggerd_test.cpp", 243 ], 244 static_libs: [ 245 "libasync_safe", 246 "libtombstoned_client_static", 247 ], 248 }, 249 }, 250 251 shared_libs: [ 252 "libbase", 253 "libcutils", 254 "libdebuggerd_client", 255 "liblog", 256 "libnativehelper", 257 "libunwindstack", 258 ], 259 260 static_libs: [ 261 "libdebuggerd", 262 "libgmock", 263 "libminijail", 264 ], 265 266 header_libs: [ 267 "bionic_libc_platform_headers", 268 "gwp_asan_headers", 269 ], 270 271 include_dirs: [ 272 "external/scudo/standalone/include", 273 ], 274 275 local_include_dirs: [ 276 "libdebuggerd", 277 ], 278 279 compile_multilib: "both", 280 multilib: { 281 lib32: { 282 stem: "debuggerd_test32", 283 }, 284 lib64: { 285 stem: "debuggerd_test64", 286 }, 287 }, 288 289 test_suites: ["device-tests"], 290 291 product_variables: { 292 experimental_mte: { 293 cflags: ["-DANDROID_EXPERIMENTAL_MTE"], 294 }, 295 }, 296} 297 298cc_benchmark { 299 name: "debuggerd_benchmark", 300 defaults: ["debuggerd_defaults"], 301 srcs: ["debuggerd_benchmark.cpp"], 302 shared_libs: [ 303 "libbase", 304 "libdebuggerd_client", 305 ], 306} 307 308cc_binary { 309 name: "crash_dump", 310 srcs: [ 311 "crash_dump.cpp", 312 "util.cpp", 313 ], 314 defaults: ["debuggerd_defaults"], 315 316 compile_multilib: "both", 317 multilib: { 318 lib32: { 319 suffix: "32", 320 }, 321 lib64: { 322 suffix: "64", 323 }, 324 }, 325 326 header_libs: [ 327 "bionic_libc_platform_headers", 328 ], 329 330 static_libs: [ 331 "libtombstoned_client_static", 332 "libdebuggerd", 333 "libcutils", 334 ], 335 336 shared_libs: [ 337 "libbase", 338 "liblog", 339 "libprocinfo", 340 "libunwindstack", 341 ], 342 343 apex_available: [ 344 "com.android.runtime", 345 ], 346} 347 348cc_binary { 349 name: "debuggerd", 350 srcs: [ 351 "debuggerd.cpp", 352 ], 353 defaults: ["debuggerd_defaults"], 354 355 shared_libs: [ 356 "libbase", 357 "libdebuggerd_client", 358 "liblog", 359 "libprocinfo", 360 ], 361 362 local_include_dirs: ["include"], 363} 364 365cc_binary { 366 name: "tombstoned", 367 srcs: [ 368 "util.cpp", 369 "tombstoned/intercept_manager.cpp", 370 "tombstoned/tombstoned.cpp", 371 ], 372 defaults: ["debuggerd_defaults"], 373 374 header_libs: [ 375 "bionic_libc_platform_headers", 376 "libdebuggerd_common_headers" 377 ], 378 379 static_libs: [ 380 "libbase", 381 "libcutils", 382 "libevent", 383 "liblog", 384 ], 385 386 init_rc: ["tombstoned/tombstoned.rc"], 387} 388 389prebuilt_etc { 390 name: "crash_dump.policy", 391 sub_dir: "seccomp_policy", 392 filename_from_src: true, 393 arch: { 394 arm: { 395 src: "seccomp_policy/crash_dump.arm.policy", 396 }, 397 arm64: { 398 src: "seccomp_policy/crash_dump.arm64.policy", 399 }, 400 x86: { 401 src: "seccomp_policy/crash_dump.x86.policy", 402 }, 403 x86_64: { 404 src: "seccomp_policy/crash_dump.x86_64.policy", 405 }, 406 }, 407 required: [ 408 "crash_dump.policy_other", 409 ], 410} 411 412 413// NB -- this installs "the other" architecture. (puts 32 bit config in on 64 bit device) 414// or at least that is the intention so that we get both of them populated 415prebuilt_etc { 416 name: "crash_dump.policy_other", 417 sub_dir: "seccomp_policy", 418 filename_from_src: true, 419 arch: { 420 arm: { 421 src: "seccomp_policy/crash_dump.arm64.policy", 422 }, 423 arm64: { 424 src: "seccomp_policy/crash_dump.arm.policy", 425 }, 426 x86: { 427 src: "seccomp_policy/crash_dump.x86_64.policy", 428 }, 429 x86_64: { 430 src: "seccomp_policy/crash_dump.x86.policy", 431 }, 432 }, 433} 434