1 cc_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 16 cc_library_headers { 17 name: "libdebuggerd_common_headers", 18 export_include_dirs: ["common/include"], 19 recovery_available: true, 20 } 21 22 cc_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. 46 cc_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. 68 cc_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. 91 cc_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. 107 cc_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 137 cc_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 163 cc_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/tombstone.cpp", 173 "libdebuggerd/utility.cpp", 174 ], 175 176 local_include_dirs: ["libdebuggerd/include"], 177 export_include_dirs: ["libdebuggerd/include"], 178 179 // Needed for private/bionic_fdsan.h 180 include_dirs: ["bionic/libc"], 181 header_libs: [ 182 "bionic_libc_platform_headers", 183 "gwp_asan_headers", 184 ], 185 186 static_libs: [ 187 "libdexfile_support", // libunwindstack dependency 188 "libunwindstack", 189 "liblzma", 190 "libbase", 191 "libcutils", 192 "liblog", 193 ], 194 195 whole_static_libs: ["gwp_asan_crash_handler"], 196 197 target: { 198 recovery: { 199 exclude_static_libs: [ 200 "libdexfile_support", 201 ], 202 }, 203 }, 204 205 product_variables: { 206 debuggable: { 207 cflags: ["-DROOT_POSSIBLE"], 208 }, 209 }, 210 } 211 212 cc_test { 213 name: "debuggerd_test", 214 defaults: ["debuggerd_defaults"], 215 require_root: true, 216 217 cflags: ["-Wno-missing-field-initializers"], 218 srcs: [ 219 "libdebuggerd/test/dump_memory_test.cpp", 220 "libdebuggerd/test/elf_fake.cpp", 221 "libdebuggerd/test/log_fake.cpp", 222 "libdebuggerd/test/open_files_list_test.cpp", 223 "libdebuggerd/test/tombstone_test.cpp", 224 ], 225 226 target: { 227 android: { 228 srcs: [ 229 "client/debuggerd_client_test.cpp", 230 "debuggerd_test.cpp", 231 ], 232 static_libs: [ 233 "libasync_safe", 234 "libtombstoned_client_static", 235 ], 236 }, 237 }, 238 239 shared_libs: [ 240 "libbase", 241 "libcutils", 242 "libdebuggerd_client", 243 "liblog", 244 "libminijail", 245 "libnativehelper", 246 "libunwindstack", 247 ], 248 249 static_libs: [ 250 "libdebuggerd", 251 "libgmock", 252 ], 253 254 header_libs: [ 255 "bionic_libc_platform_headers", 256 "gwp_asan_headers", 257 ], 258 259 local_include_dirs: [ 260 "libdebuggerd", 261 ], 262 263 compile_multilib: "both", 264 multilib: { 265 lib32: { 266 stem: "debuggerd_test32", 267 }, 268 lib64: { 269 stem: "debuggerd_test64", 270 }, 271 }, 272 273 test_suites: ["device-tests"], 274 } 275 276 cc_benchmark { 277 name: "debuggerd_benchmark", 278 defaults: ["debuggerd_defaults"], 279 srcs: ["debuggerd_benchmark.cpp"], 280 shared_libs: [ 281 "libbase", 282 "libdebuggerd_client", 283 ], 284 } 285 286 cc_binary { 287 name: "crash_dump", 288 srcs: [ 289 "crash_dump.cpp", 290 "util.cpp", 291 ], 292 defaults: ["debuggerd_defaults"], 293 294 compile_multilib: "both", 295 multilib: { 296 lib32: { 297 suffix: "32", 298 }, 299 lib64: { 300 suffix: "64", 301 }, 302 }, 303 304 header_libs: [ 305 "bionic_libc_platform_headers", 306 ], 307 308 static_libs: [ 309 "libtombstoned_client_static", 310 "libdebuggerd", 311 "libcutils", 312 ], 313 314 shared_libs: [ 315 "libbase", 316 "liblog", 317 "libprocinfo", 318 "libunwindstack", 319 ], 320 } 321 322 cc_binary { 323 name: "debuggerd", 324 srcs: [ 325 "debuggerd.cpp", 326 ], 327 defaults: ["debuggerd_defaults"], 328 329 shared_libs: [ 330 "libbase", 331 "libdebuggerd_client", 332 "liblog", 333 "libprocinfo", 334 ], 335 336 local_include_dirs: ["include"], 337 } 338 339 cc_binary { 340 name: "tombstoned", 341 srcs: [ 342 "util.cpp", 343 "tombstoned/intercept_manager.cpp", 344 "tombstoned/tombstoned.cpp", 345 ], 346 defaults: ["debuggerd_defaults"], 347 348 header_libs: [ 349 "bionic_libc_platform_headers", 350 "libdebuggerd_common_headers" 351 ], 352 353 static_libs: [ 354 "libbase", 355 "libcutils", 356 "libevent", 357 "liblog", 358 ], 359 360 init_rc: ["tombstoned/tombstoned.rc"], 361 } 362 363 prebuilt_etc { 364 name: "crash_dump.policy", 365 sub_dir: "seccomp_policy", 366 filename_from_src: true, 367 arch: { 368 arm: { 369 src: "seccomp_policy/crash_dump.arm.policy", 370 }, 371 arm64: { 372 src: "seccomp_policy/crash_dump.arm64.policy", 373 }, 374 x86: { 375 src: "seccomp_policy/crash_dump.x86.policy", 376 }, 377 x86_64: { 378 src: "seccomp_policy/crash_dump.x86_64.policy", 379 }, 380 }, 381 required: [ 382 "crash_dump.policy_other", 383 ], 384 } 385 386 387 // NB -- this installs "the other" architecture. (puts 32 bit config in on 64 bit device) 388 // or at least that is the intention so that we get both of them populated 389 prebuilt_etc { 390 name: "crash_dump.policy_other", 391 sub_dir: "seccomp_policy", 392 filename_from_src: true, 393 arch: { 394 arm: { 395 src: "seccomp_policy/crash_dump.arm64.policy", 396 }, 397 arm64: { 398 src: "seccomp_policy/crash_dump.arm.policy", 399 }, 400 x86: { 401 src: "seccomp_policy/crash_dump.x86_64.policy", 402 }, 403 x86_64: { 404 src: "seccomp_policy/crash_dump.x86.policy", 405 }, 406 }, 407 } 408