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