blob: 0b13662097c8bf926a042bdf21261259d371866f [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 ],
Josh Gao2b2ae0c2017-08-21 14:31:17 -070012 cpp_std: "gnu++17",
Josh Gaocbe70cb2016-10-18 18:17:52 -070013
14 local_include_dirs: ["include"],
15}
16
Narayan Kamatha73df602017-05-24 15:07:25 +010017cc_library_headers {
18 name: "libdebuggerd_common_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080019 export_include_dirs: ["common/include"],
Jiyong Parka0e75042018-05-24 14:11:00 +090020 recovery_available: true,
Narayan Kamatha73df602017-05-24 15:07:25 +010021}
22
Narayan Kamath2d377cd2017-05-10 10:58:59 +010023cc_library_shared {
Josh Gaoe1aa0ca2017-03-01 17:23:22 -080024 name: "libtombstoned_client",
25 defaults: ["debuggerd_defaults"],
26 srcs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +010027 "tombstoned/tombstoned_client.cpp",
28 "util.cpp",
29 ],
30
Narayan Kamatha73df602017-05-24 15:07:25 +010031 header_libs: ["libdebuggerd_common_headers"],
32
Narayan Kamath2d377cd2017-05-10 10:58:59 +010033 static_libs: [
Narayan Kamatha73df602017-05-24 15:07:25 +010034 "libasync_safe",
Narayan Kamath2d377cd2017-05-10 10:58:59 +010035 ],
36
37 shared_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +010038 "libbase",
Narayan Kamatha73df602017-05-24 15:07:25 +010039 "libcutils",
Narayan Kamath2d377cd2017-05-10 10:58:59 +010040 ],
41
Narayan Kamatha73df602017-05-24 15:07:25 +010042 export_header_lib_headers: ["libdebuggerd_common_headers"],
Elliott Hughesdc699a22018-02-16 17:58:14 -080043 export_include_dirs: ["tombstoned/include"],
Narayan Kamath2d377cd2017-05-10 10:58:59 +010044}
45
46// Utility library to tombstoned and get an output fd.
47cc_library_static {
48 name: "libtombstoned_client_static",
49 defaults: ["debuggerd_defaults"],
50 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"],
Jiyong Parka0e75042018-05-24 14:11:00 +090093 recovery_available: true,
Josh Gaoe73c9322017-02-08 16:06:26 -080094 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 Gaoe1aa0ca2017-03-01 17:23:22 -0800103// Fallback implementation.
Josh Gaoe73c9322017-02-08 16:06:26 -0800104cc_library_static {
105 name: "libdebuggerd_handler_fallback",
106 defaults: ["debuggerd_defaults"],
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",
Christopher Ferris0b06a592018-01-19 10:26:36 -0800119 "libdexfile",
Josh Gaoe73c9322017-02-08 16:06:26 -0800120 "liblzma",
121 "libcutils",
122 ],
Josh Gao9c02dc52016-06-15 17:29:00 -0700123
Josh Gaocbe70cb2016-10-18 18:17:52 -0700124 export_include_dirs: ["include"],
125}
126
127cc_library {
128 name: "libdebuggerd_client",
129 defaults: ["debuggerd_defaults"],
130 srcs: [
131 "client/debuggerd_client.cpp",
132 "util.cpp",
133 ],
134
Narayan Kamatha73df602017-05-24 15:07:25 +0100135 header_libs: ["libdebuggerd_common_headers"],
136
Josh Gaocbe70cb2016-10-18 18:17:52 -0700137 shared_libs: [
138 "libbase",
139 "libcutils",
140 ],
Josh Gaoe1aa0ca2017-03-01 17:23:22 -0800141
Narayan Kamatha73df602017-05-24 15:07:25 +0100142 export_header_lib_headers: ["libdebuggerd_common_headers"],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700143 export_include_dirs: ["include"],
144}
145
Josh Gaoe73c9322017-02-08 16:06:26 -0800146cc_library_static {
Josh Gaocbe70cb2016-10-18 18:17:52 -0700147 name: "libdebuggerd",
148 defaults: ["debuggerd_defaults"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900149 recovery_available: true,
Josh Gaocbe70cb2016-10-18 18:17:52 -0700150
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 Gaocbe70cb2016-10-18 18:17:52 -0700159 local_include_dirs: ["libdebuggerd/include"],
160 export_include_dirs: ["libdebuggerd/include"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700161
Josh Gaoe73c9322017-02-08 16:06:26 -0800162 static_libs: [
Josh Gaocbe70cb2016-10-18 18:17:52 -0700163 "libbacktrace",
Christopher Ferris9a8c8552017-08-11 15:29:19 -0700164 "libunwindstack",
Josh Gaoe73c9322017-02-08 16:06:26 -0800165 "liblzma",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700166 "libbase",
167 "libcutils",
168 "liblog",
169 ],
170}
171
172cc_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 Gaocbe70cb2016-10-18 18:17:52 -0700182 "libdebuggerd/test/tombstone_test.cpp",
183 ],
184
185 target: {
186 android: {
187 srcs: [
Josh Gaoae9d7672017-03-24 16:26:03 -0700188 "client/debuggerd_client_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700189 "debuggerd_test.cpp",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700190 ],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800191 static_libs: [
192 "libasync_safe",
193 "libtombstoned_client_static",
194 ],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700195 },
196 },
197
198 shared_libs: [
199 "libbacktrace",
200 "libbase",
201 "libcutils",
Josh Gaoae9d7672017-03-24 16:26:03 -0700202 "libdebuggerd_client",
Narayan Kamatha73df602017-05-24 15:07:25 +0100203 "liblog",
Josh Gaoe04ca272018-01-16 15:38:17 -0800204 "libminijail",
Elliott Hughesdc699a22018-02-16 17:58:14 -0800205 "libnativehelper",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700206 ],
207
208 static_libs: [
Josh Gao352a8452017-03-30 16:46:21 -0700209 "libdebuggerd",
Josh Gao2b2ae0c2017-08-21 14:31:17 -0700210 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700211 ],
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 Hughes40fdf3f2018-04-27 16:12:06 -0700226
227 test_suites: ["device-tests"],
Josh Gaocbe70cb2016-10-18 18:17:52 -0700228}
229
Josh Gaoa42314e2017-12-19 15:08:19 -0800230cc_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 Gaocbe70cb2016-10-18 18:17:52 -0700240cc_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 Gaoe73c9322017-02-08 16:06:26 -0800258 static_libs: [
Narayan Kamath2d377cd2017-05-10 10:58:59 +0100259 "libtombstoned_client_static",
Josh Gaoe73c9322017-02-08 16:06:26 -0800260 "libdebuggerd",
261 "libcutils",
262 ],
263
Josh Gaocbe70cb2016-10-18 18:17:52 -0700264 shared_libs: [
265 "libbacktrace",
266 "libbase",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700267 "liblog",
268 "libprocinfo",
Josh Gao2b2ae0c2017-08-21 14:31:17 -0700269 "libunwindstack",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700270 ],
271}
272
273cc_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 Gao0915f232017-06-27 14:08:05 -0700284 "libprocinfo",
Josh Gaocbe70cb2016-10-18 18:17:52 -0700285 ],
286
287 local_include_dirs: ["include"],
288}
289
290cc_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 Kamatha73df602017-05-24 15:07:25 +0100299 header_libs: ["libdebuggerd_common_headers"],
300
Josh Gaocbe70cb2016-10-18 18:17:52 -0700301 static_libs: [
302 "libbase",
303 "libcutils",
304 "libevent",
305 "liblog",
306 ],
307
Elliott Hughesdc699a22018-02-16 17:58:14 -0800308 init_rc: ["tombstoned/tombstoned.rc"],
Josh Gao9c02dc52016-06-15 17:29:00 -0700309}
Elliott Hughes0ba53592017-02-01 16:59:15 -0800310
311subdirs = [
312 "crasher",
313]