1 cc_defaults { 2 name: "debuggerd_defaults", 3 defaults: ["linux_bionic_supported"], 4 cflags: [ 5 "-Wall", 6 "-Wextra", 7 "-Werror", 8 "-Wno-nullability-completeness", 9 "-Os", 10 ], 11 12 // util.cpp gets async signal safe logging via libc_logging, 13 // which defines its interface in bionic private headers. 14 include_dirs: ["bionic/libc"], 15 16 local_include_dirs: ["include"], 17 } 18 19 // Utility library to tombstoned and get an output fd. 20 cc_library_static { 21 name: "libtombstoned_client", 22 defaults: ["debuggerd_defaults"], 23 srcs: [ 24 "tombstoned_client.cpp", 25 "util.cpp", 26 ], 27 28 whole_static_libs: [ 29 "libc_logging", 30 "libcutils", 31 "libbase", 32 ], 33 } 34 35 // Core implementation, linked into libdebuggerd_handler and the dynamic linker. 36 cc_library_static { 37 name: "libdebuggerd_handler_core", 38 defaults: ["debuggerd_defaults"], 39 srcs: ["handler/debuggerd_handler.cpp"], 40 41 whole_static_libs: [ 42 "libc_logging", 43 "libdebuggerd", 44 ], 45 46 export_include_dirs: ["include"], 47 } 48 49 // Implementation with a no-op fallback. 50 cc_library_static { 51 name: "libdebuggerd_handler", 52 defaults: ["debuggerd_defaults"], 53 srcs: ["handler/debuggerd_fallback_nop.cpp"], 54 55 whole_static_libs: [ 56 "libdebuggerd_handler_core", 57 ], 58 59 export_include_dirs: ["include"], 60 } 61 62 // Fallback implementation. 63 cc_library_static { 64 name: "libdebuggerd_handler_fallback", 65 defaults: ["debuggerd_defaults"], 66 srcs: [ 67 "handler/debuggerd_fallback.cpp", 68 ], 69 70 whole_static_libs: [ 71 "libdebuggerd_handler_core", 72 "libtombstoned_client", 73 "libbase", 74 "libdebuggerd", 75 "libbacktrace", 76 "libunwind", 77 "liblzma", 78 "libcutils", 79 ], 80 81 export_include_dirs: ["include"], 82 } 83 84 cc_library { 85 name: "libdebuggerd_client", 86 defaults: ["debuggerd_defaults"], 87 srcs: [ 88 "client/debuggerd_client.cpp", 89 "util.cpp", 90 ], 91 92 shared_libs: [ 93 "libbase", 94 "libcutils", 95 ], 96 97 export_include_dirs: ["include"], 98 } 99 100 cc_library_static { 101 name: "libdebuggerd", 102 defaults: ["debuggerd_defaults"], 103 104 srcs: [ 105 "libdebuggerd/backtrace.cpp", 106 "libdebuggerd/elf_utils.cpp", 107 "libdebuggerd/open_files_list.cpp", 108 "libdebuggerd/tombstone.cpp", 109 "libdebuggerd/utility.cpp", 110 ], 111 112 target: { 113 android_arm: { 114 srcs: ["libdebuggerd/arm/machine.cpp"], 115 }, 116 android_arm64: { 117 srcs: ["libdebuggerd/arm64/machine.cpp"], 118 }, 119 android_mips: { 120 srcs: ["libdebuggerd/mips/machine.cpp"], 121 }, 122 android_mips64: { 123 srcs: ["libdebuggerd/mips64/machine.cpp"], 124 }, 125 android_x86: { 126 srcs: ["libdebuggerd/x86/machine.cpp"], 127 }, 128 android_x86_64: { 129 srcs: ["libdebuggerd/x86_64/machine.cpp"], 130 }, 131 }, 132 133 local_include_dirs: ["libdebuggerd/include"], 134 export_include_dirs: ["libdebuggerd/include"], 135 136 static_libs: [ 137 "libbacktrace", 138 "libunwind", 139 "liblzma", 140 "libbase", 141 "libcutils", 142 "liblog", 143 ], 144 } 145 146 cc_test { 147 name: "debuggerd_test", 148 defaults: ["debuggerd_defaults"], 149 150 cflags: ["-Wno-missing-field-initializers"], 151 srcs: [ 152 "libdebuggerd/test/dump_memory_test.cpp", 153 "libdebuggerd/test/elf_fake.cpp", 154 "libdebuggerd/test/log_fake.cpp", 155 "libdebuggerd/test/open_files_list_test.cpp", 156 "libdebuggerd/test/property_fake.cpp", 157 "libdebuggerd/test/ptrace_fake.cpp", 158 "libdebuggerd/test/tombstone_test.cpp", 159 ], 160 161 target: { 162 android: { 163 srcs: [ 164 "client/debuggerd_client_test.cpp", 165 "debuggerd_test.cpp", 166 "tombstoned_client.cpp", 167 "util.cpp" 168 ], 169 }, 170 }, 171 172 shared_libs: [ 173 "libbacktrace", 174 "libbase", 175 "libcutils", 176 "libdebuggerd_client", 177 ], 178 179 static_libs: [ 180 "libdebuggerd", 181 "libc_logging", 182 ], 183 184 local_include_dirs: [ 185 "libdebuggerd", 186 ], 187 188 compile_multilib: "both", 189 multilib: { 190 lib32: { 191 stem: "debuggerd_test32", 192 }, 193 lib64: { 194 stem: "debuggerd_test64", 195 }, 196 }, 197 } 198 199 cc_binary { 200 name: "crash_dump", 201 srcs: [ 202 "crash_dump.cpp", 203 "util.cpp", 204 ], 205 defaults: ["debuggerd_defaults"], 206 207 compile_multilib: "both", 208 multilib: { 209 lib32: { 210 suffix: "32", 211 }, 212 lib64: { 213 suffix: "64", 214 }, 215 }, 216 217 static_libs: [ 218 "libtombstoned_client", 219 "libdebuggerd", 220 "libcutils", 221 ], 222 223 shared_libs: [ 224 "libbacktrace", 225 "libbase", 226 "liblog", 227 "libprocinfo", 228 "libselinux", 229 ], 230 } 231 232 cc_binary { 233 name: "debuggerd", 234 srcs: [ 235 "debuggerd.cpp", 236 ], 237 defaults: ["debuggerd_defaults"], 238 239 shared_libs: [ 240 "libbase", 241 "libdebuggerd_client", 242 "liblog", 243 "libselinux", 244 ], 245 246 local_include_dirs: ["include"], 247 } 248 249 cc_binary { 250 name: "tombstoned", 251 srcs: [ 252 "util.cpp", 253 "tombstoned/intercept_manager.cpp", 254 "tombstoned/tombstoned.cpp", 255 ], 256 defaults: ["debuggerd_defaults"], 257 258 static_libs: [ 259 "libbase", 260 "libcutils", 261 "libevent", 262 "liblog", 263 ], 264 265 init_rc: ["tombstoned/tombstoned.rc"] 266 } 267 268 subdirs = [ 269 "crasher", 270 ] 271