blob: 10f52f45fdedb5e096ca47ec4c832e756b4767e8 [file] [log] [blame]
Josh Gaocbe70cb2016-10-18 18:17:52 -07001cc_defaults {
2 name: "debuggerd_defaults",
3 cflags: [
4 "-Wall",
5 "-Wextra",
Josh Gaoc7fe0602017-03-13 14:13:29 -07006 "-Werror",
Josh Gao2b2ae0c2017-08-21 14:31:17 -07007 "-Wno-unused-argument",
8 "-Wno-unused-function",
Josh Gaocbe70cb2016-10-18 18:17:52 -07009 "-Wno-nullability-completeness",
10 "-Os",
11 ],
12
13 local_include_dirs: ["include"],
14}
15
Narayan Kamatha73df602017-05-24 15:07:25 +010016cc_library_headers {
17 name: "libdebuggerd_common_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080018 export_include_dirs: ["common/include"],
Jiyong Parka0e75042018-05-24 14:11:00 +090019 recovery_available: true,
Narayan Kamatha73df602017-05-24 15:07:25 +010020}
21
Narayan Kamath2d377cd2017-05-10 10:58:59 +010022cc_library_shared {
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080023 name: "libtombstoned_client",
24 defaults: ["debuggerd_defaults"],
25 srcs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +010026 "tombstoned/tombstoned_client.cpp",
27 "util.cpp",
28 ],
29
Narayan Kamatha73df602017-05-24 15:07:25 +010030 header_libs: ["libdebuggerd_common_headers"],
31
Narayan Kamath2d377cd2017-05-10 10:58:59 +010032 static_libs: [
Narayan Kamatha73df602017-05-24 15:07:25 +010033 "libasync_safe",
Narayan Kamath2d377cd2017-05-10 10:58:59 +010034 ],
35
36 shared_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +010037 "libbase",
Narayan Kamatha73df602017-05-24 15:07:25 +010038 "libcutils",
Narayan Kamath2d377cd2017-05-10 10:58:59 +010039 ],
40
Narayan Kamatha73df602017-05-24 15:07:25 +010041 export_header_lib_headers: ["libdebuggerd_common_headers"],
Elliott Hughesdc699a22018-02-16 17:58:14 -080042 export_include_dirs: ["tombstoned/include"],
Narayan Kamath2d377cd2017-05-10 10:58:59 +010043}
44
Josh Gao9da1f512018-08-06 15:38:29 -070045// Utility library to talk to tombstoned and get an output fd.
Narayan Kamath2d377cd2017-05-10 10:58:59 +010046cc_library_static {
47 name: "libtombstoned_client_static",
48 defaults: ["debuggerd_defaults"],
Jiyong Park011ee122018-05-29 16:41:30 +090049 recovery_available: true,
Narayan Kamath2d377cd2017-05-10 10:58:59 +010050 srcs: [
51 "tombstoned/tombstoned_client.cpp",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080052 "util.cpp",
53 ],
54
Narayan Kamatha73df602017-05-24 15:07:25 +010055 header_libs: ["libdebuggerd_common_headers"],
56
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080057 whole_static_libs: [
Christopher Ferrisac225782017-04-25 11:23:10 -070058 "libasync_safe",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080059 "libcutils",
60 "libbase",
61 ],
Narayan Kamath2d377cd2017-05-10 10:58:59 +010062
Narayan Kamatha73df602017-05-24 15:07:25 +010063 export_header_lib_headers: ["libdebuggerd_common_headers"],
Elliott Hughesdc699a22018-02-16 17:58:14 -080064 export_include_dirs: ["tombstoned/include"],
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080065}
66
67// Core implementation, linked into libdebuggerd_handler and the dynamic linker.
Josh Gao9c02dc52016-06-15 17:29:00 -070068cc_library_static {
Josh Gaoe73c9322017-02-08 16:06:26 -080069 name: "libdebuggerd_handler_core",
Josh Gaocbe70cb2016-10-18 18:17:52 -070070 defaults: ["debuggerd_defaults"],
Jiyong Parka0e75042018-05-24 14:11:00 +090071 recovery_available: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -070072 srcs: ["handler/debuggerd_handler.cpp"],
Josh Gao9c02dc52016-06-15 17:29:00 -070073
Josh Gaofdf832d2017-08-25 18:00:18 -070074 header_libs: [
75 "libbase_headers",
76 "libdebuggerd_common_headers",
77 ],
Narayan Kamatha73df602017-05-24 15:07:25 +010078
Josh Gaoe73c9322017-02-08 16:06:26 -080079 whole_static_libs: [
Christopher Ferrisac225782017-04-25 11:23:10 -070080 "libasync_safe",
Josh Gao2b2ae0c2017-08-21 14:31:17 -070081 "libcutils",
Josh Gaoe73c9322017-02-08 16:06:26 -080082 "libdebuggerd",
83 ],
84
Narayan Kamatha73df602017-05-24 15:07:25 +010085 export_header_lib_headers: ["libdebuggerd_common_headers"],
Josh Gaoe73c9322017-02-08 16:06:26 -080086 export_include_dirs: ["include"],
87}
88
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080089// Implementation with a no-op fallback.
Josh Gaoe73c9322017-02-08 16:06:26 -080090cc_library_static {
91 name: "libdebuggerd_handler",
92 defaults: ["debuggerd_defaults"],
93 srcs: ["handler/debuggerd_fallback_nop.cpp"],
94
95 whole_static_libs: [
96 "libdebuggerd_handler_core",
97 ],
98
99 export_include_dirs: ["include"],
100}
101
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800102// Fallback implementation.
Josh Gaoe73c9322017-02-08 16:06:26 -0800103cc_library_static {
104 name: "libdebuggerd_handler_fallback",
105 defaults: ["debuggerd_defaults"],
Jiyong Park011ee122018-05-29 16:41:30 +0900106 recovery_available: true,
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800107 srcs: [
108 "handler/debuggerd_fallback.cpp",
109 ],
Josh Gaoe73c9322017-02-08 16:06:26 -0800110
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800111 whole_static_libs: [
112 "libdebuggerd_handler_core",
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100113 "libtombstoned_client_static",
Christopher Ferrisac225782017-04-25 11:23:10 -0700114 "libasync_safe",
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800115 "libbase",
Josh Gaoe73c9322017-02-08 16:06:26 -0800116 "libdebuggerd",
117 "libbacktrace",
Christopher Ferris9a8c8552017-08-11 15:29:19 -0700118 "libunwindstack",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000119 "libdexfile", // libunwindstack dependency
120 "libdexfile_external", // libunwindstack dependency
121 "libdexfile_support", // libunwindstack dependency
Josh Gaoe73c9322017-02-08 16:06:26 -0800122 "liblzma",
123 "libcutils",
124 ],
Jiyong Park011ee122018-05-29 16:41:30 +0900125 target: {
126 recovery: {
127 cflags: ["-DNO_LIBDEXFILE_SUPPORT"],
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000128 exclude_static_libs: [
129 "libartbase",
130 "libdexfile",
131 "libdexfile_external",
132 "libdexfile_support",
133 ],
Jiyong Park011ee122018-05-29 16:41:30 +0900134 },
135 },
Josh Gao9c02dc52016-06-15 17:29:00 -0700136
Josh Gaocbe70cb2016-10-18 18:17:52 -0700137 export_include_dirs: ["include"],
138}
139
140cc_library {
141 name: "libdebuggerd_client",
142 defaults: ["debuggerd_defaults"],
143 srcs: [
144 "client/debuggerd_client.cpp",
145 "util.cpp",
146 ],
147
Narayan Kamatha73df602017-05-24 15:07:25 +0100148 header_libs: ["libdebuggerd_common_headers"],
149
Josh Gaocbe70cb2016-10-18 18:17:52 -0700150 shared_libs: [
151 "libbase",
152 "libcutils",
Josh Gao4175cee2019-01-04 13:57:09 -0800153 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700154 ],
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800155
Narayan Kamatha73df602017-05-24 15:07:25 +0100156 export_header_lib_headers: ["libdebuggerd_common_headers"],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700157 export_include_dirs: ["include"],
158}
159
Josh Gaoe73c9322017-02-08 16:06:26 -0800160cc_library_static {
Josh Gaocbe70cb2016-10-18 18:17:52 -0700161 name: "libdebuggerd",
162 defaults: ["debuggerd_defaults"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900163 recovery_available: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700164
165 srcs: [
166 "libdebuggerd/backtrace.cpp",
167 "libdebuggerd/elf_utils.cpp",
168 "libdebuggerd/open_files_list.cpp",
169 "libdebuggerd/tombstone.cpp",
170 "libdebuggerd/utility.cpp",
171 ],
172
Josh Gaocbe70cb2016-10-18 18:17:52 -0700173 local_include_dirs: ["libdebuggerd/include"],
174 export_include_dirs: ["libdebuggerd/include"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700175
Josh Gaoce841d92018-08-06 18:26:42 -0700176 // Needed for private/bionic_fdsan.h
177 include_dirs: ["bionic/libc"],
178
Josh Gaoe73c9322017-02-08 16:06:26 -0800179 static_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700180 "libbacktrace",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000181 "libdexfile_external", // libunwindstack dependency
182 "libdexfile_support", // libunwindstack dependency
Christopher Ferris9a8c8552017-08-11 15:29:19 -0700183 "libunwindstack",
Josh Gaoe73c9322017-02-08 16:06:26 -0800184 "liblzma",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700185 "libbase",
186 "libcutils",
187 "liblog",
188 ],
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000189 target: {
190 recovery: {
191 exclude_static_libs: [
192 "libdexfile_external",
193 "libdexfile_support",
194 ],
195 },
196 },
Josh Gaocbe70cb2016-10-18 18:17:52 -0700197}
198
199cc_test {
200 name: "debuggerd_test",
201 defaults: ["debuggerd_defaults"],
202
203 cflags: ["-Wno-missing-field-initializers"],
204 srcs: [
205 "libdebuggerd/test/dump_memory_test.cpp",
206 "libdebuggerd/test/elf_fake.cpp",
207 "libdebuggerd/test/log_fake.cpp",
208 "libdebuggerd/test/open_files_list_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700209 "libdebuggerd/test/tombstone_test.cpp",
210 ],
211
212 target: {
213 android: {
214 srcs: [
Josh Gaoae9d7672017-03-24 16:26:03 -0700215 "client/debuggerd_client_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700216 "debuggerd_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700217 ],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800218 static_libs: [
219 "libasync_safe",
220 "libtombstoned_client_static",
221 ],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700222 },
223 },
224
225 shared_libs: [
226 "libbacktrace",
227 "libbase",
228 "libcutils",
Josh Gaoae9d7672017-03-24 16:26:03 -0700229 "libdebuggerd_client",
Narayan Kamatha73df602017-05-24 15:07:25 +0100230 "liblog",
Josh Gaoe04ca272018-01-16 15:38:17 -0800231 "libminijail",
Elliott Hughesdc699a22018-02-16 17:58:14 -0800232 "libnativehelper",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700233 ],
234
235 static_libs: [
Josh Gao352a8452017-03-30 16:46:21 -0700236 "libdebuggerd",
Martin Stjernholmbb4f2b42018-12-19 14:28:33 +0000237 "libdexfile_external", // libunwindstack dependency
238 "libdexfile_support", // libunwindstack dependency
Josh Gao2b2ae0c2017-08-21 14:31:17 -0700239 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700240 ],
241
242 local_include_dirs: [
243 "libdebuggerd",
244 ],
245
246 compile_multilib: "both",
247 multilib: {
248 lib32: {
249 stem: "debuggerd_test32",
250 },
251 lib64: {
252 stem: "debuggerd_test64",
253 },
254 },
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700255
256 test_suites: ["device-tests"],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700257}
258
Josh Gaoa42314e2017-12-19 15:08:19 -0800259cc_benchmark {
260 name: "debuggerd_benchmark",
261 defaults: ["debuggerd_defaults"],
262 srcs: ["debuggerd_benchmark.cpp"],
263 shared_libs: [
264 "libbase",
265 "libdebuggerd_client",
266 ],
267}
268
Josh Gaocbe70cb2016-10-18 18:17:52 -0700269cc_binary {
270 name: "crash_dump",
271 srcs: [
272 "crash_dump.cpp",
273 "util.cpp",
274 ],
275 defaults: ["debuggerd_defaults"],
276
277 compile_multilib: "both",
278 multilib: {
279 lib32: {
280 suffix: "32",
281 },
282 lib64: {
283 suffix: "64",
284 },
285 },
286
Josh Gaoe73c9322017-02-08 16:06:26 -0800287 static_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100288 "libtombstoned_client_static",
Josh Gaoe73c9322017-02-08 16:06:26 -0800289 "libdebuggerd",
290 "libcutils",
291 ],
292
Josh Gaocbe70cb2016-10-18 18:17:52 -0700293 shared_libs: [
294 "libbacktrace",
295 "libbase",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700296 "liblog",
297 "libprocinfo",
Josh Gao2b2ae0c2017-08-21 14:31:17 -0700298 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700299 ],
300}
301
302cc_binary {
303 name: "debuggerd",
304 srcs: [
305 "debuggerd.cpp",
306 ],
307 defaults: ["debuggerd_defaults"],
308
309 shared_libs: [
310 "libbase",
311 "libdebuggerd_client",
312 "liblog",
Josh Gao0915f232017-06-27 14:08:05 -0700313 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700314 ],
315
316 local_include_dirs: ["include"],
317}
318
319cc_binary {
320 name: "tombstoned",
321 srcs: [
322 "util.cpp",
323 "tombstoned/intercept_manager.cpp",
324 "tombstoned/tombstoned.cpp",
325 ],
326 defaults: ["debuggerd_defaults"],
327
Narayan Kamatha73df602017-05-24 15:07:25 +0100328 header_libs: ["libdebuggerd_common_headers"],
329
Josh Gaocbe70cb2016-10-18 18:17:52 -0700330 static_libs: [
331 "libbase",
332 "libcutils",
333 "libevent",
334 "liblog",
335 ],
336
Elliott Hughesdc699a22018-02-16 17:58:14 -0800337 init_rc: ["tombstoned/tombstoned.rc"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700338}
Elliott Hughes0ba53592017-02-01 16:59:15 -0800339
340subdirs = [
341 "crasher",
342]