| 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 | 2b2ae0c | 2017-08-21 14:31:17 -0700 | [diff] [blame] | 7 | "-Wno-unused-argument", | 
|  | 8 | "-Wno-unused-function", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 9 | "-Wno-nullability-completeness", | 
|  | 10 | "-Os", | 
|  | 11 | ], | 
| Josh Gao | 2b2ae0c | 2017-08-21 14:31:17 -0700 | [diff] [blame] | 12 | cpp_std: "gnu++17", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 13 |  | 
|  | 14 | local_include_dirs: ["include"], | 
|  | 15 | } | 
|  | 16 |  | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 17 | cc_library_headers { | 
|  | 18 | name: "libdebuggerd_common_headers", | 
|  | 19 | export_include_dirs: ["common/include"] | 
|  | 20 | } | 
|  | 21 |  | 
| Narayan Kamath | 2d377cd | 2017-05-10 10:58:59 +0100 | [diff] [blame] | 22 | cc_library_shared { | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 23 | name: "libtombstoned_client", | 
|  | 24 | defaults: ["debuggerd_defaults"], | 
|  | 25 | srcs: [ | 
| Narayan Kamath | 2d377cd | 2017-05-10 10:58:59 +0100 | [diff] [blame] | 26 | "tombstoned/tombstoned_client.cpp", | 
|  | 27 | "util.cpp", | 
|  | 28 | ], | 
|  | 29 |  | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 30 | header_libs: ["libdebuggerd_common_headers"], | 
|  | 31 |  | 
| Narayan Kamath | 2d377cd | 2017-05-10 10:58:59 +0100 | [diff] [blame] | 32 | static_libs: [ | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 33 | "libasync_safe", | 
| Narayan Kamath | 2d377cd | 2017-05-10 10:58:59 +0100 | [diff] [blame] | 34 | ], | 
|  | 35 |  | 
|  | 36 | shared_libs: [ | 
| Narayan Kamath | 2d377cd | 2017-05-10 10:58:59 +0100 | [diff] [blame] | 37 | "libbase", | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 38 | "libcutils", | 
| Narayan Kamath | 2d377cd | 2017-05-10 10:58:59 +0100 | [diff] [blame] | 39 | ], | 
|  | 40 |  | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 41 | export_header_lib_headers: ["libdebuggerd_common_headers"], | 
| Narayan Kamath | 2d377cd | 2017-05-10 10:58:59 +0100 | [diff] [blame] | 42 | export_include_dirs: ["tombstoned/include"] | 
|  | 43 | } | 
|  | 44 |  | 
|  | 45 | // Utility library to tombstoned and get an output fd. | 
|  | 46 | cc_library_static { | 
|  | 47 | name: "libtombstoned_client_static", | 
|  | 48 | defaults: ["debuggerd_defaults"], | 
|  | 49 | srcs: [ | 
|  | 50 | "tombstoned/tombstoned_client.cpp", | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 51 | "util.cpp", | 
|  | 52 | ], | 
|  | 53 |  | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 54 | header_libs: ["libdebuggerd_common_headers"], | 
|  | 55 |  | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 56 | whole_static_libs: [ | 
| Christopher Ferris | ac22578 | 2017-04-25 11:23:10 -0700 | [diff] [blame] | 57 | "libasync_safe", | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 58 | "libcutils", | 
|  | 59 | "libbase", | 
|  | 60 | ], | 
| Narayan Kamath | 2d377cd | 2017-05-10 10:58:59 +0100 | [diff] [blame] | 61 |  | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 62 | export_header_lib_headers: ["libdebuggerd_common_headers"], | 
| Narayan Kamath | 2d377cd | 2017-05-10 10:58:59 +0100 | [diff] [blame] | 63 | export_include_dirs: ["tombstoned/include"] | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 64 | } | 
|  | 65 |  | 
|  | 66 | // Core implementation, linked into libdebuggerd_handler and the dynamic linker. | 
| Josh Gao | 9c02dc5 | 2016-06-15 17:29:00 -0700 | [diff] [blame] | 67 | cc_library_static { | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 68 | name: "libdebuggerd_handler_core", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 69 | defaults: ["debuggerd_defaults"], | 
|  | 70 | srcs: ["handler/debuggerd_handler.cpp"], | 
| Josh Gao | 9c02dc5 | 2016-06-15 17:29:00 -0700 | [diff] [blame] | 71 |  | 
| Josh Gao | fdf832d | 2017-08-25 18:00:18 -0700 | [diff] [blame] | 72 | header_libs: [ | 
|  | 73 | "libbase_headers", | 
|  | 74 | "libdebuggerd_common_headers", | 
|  | 75 | ], | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 76 |  | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 77 | whole_static_libs: [ | 
| Christopher Ferris | ac22578 | 2017-04-25 11:23:10 -0700 | [diff] [blame] | 78 | "libasync_safe", | 
| Josh Gao | 2b2ae0c | 2017-08-21 14:31:17 -0700 | [diff] [blame] | 79 | "libcutils", | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 80 | "libdebuggerd", | 
|  | 81 | ], | 
|  | 82 |  | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 83 | export_header_lib_headers: ["libdebuggerd_common_headers"], | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 84 | export_include_dirs: ["include"], | 
|  | 85 | } | 
|  | 86 |  | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 87 | // Implementation with a no-op fallback. | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 88 | cc_library_static { | 
|  | 89 | name: "libdebuggerd_handler", | 
|  | 90 | defaults: ["debuggerd_defaults"], | 
|  | 91 | srcs: ["handler/debuggerd_fallback_nop.cpp"], | 
|  | 92 |  | 
|  | 93 | whole_static_libs: [ | 
|  | 94 | "libdebuggerd_handler_core", | 
|  | 95 | ], | 
|  | 96 |  | 
|  | 97 | export_include_dirs: ["include"], | 
|  | 98 | } | 
|  | 99 |  | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 100 | // Fallback implementation. | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 101 | cc_library_static { | 
|  | 102 | name: "libdebuggerd_handler_fallback", | 
|  | 103 | defaults: ["debuggerd_defaults"], | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 104 | srcs: [ | 
|  | 105 | "handler/debuggerd_fallback.cpp", | 
|  | 106 | ], | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 107 |  | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 108 | whole_static_libs: [ | 
|  | 109 | "libdebuggerd_handler_core", | 
| Narayan Kamath | 2d377cd | 2017-05-10 10:58:59 +0100 | [diff] [blame] | 110 | "libtombstoned_client_static", | 
| Christopher Ferris | ac22578 | 2017-04-25 11:23:10 -0700 | [diff] [blame] | 111 | "libasync_safe", | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 112 | "libbase", | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 113 | "libdebuggerd", | 
|  | 114 | "libbacktrace", | 
|  | 115 | "libunwind", | 
| Christopher Ferris | 9a8c855 | 2017-08-11 15:29:19 -0700 | [diff] [blame] | 116 | "libunwindstack", | 
| Christopher Ferris | 0b06a59 | 2018-01-19 10:26:36 -0800 | [diff] [blame] | 117 | "libdexfile", | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 118 | "liblzma", | 
|  | 119 | "libcutils", | 
|  | 120 | ], | 
| Josh Gao | 9c02dc5 | 2016-06-15 17:29:00 -0700 | [diff] [blame] | 121 |  | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 122 | export_include_dirs: ["include"], | 
|  | 123 | } | 
|  | 124 |  | 
|  | 125 | cc_library { | 
|  | 126 | name: "libdebuggerd_client", | 
|  | 127 | defaults: ["debuggerd_defaults"], | 
|  | 128 | srcs: [ | 
|  | 129 | "client/debuggerd_client.cpp", | 
|  | 130 | "util.cpp", | 
|  | 131 | ], | 
|  | 132 |  | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 133 | header_libs: ["libdebuggerd_common_headers"], | 
|  | 134 |  | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 135 | shared_libs: [ | 
|  | 136 | "libbase", | 
|  | 137 | "libcutils", | 
|  | 138 | ], | 
| Josh Gao | e1aa0ca | 2017-03-01 17:23:22 -0800 | [diff] [blame] | 139 |  | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 140 | export_header_lib_headers: ["libdebuggerd_common_headers"], | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 141 | export_include_dirs: ["include"], | 
|  | 142 | } | 
|  | 143 |  | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 144 | cc_library_static { | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 145 | name: "libdebuggerd", | 
|  | 146 | defaults: ["debuggerd_defaults"], | 
|  | 147 |  | 
|  | 148 | srcs: [ | 
|  | 149 | "libdebuggerd/backtrace.cpp", | 
|  | 150 | "libdebuggerd/elf_utils.cpp", | 
|  | 151 | "libdebuggerd/open_files_list.cpp", | 
|  | 152 | "libdebuggerd/tombstone.cpp", | 
|  | 153 | "libdebuggerd/utility.cpp", | 
|  | 154 | ], | 
|  | 155 |  | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 156 | local_include_dirs: ["libdebuggerd/include"], | 
|  | 157 | export_include_dirs: ["libdebuggerd/include"], | 
| Josh Gao | 9c02dc5 | 2016-06-15 17:29:00 -0700 | [diff] [blame] | 158 |  | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 159 | static_libs: [ | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 160 | "libbacktrace", | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 161 | "libunwind", | 
| Christopher Ferris | 9a8c855 | 2017-08-11 15:29:19 -0700 | [diff] [blame] | 162 | "libunwindstack", | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 163 | "liblzma", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 164 | "libbase", | 
|  | 165 | "libcutils", | 
|  | 166 | "liblog", | 
|  | 167 | ], | 
|  | 168 | } | 
|  | 169 |  | 
|  | 170 | cc_test { | 
|  | 171 | name: "debuggerd_test", | 
|  | 172 | defaults: ["debuggerd_defaults"], | 
|  | 173 |  | 
|  | 174 | cflags: ["-Wno-missing-field-initializers"], | 
|  | 175 | srcs: [ | 
|  | 176 | "libdebuggerd/test/dump_memory_test.cpp", | 
|  | 177 | "libdebuggerd/test/elf_fake.cpp", | 
|  | 178 | "libdebuggerd/test/log_fake.cpp", | 
|  | 179 | "libdebuggerd/test/open_files_list_test.cpp", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 180 | "libdebuggerd/test/tombstone_test.cpp", | 
|  | 181 | ], | 
|  | 182 |  | 
|  | 183 | target: { | 
|  | 184 | android: { | 
|  | 185 | srcs: [ | 
| Josh Gao | ae9d767 | 2017-03-24 16:26:03 -0700 | [diff] [blame] | 186 | "client/debuggerd_client_test.cpp", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 187 | "debuggerd_test.cpp", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 188 | ], | 
| Narayan Kamath | 2d377cd | 2017-05-10 10:58:59 +0100 | [diff] [blame] | 189 | static_libs: ["libasync_safe", "libtombstoned_client_static"], | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 190 | }, | 
|  | 191 | }, | 
|  | 192 |  | 
|  | 193 | shared_libs: [ | 
|  | 194 | "libbacktrace", | 
|  | 195 | "libbase", | 
|  | 196 | "libcutils", | 
| Josh Gao | ae9d767 | 2017-03-24 16:26:03 -0700 | [diff] [blame] | 197 | "libdebuggerd_client", | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 198 | "liblog", | 
| Josh Gao | e04ca27 | 2018-01-16 15:38:17 -0800 | [diff] [blame] | 199 | "libminijail", | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 200 | "libnativehelper" | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 201 | ], | 
|  | 202 |  | 
|  | 203 | static_libs: [ | 
| Josh Gao | 352a845 | 2017-03-30 16:46:21 -0700 | [diff] [blame] | 204 | "libdebuggerd", | 
| Josh Gao | 2b2ae0c | 2017-08-21 14:31:17 -0700 | [diff] [blame] | 205 | "libunwindstack", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 206 | ], | 
|  | 207 |  | 
|  | 208 | local_include_dirs: [ | 
|  | 209 | "libdebuggerd", | 
|  | 210 | ], | 
|  | 211 |  | 
|  | 212 | compile_multilib: "both", | 
|  | 213 | multilib: { | 
|  | 214 | lib32: { | 
|  | 215 | stem: "debuggerd_test32", | 
|  | 216 | }, | 
|  | 217 | lib64: { | 
|  | 218 | stem: "debuggerd_test64", | 
|  | 219 | }, | 
|  | 220 | }, | 
|  | 221 | } | 
|  | 222 |  | 
| Josh Gao | a42314e | 2017-12-19 15:08:19 -0800 | [diff] [blame] | 223 | cc_benchmark { | 
|  | 224 | name: "debuggerd_benchmark", | 
|  | 225 | defaults: ["debuggerd_defaults"], | 
|  | 226 | srcs: ["debuggerd_benchmark.cpp"], | 
|  | 227 | shared_libs: [ | 
|  | 228 | "libbase", | 
|  | 229 | "libdebuggerd_client", | 
|  | 230 | ], | 
|  | 231 | } | 
|  | 232 |  | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 233 | cc_binary { | 
|  | 234 | name: "crash_dump", | 
|  | 235 | srcs: [ | 
|  | 236 | "crash_dump.cpp", | 
|  | 237 | "util.cpp", | 
|  | 238 | ], | 
|  | 239 | defaults: ["debuggerd_defaults"], | 
|  | 240 |  | 
|  | 241 | compile_multilib: "both", | 
|  | 242 | multilib: { | 
|  | 243 | lib32: { | 
|  | 244 | suffix: "32", | 
|  | 245 | }, | 
|  | 246 | lib64: { | 
|  | 247 | suffix: "64", | 
|  | 248 | }, | 
|  | 249 | }, | 
|  | 250 |  | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 251 | static_libs: [ | 
| Narayan Kamath | 2d377cd | 2017-05-10 10:58:59 +0100 | [diff] [blame] | 252 | "libtombstoned_client_static", | 
| Josh Gao | e73c932 | 2017-02-08 16:06:26 -0800 | [diff] [blame] | 253 | "libdebuggerd", | 
|  | 254 | "libcutils", | 
|  | 255 | ], | 
|  | 256 |  | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 257 | shared_libs: [ | 
|  | 258 | "libbacktrace", | 
|  | 259 | "libbase", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 260 | "liblog", | 
|  | 261 | "libprocinfo", | 
| Josh Gao | 2b2ae0c | 2017-08-21 14:31:17 -0700 | [diff] [blame] | 262 | "libunwindstack", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 263 | ], | 
|  | 264 | } | 
|  | 265 |  | 
|  | 266 | cc_binary { | 
|  | 267 | name: "debuggerd", | 
|  | 268 | srcs: [ | 
|  | 269 | "debuggerd.cpp", | 
|  | 270 | ], | 
|  | 271 | defaults: ["debuggerd_defaults"], | 
|  | 272 |  | 
|  | 273 | shared_libs: [ | 
|  | 274 | "libbase", | 
|  | 275 | "libdebuggerd_client", | 
|  | 276 | "liblog", | 
| Josh Gao | 0915f23 | 2017-06-27 14:08:05 -0700 | [diff] [blame] | 277 | "libprocinfo", | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 278 | ], | 
|  | 279 |  | 
|  | 280 | local_include_dirs: ["include"], | 
|  | 281 | } | 
|  | 282 |  | 
|  | 283 | cc_binary { | 
|  | 284 | name: "tombstoned", | 
|  | 285 | srcs: [ | 
|  | 286 | "util.cpp", | 
|  | 287 | "tombstoned/intercept_manager.cpp", | 
|  | 288 | "tombstoned/tombstoned.cpp", | 
|  | 289 | ], | 
|  | 290 | defaults: ["debuggerd_defaults"], | 
|  | 291 |  | 
| Narayan Kamath | a73df60 | 2017-05-24 15:07:25 +0100 | [diff] [blame] | 292 | header_libs: ["libdebuggerd_common_headers"], | 
|  | 293 |  | 
| Josh Gao | cbe70cb | 2016-10-18 18:17:52 -0700 | [diff] [blame] | 294 | static_libs: [ | 
|  | 295 | "libbase", | 
|  | 296 | "libcutils", | 
|  | 297 | "libevent", | 
|  | 298 | "liblog", | 
|  | 299 | ], | 
|  | 300 |  | 
|  | 301 | init_rc: ["tombstoned/tombstoned.rc"] | 
| Josh Gao | 9c02dc5 | 2016-06-15 17:29:00 -0700 | [diff] [blame] | 302 | } | 
| Elliott Hughes | 0ba5359 | 2017-02-01 16:59:15 -0800 | [diff] [blame] | 303 |  | 
|  | 304 | subdirs = [ | 
|  | 305 | "crasher", | 
|  | 306 | ] |