• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1cc_defaults {
2    name: "debuggerd_defaults",
3    cflags: [
4        "-Wall",
5        "-Wextra",
6        "-Werror",
7        "-Wno-unused-argument",
8        "-Wno-unused-function",
9        "-Wno-nullability-completeness",
10        "-Os",
11    ],
12
13    local_include_dirs: ["include"],
14}
15
16cc_library_headers {
17    name: "libdebuggerd_common_headers",
18    export_include_dirs: ["common/include"],
19    recovery_available: true,
20}
21
22cc_library_shared {
23    name: "libtombstoned_client",
24    defaults: ["debuggerd_defaults"],
25    srcs: [
26        "tombstoned/tombstoned_client.cpp",
27        "util.cpp",
28    ],
29
30    header_libs: ["libdebuggerd_common_headers"],
31
32    static_libs: [
33        "libasync_safe",
34    ],
35
36    shared_libs: [
37        "libbase",
38        "libcutils",
39    ],
40
41    export_header_lib_headers: ["libdebuggerd_common_headers"],
42    export_include_dirs: ["tombstoned/include"],
43}
44
45// Utility library to talk to tombstoned and get an output fd.
46cc_library_static {
47    name: "libtombstoned_client_static",
48    defaults: ["debuggerd_defaults"],
49    recovery_available: true,
50    srcs: [
51        "tombstoned/tombstoned_client.cpp",
52        "util.cpp",
53    ],
54
55    header_libs: ["libdebuggerd_common_headers"],
56
57    whole_static_libs: [
58        "libasync_safe",
59        "libcutils",
60        "libbase",
61    ],
62
63    export_header_lib_headers: ["libdebuggerd_common_headers"],
64    export_include_dirs: ["tombstoned/include"],
65}
66
67// Core implementation, linked into libdebuggerd_handler and the dynamic linker.
68cc_library_static {
69    name: "libdebuggerd_handler_core",
70    defaults: ["debuggerd_defaults"],
71    recovery_available: true,
72    srcs: ["handler/debuggerd_handler.cpp"],
73
74    header_libs: [
75        "libbase_headers",
76        "libdebuggerd_common_headers",
77    ],
78
79    whole_static_libs: [
80        "libasync_safe",
81        "libcutils",
82        "libdebuggerd",
83    ],
84
85    export_header_lib_headers: ["libdebuggerd_common_headers"],
86    export_include_dirs: ["include"],
87}
88
89// Implementation with a no-op fallback.
90cc_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
102// Fallback implementation.
103cc_library_static {
104    name: "libdebuggerd_handler_fallback",
105    defaults: ["debuggerd_defaults"],
106    recovery_available: true,
107    srcs: [
108        "handler/debuggerd_fallback.cpp",
109    ],
110
111    whole_static_libs: [
112        "libdebuggerd_handler_core",
113        "libtombstoned_client_static",
114        "libasync_safe",
115        "libbase",
116        "libdebuggerd",
117        "libunwindstack",
118        "libdexfile_support_static",  // libunwindstack dependency
119        "liblzma",
120        "libcutils",
121    ],
122    target: {
123        recovery: {
124            exclude_static_libs: [
125                "libdexfile_support_static",
126            ],
127        },
128    },
129
130    export_include_dirs: ["include"],
131}
132
133cc_library {
134    name: "libdebuggerd_client",
135    defaults: ["debuggerd_defaults"],
136    srcs: [
137        "client/debuggerd_client.cpp",
138        "util.cpp",
139    ],
140
141    header_libs: ["libdebuggerd_common_headers"],
142
143    shared_libs: [
144        "libbase",
145        "libcutils",
146        "libprocinfo",
147    ],
148
149    export_header_lib_headers: ["libdebuggerd_common_headers"],
150    export_include_dirs: ["include"],
151}
152
153cc_library_static {
154    name: "libdebuggerd",
155    defaults: ["debuggerd_defaults"],
156    recovery_available: true,
157
158    srcs: [
159        "libdebuggerd/backtrace.cpp",
160        "libdebuggerd/open_files_list.cpp",
161        "libdebuggerd/tombstone.cpp",
162        "libdebuggerd/utility.cpp",
163    ],
164
165    local_include_dirs: ["libdebuggerd/include"],
166    export_include_dirs: ["libdebuggerd/include"],
167
168    // Needed for private/bionic_fdsan.h
169    include_dirs: ["bionic/libc"],
170
171    static_libs: [
172        "libdexfile_support_static",  // libunwindstack dependency
173        "libunwindstack",
174        "liblzma",
175        "libbase",
176        "libcutils",
177        "liblog",
178    ],
179    target: {
180        recovery: {
181            exclude_static_libs: [
182                "libdexfile_support_static",
183            ],
184        },
185    },
186
187    product_variables: {
188        debuggable: {
189            cflags: ["-DROOT_POSSIBLE"],
190        },
191    },
192}
193
194cc_test {
195    name: "debuggerd_test",
196    defaults: ["debuggerd_defaults"],
197
198    cflags: ["-Wno-missing-field-initializers"],
199    srcs: [
200        "libdebuggerd/test/dump_memory_test.cpp",
201        "libdebuggerd/test/elf_fake.cpp",
202        "libdebuggerd/test/log_fake.cpp",
203        "libdebuggerd/test/open_files_list_test.cpp",
204        "libdebuggerd/test/tombstone_test.cpp",
205    ],
206
207    target: {
208        android: {
209            srcs: [
210                "client/debuggerd_client_test.cpp",
211                "debuggerd_test.cpp",
212            ],
213            static_libs: [
214                "libasync_safe",
215                "libtombstoned_client_static",
216            ],
217        },
218    },
219
220    shared_libs: [
221        "libbase",
222        "libcutils",
223        "libdebuggerd_client",
224        "liblog",
225        "libminijail",
226        "libnativehelper",
227        "libunwindstack",
228    ],
229
230    static_libs: [
231        "libdebuggerd",
232    ],
233
234    local_include_dirs: [
235        "libdebuggerd",
236    ],
237
238    compile_multilib: "both",
239    multilib: {
240        lib32: {
241            stem: "debuggerd_test32",
242        },
243        lib64: {
244            stem: "debuggerd_test64",
245        },
246    },
247
248    test_suites: ["device-tests"],
249}
250
251cc_benchmark {
252    name: "debuggerd_benchmark",
253    defaults: ["debuggerd_defaults"],
254    srcs: ["debuggerd_benchmark.cpp"],
255    shared_libs: [
256        "libbase",
257        "libdebuggerd_client",
258    ],
259}
260
261cc_binary {
262    name: "crash_dump",
263    srcs: [
264        "crash_dump.cpp",
265        "util.cpp",
266    ],
267    defaults: ["debuggerd_defaults"],
268
269    compile_multilib: "both",
270    multilib: {
271        lib32: {
272            suffix: "32",
273        },
274        lib64: {
275            suffix: "64",
276        },
277    },
278
279    static_libs: [
280        "libtombstoned_client_static",
281        "libdebuggerd",
282        "libcutils",
283    ],
284
285    shared_libs: [
286        "libbase",
287        "liblog",
288        "libprocinfo",
289        "libunwindstack",
290    ],
291}
292
293cc_binary {
294    name: "debuggerd",
295    srcs: [
296        "debuggerd.cpp",
297    ],
298    defaults: ["debuggerd_defaults"],
299
300    shared_libs: [
301        "libbase",
302        "libdebuggerd_client",
303        "liblog",
304        "libprocinfo",
305    ],
306
307    local_include_dirs: ["include"],
308}
309
310cc_binary {
311    name: "tombstoned",
312    srcs: [
313        "util.cpp",
314        "tombstoned/intercept_manager.cpp",
315        "tombstoned/tombstoned.cpp",
316    ],
317    defaults: ["debuggerd_defaults"],
318
319    header_libs: ["libdebuggerd_common_headers"],
320
321    static_libs: [
322        "libbase",
323        "libcutils",
324        "libevent",
325        "liblog",
326    ],
327
328    init_rc: ["tombstoned/tombstoned.rc"],
329}
330
331subdirs = [
332    "crasher",
333]
334