| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 1 | cc_defaults { | 
 | 2 |     name: "debuggerd_defaults", | 
| Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 3 |     defaults: ["linux_bionic_supported"], | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 4 |     cflags: [ | 
 | 5 |         "-Wall", | 
 | 6 |         "-Wextra", | 
| Josh Gao | c7fe060 | 2017-03-13 14:13:29 -0700 | [diff] [blame] | 7 |         "-Werror", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 8 |         "-Wno-nullability-completeness", | 
 | 9 |         "-Os", | 
 | 10 |     ], | 
 | 11 |  | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 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 |  | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 16 |     local_include_dirs: ["include"], | 
 | 17 | } | 
 | 18 |  | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 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. | 
| Josh Gao | 9c02dc5 | 2016-06-15 17:29:00 -0700 | [diff] [blame] | 36 | cc_library_static { | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 37 |     name: "libdebuggerd_handler_core", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 38 |     defaults: ["debuggerd_defaults"], | 
 | 39 |     srcs: ["handler/debuggerd_handler.cpp"], | 
| Josh Gao | 9c02dc5 | 2016-06-15 17:29:00 -0700 | [diff] [blame] | 40 |  | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 41 |     whole_static_libs: [ | 
 | 42 |         "libc_logging", | 
 | 43 |         "libdebuggerd", | 
 | 44 |     ], | 
 | 45 |  | 
 | 46 |     export_include_dirs: ["include"], | 
 | 47 | } | 
 | 48 |  | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 49 | // Implementation with a no-op fallback. | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 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 |  | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 62 | // Fallback implementation. | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 63 | cc_library_static { | 
 | 64 |     name: "libdebuggerd_handler_fallback", | 
 | 65 |     defaults: ["debuggerd_defaults"], | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 66 |     srcs: [ | 
 | 67 |         "handler/debuggerd_fallback.cpp", | 
 | 68 |     ], | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 69 |  | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 70 |     whole_static_libs: [ | 
 | 71 |         "libdebuggerd_handler_core", | 
 | 72 |         "libtombstoned_client", | 
 | 73 |         "libbase", | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 74 |         "libdebuggerd", | 
 | 75 |         "libbacktrace", | 
 | 76 |         "libunwind", | 
 | 77 |         "liblzma", | 
 | 78 |         "libcutils", | 
 | 79 |     ], | 
| Josh Gao | 9c02dc5 | 2016-06-15 17:29:00 -0700 | [diff] [blame] | 80 |  | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 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 |     ], | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 96 |  | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 97 |     export_include_dirs: ["include"], | 
 | 98 | } | 
 | 99 |  | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 100 | cc_library_static { | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 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 |         }, | 
| Robert Sesek | 9eb02c9 | 2016-08-09 14:04:05 -0400 | [diff] [blame] | 131 |     }, | 
| Robert Sesek | 9eb02c9 | 2016-08-09 14:04:05 -0400 | [diff] [blame] | 132 |  | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 133 |     local_include_dirs: ["libdebuggerd/include"], | 
 | 134 |     export_include_dirs: ["libdebuggerd/include"], | 
