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