| Josh Gao | 9c02dc5 | 2016-06-15 17:29:00 -0700 | [diff] [blame] | 135 |  | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 136 |     static_libs: [ | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 137 |         "libbacktrace", | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 138 |         "libunwind", | 
 | 139 |         "liblzma", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 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: [ | 
| Josh Gao | ae9d767 | 2017-03-24 16:26:03 -0700 | [diff] [blame] | 164 |                 "client/debuggerd_client_test.cpp", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 165 |                 "debuggerd_test.cpp", | 
 | 166 |                 "util.cpp" | 
 | 167 |             ], | 
 | 168 |         }, | 
 | 169 |     }, | 
 | 170 |  | 
 | 171 |     shared_libs: [ | 
 | 172 |         "libbacktrace", | 
 | 173 |         "libbase", | 
 | 174 |         "libcutils", | 
| Josh Gao | ae9d767 | 2017-03-24 16:26:03 -0700 | [diff] [blame] | 175 |         "libdebuggerd_client", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 176 |     ], | 
 | 177 |  | 
 | 178 |     static_libs: [ | 
 | 179 |         "libdebuggerd" | 
 | 180 |     ], | 
 | 181 |  | 
 | 182 |     local_include_dirs: [ | 
 | 183 |         "libdebuggerd", | 
 | 184 |     ], | 
 | 185 |  | 
 | 186 |     compile_multilib: "both", | 
 | 187 |     multilib: { | 
 | 188 |         lib32: { | 
 | 189 |             stem: "debuggerd_test32", | 
 | 190 |         }, | 
 | 191 |         lib64: { | 
 | 192 |             stem: "debuggerd_test64", | 
 | 193 |         }, | 
 | 194 |     }, | 
 | 195 | } | 
 | 196 |  | 
 | 197 | cc_binary { | 
 | 198 |     name: "crash_dump", | 
 | 199 |     srcs: [ | 
 | 200 |         "crash_dump.cpp", | 
 | 201 |         "util.cpp", | 
 | 202 |     ], | 
 | 203 |     defaults: ["debuggerd_defaults"], | 
 | 204 |  | 
 | 205 |     compile_multilib: "both", | 
 | 206 |     multilib: { | 
 | 207 |         lib32: { | 
 | 208 |             suffix: "32", | 
 | 209 |         }, | 
 | 210 |         lib64: { | 
 | 211 |             suffix: "64", | 
 | 212 |         }, | 
 | 213 |     }, | 
 | 214 |  | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 215 |     static_libs: [ | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 216 |         "libtombstoned_client", | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 217 |         "libdebuggerd", | 
 | 218 |         "libcutils", | 
 | 219 |     ], | 
 | 220 |  | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 221 |     shared_libs: [ | 
 | 222 |         "libbacktrace", | 
 | 223 |         "libbase", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 224 |         "liblog", | 
 | 225 |         "libprocinfo", | 
 | 226 |         "libselinux", | 
 | 227 |     ], | 
 | 228 | } | 
 | 229 |  | 
 | 230 | cc_binary { | 
 | 231 |     name: "debuggerd", | 
 | 232 |     srcs: [ | 
 | 233 |         "debuggerd.cpp", | 
 | 234 |     ], | 
 | 235 |     defaults: ["debuggerd_defaults"], | 
 | 236 |  | 
 | 237 |     shared_libs: [ | 
 | 238 |         "libbase", | 
 | 239 |         "libdebuggerd_client", | 
 | 240 |         "liblog", | 
 | 241 |         "libselinux", | 
 | 242 |     ], | 
 | 243 |  | 
 | 244 |     local_include_dirs: ["include"], | 
 | 245 | } | 
 | 246 |  | 
 | 247 | cc_binary { | 
 | 248 |     name: "tombstoned", | 
 | 249 |     srcs: [ | 
 | 250 |         "util.cpp", | 
 | 251 |         "tombstoned/intercept_manager.cpp", | 
 | 252 |         "tombstoned/tombstoned.cpp", | 
 | 253 |     ], | 
 | 254 |     defaults: ["debuggerd_defaults"], | 
 | 255 |  | 
 | 256 |     static_libs: [ | 
 | 257 |         "libbase", | 
 | 258 |         "libcutils", | 
 | 259 |         "libevent", | 
 | 260 |         "liblog", | 
 | 261 |     ], | 
 | 262 |  | 
 | 263 |     init_rc: ["tombstoned/tombstoned.rc"] | 
| Josh Gao | 9c02dc5 | 2016-06-15 17:29:00 -0700 | [diff] [blame] | 264 | } | 
| Elliott Hughes | 0ba5359 | 2017-02-01 16:59:15 -0800 | [diff] [blame] | 265 |  | 
 | 266 | subdirs = [ | 
 | 267 |     "crasher", | 
 | 268 | ] |