blob: 99d40a6108991a24ad86cde80182b2ad2ddca818 [file] [log] [blame]
Artem Titov739351d2018-05-11 12:21:36 +02001# Copyright 2014 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/symlink.gni")
6import("//testing/libfuzzer/fuzzer_test.gni")
7import("//testing/test.gni")
8
9if (is_win) {
10 import("//build/config/win/visual_studio_version.gni")
11}
12
13config("tools_config") {
14 include_dirs = [
15 "breakpad/src",
16 "breakpad/src/third_party",
17 ]
18 if (is_android) {
19 defines = [ "__ANDROID__" ]
20 }
21 if (is_clang) {
22 cflags = [ "-Wno-tautological-constant-out-of-range-compare" ]
23 }
24}
25
26config("internal_config") {
27 include_dirs = [ "breakpad/src" ]
28 defines = []
29 if (is_debug) {
30 # This is needed for GTMLogger to work correctly.
31 defines += [ "DEBUG" ]
32 }
33 if (is_android) {
34 defines += [ "__ANDROID__" ]
35 }
36}
37
38config("client_config") {
39 include_dirs = [ "breakpad/src" ]
40 if (is_android) {
41 include_dirs += [ "breakpad/src/common/android/include" ]
42 }
43 if (is_chromeos) {
44 defines = [ "__CHROMEOS__" ]
45 }
46}
47
48config("handler_config") {
49 include_dirs = [ "breakpad/src" ]
50}
51
52config("sender_config") {
53 include_dirs = [ "breakpad/src" ]
54}
55
56config("breakpad_unittest_config") {
57 # One of the breakpad unit tests test that we can detect the proper build-id.
58 # We must override the build-id for this one target.
59 ldflags = [ "-Wl,--build-id=0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" ]
60}
61
62# {micro,mini}dump_stackwalk and minidump_dump are tool-type executables
63# that do not build on Windows.
64if (!is_win) {
65 if (current_toolchain == host_toolchain) {
66 # Contains the code shared by both {micro,mini}dump_stackwalk.
67 static_library("stackwalk_common") {
68 # Always want these files included regardless of platform.
69 set_sources_assignment_filter([])
70 sources = [
71 "breakpad/src/common/path_helper.cc",
72 "breakpad/src/common/path_helper.h",
73 "breakpad/src/processor/basic_code_module.h",
74 "breakpad/src/processor/basic_code_modules.cc",
75 "breakpad/src/processor/basic_code_modules.h",
76 "breakpad/src/processor/basic_source_line_resolver.cc",
77 "breakpad/src/processor/call_stack.cc",
78 "breakpad/src/processor/cfi_frame_info.cc",
79 "breakpad/src/processor/cfi_frame_info.h",
80 "breakpad/src/processor/disassembler_x86.cc",
81 "breakpad/src/processor/disassembler_x86.h",
82 "breakpad/src/processor/dump_context.cc",
83 "breakpad/src/processor/dump_object.cc",
84 "breakpad/src/processor/logging.cc",
85 "breakpad/src/processor/logging.h",
86 "breakpad/src/processor/pathname_stripper.cc",
87 "breakpad/src/processor/pathname_stripper.h",
88 "breakpad/src/processor/proc_maps_linux.cc",
89 "breakpad/src/processor/process_state.cc",
90 "breakpad/src/processor/simple_symbol_supplier.cc",
91 "breakpad/src/processor/simple_symbol_supplier.h",
92 "breakpad/src/processor/source_line_resolver_base.cc",
93 "breakpad/src/processor/stack_frame_cpu.cc",
94 "breakpad/src/processor/stack_frame_symbolizer.cc",
95 "breakpad/src/processor/stackwalk_common.cc",
96 "breakpad/src/processor/stackwalker.cc",
97 "breakpad/src/processor/stackwalker_amd64.cc",
98 "breakpad/src/processor/stackwalker_amd64.h",
99 "breakpad/src/processor/stackwalker_arm.cc",
100 "breakpad/src/processor/stackwalker_arm.h",
101 "breakpad/src/processor/stackwalker_arm64.cc",
102 "breakpad/src/processor/stackwalker_arm64.h",
103 "breakpad/src/processor/stackwalker_mips.cc",
104 "breakpad/src/processor/stackwalker_mips.h",
105 "breakpad/src/processor/stackwalker_ppc.cc",
106 "breakpad/src/processor/stackwalker_ppc.h",
107 "breakpad/src/processor/stackwalker_ppc64.cc",
108 "breakpad/src/processor/stackwalker_ppc64.h",
109 "breakpad/src/processor/stackwalker_sparc.cc",
110 "breakpad/src/processor/stackwalker_sparc.h",
111 "breakpad/src/processor/stackwalker_x86.cc",
112 "breakpad/src/processor/stackwalker_x86.h",
113 "breakpad/src/processor/tokenize.cc",
114 "breakpad/src/processor/tokenize.h",
115
116 # libdisasm
117 "breakpad/src/third_party/libdisasm/ia32_implicit.c",
118 "breakpad/src/third_party/libdisasm/ia32_implicit.h",
119 "breakpad/src/third_party/libdisasm/ia32_insn.c",
120 "breakpad/src/third_party/libdisasm/ia32_insn.h",
121 "breakpad/src/third_party/libdisasm/ia32_invariant.c",
122 "breakpad/src/third_party/libdisasm/ia32_invariant.h",
123 "breakpad/src/third_party/libdisasm/ia32_modrm.c",
124 "breakpad/src/third_party/libdisasm/ia32_modrm.h",
125 "breakpad/src/third_party/libdisasm/ia32_opcode_tables.c",
126 "breakpad/src/third_party/libdisasm/ia32_opcode_tables.h",
127 "breakpad/src/third_party/libdisasm/ia32_operand.c",
128 "breakpad/src/third_party/libdisasm/ia32_operand.h",
129 "breakpad/src/third_party/libdisasm/ia32_reg.c",
130 "breakpad/src/third_party/libdisasm/ia32_reg.h",
131 "breakpad/src/third_party/libdisasm/ia32_settings.c",
132 "breakpad/src/third_party/libdisasm/ia32_settings.h",
133 "breakpad/src/third_party/libdisasm/libdis.h",
134 "breakpad/src/third_party/libdisasm/qword.h",
135 "breakpad/src/third_party/libdisasm/x86_disasm.c",
136 "breakpad/src/third_party/libdisasm/x86_format.c",
137 "breakpad/src/third_party/libdisasm/x86_imm.c",
138 "breakpad/src/third_party/libdisasm/x86_imm.h",
139 "breakpad/src/third_party/libdisasm/x86_insn.c",
140 "breakpad/src/third_party/libdisasm/x86_misc.c",
141 "breakpad/src/third_party/libdisasm/x86_operand_list.c",
142 "breakpad/src/third_party/libdisasm/x86_operand_list.h",
143 ]
144
145 defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" ]
146
147 configs -= [ "//build/config/compiler:chromium_code" ]
148 configs += [ "//build/config/compiler:no_chromium_code" ]
149 configs += [ ":tools_config" ]
150 }
151
152 fuzzer_test("minidump_fuzzer") {
153 sources = [
154 "breakpad/src/processor/exploitability.cc",
155 "breakpad/src/processor/minidump.cc",
156 "breakpad/src/processor/minidump_processor.cc",
157 "minidump_fuzzer.cc",
158 ]
159
160 deps = [
161 ":stackwalk_common",
162 "//base",
163 ]
164
165 defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" ]
166 include_dirs = [ "breakpad/src" ]
167
168 libfuzzer_options = [
169 "close_fd_mask=3",
170 "max_len=128000",
171 ]
172
173 # Always want these files included regardless of platform.
174 set_sources_assignment_filter([])
175 sources += [
176 "breakpad/src/processor/exploitability_linux.cc",
177 "breakpad/src/processor/exploitability_linux.h",
178 "breakpad/src/processor/exploitability_win.cc",
179 "breakpad/src/processor/exploitability_win.h",
180 "breakpad/src/processor/symbolic_constants_win.cc",
181 "breakpad/src/processor/symbolic_constants_win.h",
182 ]
183 }
184
185 executable("microdump_stackwalk") {
186 sources = [
187 "breakpad/src/processor/microdump.cc",
188 "breakpad/src/processor/microdump_processor.cc",
189 "breakpad/src/processor/microdump_stackwalk.cc",
190 ]
191
192 deps = [
193 ":stackwalk_common",
194 "//build/config:exe_and_shlib_deps",
195 ]
196
197 defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" ]
198
199 configs -= [ "//build/config/compiler:chromium_code" ]
200 configs += [ "//build/config/compiler:no_chromium_code" ]
201 configs += [ ":tools_config" ]
202 }
203
204 executable("minidump_stackwalk") {
205 sources = [
206 "breakpad/src/processor/exploitability.cc",
207 "breakpad/src/processor/minidump.cc",
208 "breakpad/src/processor/minidump_processor.cc",
209 "breakpad/src/processor/minidump_stackwalk.cc",
210 ]
211
212 deps = [
213 ":stackwalk_common",
214 "//build/config:exe_and_shlib_deps",
215 ]
216
217 defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" ]
218
219 configs -= [ "//build/config/compiler:chromium_code" ]
220 configs += [ "//build/config/compiler:no_chromium_code" ]
221 configs += [ ":tools_config" ]
222
223 # Always want these files included regardless of platform.
224 set_sources_assignment_filter([])
225 sources += [
226 "breakpad/src/processor/exploitability_linux.cc",
227 "breakpad/src/processor/exploitability_linux.h",
228 "breakpad/src/processor/exploitability_win.cc",
229 "breakpad/src/processor/exploitability_win.h",
230 "breakpad/src/processor/symbolic_constants_win.cc",
231 "breakpad/src/processor/symbolic_constants_win.h",
232 ]
233 }
234
235 executable("minidump_dump") {
236 set_sources_assignment_filter([])
237 sources = [
238 "breakpad/src/processor/basic_code_module.h",
239 "breakpad/src/processor/basic_code_modules.cc",
240 "breakpad/src/processor/basic_code_modules.h",
241 "breakpad/src/processor/dump_context.cc",
242 "breakpad/src/processor/dump_object.cc",
243 "breakpad/src/processor/logging.cc",
244 "breakpad/src/processor/logging.h",
245 "breakpad/src/processor/minidump.cc",
246 "breakpad/src/processor/minidump_dump.cc",
247 "breakpad/src/processor/pathname_stripper.cc",
248 "breakpad/src/processor/pathname_stripper.h",
249 "breakpad/src/processor/proc_maps_linux.cc",
250 ]
251
252 configs += [ ":tools_config" ]
253
254 # There are some warnings in this code.
255 configs -= [ "//build/config/compiler:chromium_code" ]
256 configs += [ "//build/config/compiler:no_chromium_code" ]
257
258 deps = [
259 "//build/config:exe_and_shlib_deps",
260 ]
261 }
262 } else {
263 # Aliases for convenience.
264 binary_symlink("microdump_stackwalk") {
265 binary_label = ":$target_name($host_toolchain)"
266 }
267 binary_symlink("minidump_stackwalk") {
268 binary_label = ":$target_name($host_toolchain)"
269 }
270 binary_symlink("minidump_dump") {
271 binary_label = ":$target_name($host_toolchain)"
272 }
273 }
274}
275
276# Mac --------------------------------------------------------------------------
277
278if (is_mac) {
279 if (current_toolchain == host_toolchain) {
280 executable("dump_syms") {
281 sources = [
282 "breakpad/src/common/dwarf/bytereader.cc",
283 "breakpad/src/common/dwarf/dwarf2diehandler.cc",
284 "breakpad/src/common/dwarf/dwarf2reader.cc",
285 "breakpad/src/common/dwarf/elf_reader.cc",
286 "breakpad/src/common/dwarf/elf_reader.h",
287 "breakpad/src/common/dwarf_cfi_to_module.cc",
288 "breakpad/src/common/dwarf_cu_to_module.cc",
289 "breakpad/src/common/dwarf_line_to_module.cc",
290 "breakpad/src/common/language.cc",
291 "breakpad/src/common/mac/arch_utilities.cc",
292 "breakpad/src/common/mac/arch_utilities.h",
293 "breakpad/src/common/mac/dump_syms.cc",
294 "breakpad/src/common/mac/file_id.cc",
295 "breakpad/src/common/mac/macho_id.cc",
296 "breakpad/src/common/mac/macho_reader.cc",
297 "breakpad/src/common/mac/macho_utilities.cc",
298 "breakpad/src/common/mac/macho_walker.cc",
299 "breakpad/src/common/md5.cc",
300 "breakpad/src/common/module.cc",
301 "breakpad/src/common/path_helper.cc",
302 "breakpad/src/common/path_helper.h",
303 "breakpad/src/common/stabs_reader.cc",
304 "breakpad/src/common/stabs_to_module.cc",
305 "breakpad/src/tools/mac/dump_syms/dump_syms_tool.cc",
306 ]
307
308 # For breakpad/src/common/stabs_reader.h.
309 defines = [ "HAVE_MACH_O_NLIST_H" ]
310 include_dirs = [ "breakpad/src/common/mac" ]
311
312 # The DWARF utilities require -funsigned-char.
313 cflags = [ "-funsigned-char" ]
314
315 configs += [ ":internal_config" ]
316
317 configs -= [ "//build/config/compiler:chromium_code" ]
318 configs += [ "//build/config/compiler:no_chromium_code" ]
319
320 # dwarf2reader.cc uses dynamic_cast.
321 configs -= [ "//build/config/compiler:no_rtti" ]
322 configs += [ "//build/config/compiler:rtti" ]
323
324 libs = [ "Foundation.framework" ]
325
326 if (!is_debug) {
327 # dump_syms crashes when built at -O1, -O2, and -O3. It does
328 # not crash at -Os. To play it safe, dump_syms is always built
329 # at -O0 until this can be sorted out.
330 # https://crbug.com/google-breakpad/329
331 configs -= [ "//build/config/compiler:default_optimization" ]
332 cflags += [ "-O0" ]
333 }
334
335 deps = [
336 "//build/config:exe_and_shlib_deps",
337 ]
338 }
339
340 executable("symupload") {
341 sources = [
342 "breakpad/src/common/mac/HTTPMultipartUpload.m",
343 "breakpad/src/tools/mac/symupload/symupload.m",
344 ]
345
346 include_dirs = [ "breakpad/src/common/mac" ]
347
348 libs = [ "Foundation.framework" ]
349
350 configs -= [ "//build/config/compiler:chromium_code" ]
351 configs += [ "//build/config/compiler:no_chromium_code" ]
352
353 deps = [
354 "//build/config:exe_and_shlib_deps",
355 ]
356 }
357 } else {
358 binary_symlink("dump_syms") {
359 binary_label = ":$target_name($host_toolchain)"
360 }
361 binary_symlink("symupload") {
362 binary_label = ":$target_name($host_toolchain)"
363 }
364 }
365}
366
367if (is_ios) {
368 binary_symlink("dump_syms") {
369 binary_label = ":$target_name($host_toolchain)"
370 }
371 binary_symlink("symupload") {
372 binary_label = ":$target_name($host_toolchain)"
373 }
374}
375
376if (is_mac) {
377 static_library("utilities") {
378 sources = [
379 "breakpad/src/client/mac/crash_generation/ConfigFile.mm",
380 "breakpad/src/client/mac/handler/breakpad_nlist_64.cc",
381 "breakpad/src/client/mac/handler/dynamic_images.cc",
382 "breakpad/src/client/mac/handler/minidump_generator.cc",
383 "breakpad/src/client/minidump_file_writer.cc",
384 "breakpad/src/common/convert_UTF.c",
385 "breakpad/src/common/mac/MachIPC.mm",
386 "breakpad/src/common/mac/arch_utilities.cc",
387 "breakpad/src/common/mac/bootstrap_compat.cc",
388 "breakpad/src/common/mac/file_id.cc",
389 "breakpad/src/common/mac/launch_reporter.cc",
390 "breakpad/src/common/mac/macho_id.cc",
391 "breakpad/src/common/mac/macho_utilities.cc",
392 "breakpad/src/common/mac/macho_walker.cc",
393 "breakpad/src/common/mac/string_utilities.cc",
394 "breakpad/src/common/md5.cc",
395 "breakpad/src/common/simple_string_dictionary.cc",
396 "breakpad/src/common/string_conversion.cc",
397 ]
398
399 configs += [ ":internal_config" ]
400
401 # There are some warnings in this code.
402 configs -= [ "//build/config/compiler:chromium_code" ]
403 configs += [ "//build/config/compiler:no_chromium_code" ]
404 }
405
406 executable("crash_inspector") {
407 sources = [
408 "breakpad/src/client/mac/crash_generation/Inspector.mm",
409 "breakpad/src/client/mac/crash_generation/InspectorMain.mm",
410 ]
411
412 # TODO(GYP): 'mac_real_dsym': 1,
413
414 include_dirs = [
415 "breakpad/src/client/apple/Framework",
416 "breakpad/src/common/mac",
417 "breakpad/src",
418 ]
419 libs = [
420 "CoreServices.framework",
421 "Foundation.framework",
422 ]
423
424 deps = [
425 ":utilities",
426 "//build/config:exe_and_shlib_deps",
427 ]
428 }
429
430 # TODO(GYP) this target has some mac_bundle_resources stuff.
431 # executable("crash_report_sender") {
432 # }
433 group("crash_report_sender") {
434 }
435
436 config("breakpad_config") {
437 include_dirs = [ "breakpad/src/client/apple/Framework" ]
438 }
439
440 static_library("breakpad") {
441 sources = [
442 "breakpad/src/client/mac/Framework/Breakpad.mm",
443 "breakpad/src/client/mac/Framework/OnDemandServer.mm",
444 "breakpad/src/client/mac/crash_generation/crash_generation_client.cc",
445 "breakpad/src/client/mac/crash_generation/crash_generation_client.h",
446 "breakpad/src/client/mac/handler/exception_handler.cc",
447 "breakpad/src/client/mac/handler/protected_memory_allocator.cc",
448 ]
449
450 configs += [ ":internal_config" ]
451 public_configs = [ ":breakpad_config" ]
452
453 defines = [ "USE_PROTECTED_ALLOCATIONS=1" ]
454 include_dirs = [ "breakpad/src/client/apple/Framework" ]
455
456 deps = [
457 ":crash_inspector",
458 ":crash_report_sender",
459 ":utilities",
460 ]
461 }
462
463 group("client") {
464 public_configs = [ ":client_config" ]
465 }
466}
467
468if (is_linux || is_android) {
469 if (current_toolchain == host_toolchain) {
470 executable("symupload") {
471 sources = [
472 "breakpad/src/common/linux/http_upload.cc",
473 "breakpad/src/common/linux/http_upload.h",
474 "breakpad/src/common/linux/symbol_upload.cc",
475 "breakpad/src/common/linux/symbol_upload.h",
476 "breakpad/src/tools/linux/symupload/sym_upload.cc",
477 ]
478
479 include_dirs = [
480 "breakpad/src",
481 "breakpad/src/third_party",
482 ]
483
484 configs += [ ":tools_config" ]
485
486 libs = [ "dl" ]
487
488 deps = [
489 "//build/config:exe_and_shlib_deps",
490 ]
491 }
492
493 # dump_syms is a host tool, so only compile it for the host system.
494 executable("dump_syms") {
495 sources = [
496 "breakpad/src/common/dwarf/bytereader.cc",
497 "breakpad/src/common/dwarf/dwarf2diehandler.cc",
498 "breakpad/src/common/dwarf/dwarf2reader.cc",
499 "breakpad/src/common/dwarf/elf_reader.cc",
500 "breakpad/src/common/dwarf/elf_reader.h",
501 "breakpad/src/common/dwarf_cfi_to_module.cc",
502 "breakpad/src/common/dwarf_cfi_to_module.h",
503 "breakpad/src/common/dwarf_cu_to_module.cc",
504 "breakpad/src/common/dwarf_cu_to_module.h",
505 "breakpad/src/common/dwarf_line_to_module.cc",
506 "breakpad/src/common/dwarf_line_to_module.h",
507 "breakpad/src/common/language.cc",
508 "breakpad/src/common/language.h",
509 "breakpad/src/common/linux/crc32.cc",
510 "breakpad/src/common/linux/crc32.h",
511 "breakpad/src/common/linux/dump_symbols.cc",
512 "breakpad/src/common/linux/dump_symbols.h",
513 "breakpad/src/common/linux/elf_symbols_to_module.cc",
514 "breakpad/src/common/linux/elf_symbols_to_module.h",
515 "breakpad/src/common/linux/elfutils.cc",
516 "breakpad/src/common/linux/elfutils.h",
517 "breakpad/src/common/linux/file_id.cc",
518 "breakpad/src/common/linux/file_id.h",
519 "breakpad/src/common/linux/guid_creator.h",
520 "breakpad/src/common/linux/linux_libc_support.cc",
521 "breakpad/src/common/linux/linux_libc_support.h",
522 "breakpad/src/common/linux/memory_mapped_file.cc",
523 "breakpad/src/common/linux/memory_mapped_file.h",
524 "breakpad/src/common/module.cc",
525 "breakpad/src/common/module.h",
526 "breakpad/src/common/path_helper.cc",
527 "breakpad/src/common/path_helper.h",
528 "breakpad/src/common/stabs_reader.cc",
529 "breakpad/src/common/stabs_reader.h",
530 "breakpad/src/common/stabs_to_module.cc",
531 "breakpad/src/common/stabs_to_module.h",
532 "breakpad/src/tools/linux/dump_syms/dump_syms.cc",
533 ]
534
535 # There are some warnings in this code.
536 configs -= [ "//build/config/compiler:chromium_code" ]
537 configs += [ "//build/config/compiler:no_chromium_code" ]
538
539 # dwarf2reader.cc uses dynamic_cast. Because we don't typically
540 # don't support RTTI, we enable it for this single target. Since
541 # dump_syms doesn't share any object files with anything else,
542 # this doesn't end up polluting Chrome itself.
543 configs -= [ "//build/config/compiler:no_rtti" ]
544 configs += [ "//build/config/compiler:rtti" ]
545
546 # Breakpad rev 583 introduced this flag.
547 # Using this define, stabs_reader.h will include a.out.h to
548 # build on Linux.
549 defines = [ "HAVE_A_OUT_H" ]
550
551 include_dirs = [ "breakpad/src" ]
552
553 deps = [
554 "//build/config:exe_and_shlib_deps",
555 ]
556 }
557 } else {
558 # Aliases for convenience.
559 binary_symlink("dump_syms") {
560 binary_label = ":dump_syms($host_toolchain)"
561 }
562 binary_symlink("symupload") {
563 binary_label = ":symupload($host_toolchain)"
564 }
565 }
566
567 static_library("client") {
568 # Want all these sources for both Linux and Android.
569 set_sources_assignment_filter([])
570 sources = [
571 "breakpad/src/client/linux/crash_generation/crash_generation_client.cc",
572 "breakpad/src/client/linux/crash_generation/crash_generation_client.h",
573 "breakpad/src/client/linux/dump_writer_common/mapping_info.h",
574 "breakpad/src/client/linux/dump_writer_common/thread_info.cc",
575 "breakpad/src/client/linux/dump_writer_common/thread_info.h",
576 "breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc",
577 "breakpad/src/client/linux/dump_writer_common/ucontext_reader.h",
578 "breakpad/src/client/linux/handler/exception_handler.cc",
579 "breakpad/src/client/linux/handler/exception_handler.h",
580 "breakpad/src/client/linux/handler/minidump_descriptor.cc",
581 "breakpad/src/client/linux/handler/minidump_descriptor.h",
582 "breakpad/src/client/linux/log/log.cc",
583 "breakpad/src/client/linux/log/log.h",
584 "breakpad/src/client/linux/microdump_writer/microdump_writer.cc",
585 "breakpad/src/client/linux/microdump_writer/microdump_writer.h",
586 "breakpad/src/client/linux/minidump_writer/cpu_set.h",
587 "breakpad/src/client/linux/minidump_writer/directory_reader.h",
588 "breakpad/src/client/linux/minidump_writer/line_reader.h",
589 "breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc",
590 "breakpad/src/client/linux/minidump_writer/linux_core_dumper.h",
591 "breakpad/src/client/linux/minidump_writer/linux_dumper.cc",
592 "breakpad/src/client/linux/minidump_writer/linux_dumper.h",
593 "breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc",
594 "breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.h",
595 "breakpad/src/client/linux/minidump_writer/minidump_writer.cc",
596 "breakpad/src/client/linux/minidump_writer/minidump_writer.h",
597 "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h",
598 "breakpad/src/client/minidump_file_writer-inl.h",
599 "breakpad/src/client/minidump_file_writer.cc",
600 "breakpad/src/client/minidump_file_writer.h",
601 "breakpad/src/common/convert_UTF.c",
602 "breakpad/src/common/convert_UTF.h",
603 "breakpad/src/common/linux/elf_core_dump.cc",
604 "breakpad/src/common/linux/elf_core_dump.h",
605 "breakpad/src/common/linux/elfutils.cc",
606 "breakpad/src/common/linux/elfutils.h",
607 "breakpad/src/common/linux/file_id.cc",
608 "breakpad/src/common/linux/file_id.h",
609 "breakpad/src/common/linux/google_crashdump_uploader.cc",
610 "breakpad/src/common/linux/google_crashdump_uploader.h",
611 "breakpad/src/common/linux/guid_creator.cc",
612 "breakpad/src/common/linux/guid_creator.h",
613 "breakpad/src/common/linux/libcurl_wrapper.cc",
614 "breakpad/src/common/linux/libcurl_wrapper.h",
615 "breakpad/src/common/linux/linux_libc_support.cc",
616 "breakpad/src/common/linux/linux_libc_support.h",
617 "breakpad/src/common/linux/memory_mapped_file.cc",
618 "breakpad/src/common/linux/memory_mapped_file.h",
619 "breakpad/src/common/linux/safe_readlink.cc",
620 "breakpad/src/common/linux/safe_readlink.h",
621 "breakpad/src/common/memory_allocator.h",
622 "breakpad/src/common/simple_string_dictionary.cc",
623 "breakpad/src/common/simple_string_dictionary.h",
624 "breakpad/src/common/string_conversion.cc",
625 "breakpad/src/common/string_conversion.h",
626 ]
627
628 configs -= [ "//build/config/compiler:chromium_code" ]
629 configs += [ "//build/config/compiler:no_chromium_code" ]
630 public_configs = [ ":client_config" ]
631
632 if (current_cpu == "arm" && is_chromeos) {
633 # Avoid running out of registers in
634 # linux_syscall_support.h:sys_clone()'s inline assembly.
635 cflags = [ "-marm" ]
636 }
637
638 # Clang's -mstackrealign doesn't work well with
639 # linux_syscall_support.h hand written asm syscalls.
640 # See https://crbug.com/556393
641 configs -= [ "//build/config/compiler:clang_stackrealign" ]
642
643 if (is_android) {
644 sources += [ "breakpad/src/common/android/breakpad_getcontext.S" ]
645 }
646
647 libs = [ "dl" ]
648
649 include_dirs = [
650 ".",
651 "breakpad/src",
652 "breakpad/src/client",
653 "breakpad/src/third_party/linux/include",
654 ]
655 }
656
657 static_library("processor_support") {
658 set_sources_assignment_filter([])
659 sources = [
660 "breakpad/src/common/scoped_ptr.h",
661 "breakpad/src/processor/basic_code_modules.cc",
662 "breakpad/src/processor/basic_code_modules.h",
663 "breakpad/src/processor/dump_context.cc",
664 "breakpad/src/processor/dump_object.cc",
665 "breakpad/src/processor/logging.cc",
666 "breakpad/src/processor/logging.h",
667 "breakpad/src/processor/minidump.cc",
668 "breakpad/src/processor/pathname_stripper.cc",
669 "breakpad/src/processor/pathname_stripper.h",
670 "breakpad/src/processor/proc_maps_linux.cc",
671 ]
672
673 include_dirs = [
674 "breakpad/src",
675 "breakpad/src/client",
676 "breakpad/src/third_party/linux/include",
677 ".",
678 ]
679
680 # There are some warnings in this code.
681 configs -= [ "//build/config/compiler:chromium_code" ]
682 configs += [ "//build/config/compiler:no_chromium_code" ]
683 }
684
685 test("breakpad_unittests") {
686 set_sources_assignment_filter([])
687 sources = [
688 "breakpad/src/client/linux/handler/exception_handler_unittest.cc",
689 "breakpad/src/client/linux/minidump_writer/cpu_set_unittest.cc",
690 "breakpad/src/client/linux/minidump_writer/directory_reader_unittest.cc",
691 "breakpad/src/client/linux/minidump_writer/line_reader_unittest.cc",
692 "breakpad/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc",
693 "breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc",
694 "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc",
695 "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
696 "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
697 "breakpad/src/common/linux/elf_core_dump_unittest.cc",
698 "breakpad/src/common/linux/file_id_unittest.cc",
699 "breakpad/src/common/linux/linux_libc_support_unittest.cc",
700 "breakpad/src/common/linux/synth_elf.cc",
701 "breakpad/src/common/linux/tests/auto_testfile.h",
702 "breakpad/src/common/linux/tests/crash_generator.cc",
703 "breakpad/src/common/linux/tests/crash_generator.h",
704 "breakpad/src/common/memory_allocator_unittest.cc",
705 "breakpad/src/common/memory_range.h",
706 "breakpad/src/common/simple_string_dictionary_unittest.cc",
707 "breakpad/src/common/test_assembler.cc",
708 "breakpad/src/common/tests/file_utils.cc",
709 "breakpad/src/common/tests/file_utils.h",
710 "breakpad/src/tools/linux/md2core/minidump_memory_range.h",
711 "breakpad/src/tools/linux/md2core/minidump_memory_range_unittest.cc",
712 "linux/breakpad_googletest_includes.h",
713 ]
714
715 deps = [
716 ":client",
717 ":processor_support",
718 "//build/config:exe_and_shlib_deps",
719 "//testing/gmock",
720 "//testing/gtest",
721 "//testing/gtest:gtest_main",
722 ]
723
724 data_deps = [
725 ":linux_dumper_unittest_helper",
726 ]
727
728 include_dirs = [
729 "linux", # Use our copy of breakpad_googletest_includes.h
730 ".",
731 ]
732
733 # There are some warnings in this code.
734 configs -= [ "//build/config/compiler:chromium_code" ]
735 configs += [
736 ":client_config",
737 "//build/config/compiler:no_chromium_code",
738 ]
739
740 if (is_clang) {
741 # See https://crbug.com/138571#c18
742 cflags = [ "-Wno-unused-value" ]
743 }
744
745 if (is_android) {
746 use_raw_android_executable = true
747 sources +=
748 [ "breakpad/src/common/android/breakpad_getcontext_unittest.cc" ]
749 libs = [ "log" ]
750 extra_dist_files = [ "$root_out_dir/linux_dumper_unittest_helper" ]
751 }
752
753 # Clang's -mstackrealign doesn't work well with
754 # linux_syscall_support.h hand written asm syscalls.
755 # See https://crbug.com/556393
756 configs -= [ "//build/config/compiler:clang_stackrealign" ]
757
758 # Add the breakpad unittest config at the end to override all configs.
759 configs += [ ":breakpad_unittest_config" ]
760 }
761
762 executable("linux_dumper_unittest_helper") {
763 set_sources_assignment_filter([])
764 testonly = true
765 sources = [
766 "breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc",
767 ]
768 deps = [
769 ":processor_support",
770 "//build/config:exe_and_shlib_deps",
771 ]
772
773 configs += [ ":client_config" ]
774
775 if (is_component_build) {
776 ldflags = [ "-Wl,-rpath,\$ORIGIN" ]
777 }
778 }
779
780 executable("generate_test_dump") {
781 set_sources_assignment_filter([])
782 testonly = true
783 sources = [
784 "linux/generate-test-dump.cc",
785 ]
786
787 # This file has an unused variable warning.
788 configs -= [ "//build/config/compiler:chromium_code" ]
789 configs += [
790 ":client_config",
791 "//build/config/compiler:no_chromium_code",
792 ]
793
794 deps = [
795 ":client",
796 "//build/config:exe_and_shlib_deps",
797 ]
798
799 if (is_android) {
800 libs = [ "log" ]
801 }
802 }
803
804 executable("minidump-2-core") {
805 set_sources_assignment_filter([])
806 sources = [
807 "breakpad/src/common/path_helper.cc",
808 "breakpad/src/common/path_helper.h",
809 "breakpad/src/tools/linux/md2core/minidump-2-core.cc",
810 ]
811
812 include_dirs = [ "breakpad/src" ]
813
814 deps = [
815 ":client",
816 "//build/config:exe_and_shlib_deps",
817 ]
818 }
819
820 executable("core-2-minidump") {
821 set_sources_assignment_filter([])
822 sources = [
823 "breakpad/src/tools/linux/core2md/core2md.cc",
824 ]
825
826 deps = [
827 ":client",
828 "//build/config:exe_and_shlib_deps",
829 ]
830
831 include_dirs = [ "breakpad/src" ]
832 }
833}
834
835if (is_win) {
836 executable("dump_syms") {
837 # TODO(scottmg) using this with VS2015 may break the crash server.
838 # https://crbug.com/696671
839 include_dirs = [
840 "$visual_studio_path/DIA SDK/include",
841 "breakpad/src",
842 ]
843
844 sources = [
845 "breakpad/src/common/windows/dia_util.cc",
846 "breakpad/src/common/windows/dia_util.h",
847 "breakpad/src/common/windows/guid_string.cc",
848 "breakpad/src/common/windows/guid_string.h",
849 "breakpad/src/common/windows/omap.cc",
850 "breakpad/src/common/windows/omap.h",
851 "breakpad/src/common/windows/pdb_source_line_writer.cc",
852 "breakpad/src/common/windows/pdb_source_line_writer.h",
853 "breakpad/src/common/windows/string_utils-inl.h",
854 "breakpad/src/common/windows/string_utils.cc",
855 "breakpad/src/tools/windows/dump_syms/dump_syms.cc",
856 ]
857
858 deps = [
859 "//build/config:exe_and_shlib_deps",
860 ]
861
862 lib_dirs = []
863 if (target_cpu == "x64") {
864 lib_dirs += [ "$visual_studio_path/DIA SDK/lib/amd64" ]
865 } else {
866 lib_dirs += [ "$visual_studio_path/DIA SDK/lib" ]
867 }
868
869 libs = [
870 "diaguids.lib",
871 "imagehlp.lib",
872 ]
873 if (is_clang) {
874 # clang complains about microsoft-specific goto extensions. Instead of
875 # rewriting decade-old, goto-ridden code, disable the warning.
876 cflags = [ "-Wno-microsoft-goto" ]
877 }
878 }
879}
880
881if (is_ios) {
882 static_library("client") {
883 set_sources_assignment_filter([])
884 sources = [
885 "breakpad/src/client/ios/Breakpad.h",
886 "breakpad/src/client/ios/Breakpad.mm",
887 "breakpad/src/client/ios/BreakpadController.h",
888 "breakpad/src/client/ios/BreakpadController.mm",
889 "breakpad/src/client/ios/handler/ios_exception_minidump_generator.h",
890 "breakpad/src/client/ios/handler/ios_exception_minidump_generator.mm",
891 "breakpad/src/client/mac/crash_generation/ConfigFile.h",
892 "breakpad/src/client/mac/crash_generation/ConfigFile.mm",
893 "breakpad/src/client/mac/handler/breakpad_nlist_64.cc",
894 "breakpad/src/client/mac/handler/breakpad_nlist_64.h",
895 "breakpad/src/client/mac/handler/dynamic_images.cc",
896 "breakpad/src/client/mac/handler/dynamic_images.h",
897 "breakpad/src/client/mac/handler/exception_handler.cc",
898 "breakpad/src/client/mac/handler/exception_handler.h",
899 "breakpad/src/client/mac/handler/minidump_generator.cc",
900 "breakpad/src/client/mac/handler/minidump_generator.h",
901 "breakpad/src/client/mac/handler/protected_memory_allocator.cc",
902 "breakpad/src/client/mac/handler/protected_memory_allocator.h",
903 "breakpad/src/client/mac/sender/uploader.h",
904 "breakpad/src/client/mac/sender/uploader.mm",
905 "breakpad/src/client/minidump_file_writer-inl.h",
906 "breakpad/src/client/minidump_file_writer.cc",
907 "breakpad/src/client/minidump_file_writer.h",
908 "breakpad/src/common/convert_UTF.c",
909 "breakpad/src/common/convert_UTF.h",
910 "breakpad/src/common/long_string_dictionary.cc",
911 "breakpad/src/common/mac/HTTPMultipartUpload.m",
912 "breakpad/src/common/mac/file_id.cc",
913 "breakpad/src/common/mac/file_id.h",
914 "breakpad/src/common/mac/macho_id.cc",
915 "breakpad/src/common/mac/macho_id.h",
916 "breakpad/src/common/mac/macho_utilities.cc",
917 "breakpad/src/common/mac/macho_utilities.h",
918 "breakpad/src/common/mac/macho_walker.cc",
919 "breakpad/src/common/mac/macho_walker.h",
920 "breakpad/src/common/mac/string_utilities.cc",
921 "breakpad/src/common/mac/string_utilities.h",
922 "breakpad/src/common/md5.cc",
923 "breakpad/src/common/md5.h",
924 "breakpad/src/common/simple_string_dictionary.cc",
925 "breakpad/src/common/simple_string_dictionary.h",
926 "breakpad/src/common/string_conversion.cc",
927 "breakpad/src/common/string_conversion.h",
928 "breakpad/src/google_breakpad/common/minidump_format.h",
929 ]
930 set_sources_assignment_filter(sources_assignment_filter)
931
932 include_dirs = [
933 "breakpad/src",
934 "breakpad/src/client/mac/Framework",
935 "breakpad/src/common/mac",
936 ]
937
938 deps = [
939 "//third_party/google_toolbox_for_mac",
940 ]
941
942 public_configs = [ ":client_config" ]
943
944 if (is_clang) {
945 # See https://crbug.com/google-breakpad/675.
946 cflags = [ "-Wno-deprecated-declarations" ]
947 }
948 }
949}
950
951if (is_win) {
952 group("client") {
953 public_configs = [ ":client_config" ]
954 }
955
956 config("breakpad_handler_warnings") {
957 if (is_clang) {
958 # See https://crbug.com/google-breakpad/658.
959 cflags = [ "-Wno-reorder" ]
960 }
961 }
962
963 static_library("breakpad_handler") {
964 configs += [ ":handler_config" ]
965 if (is_win) {
966 public_configs = [ ":handler_config" ]
967 }
968
969 defines = [ "BREAKPAD_NO_TERMINATE_THREAD" ]
970
971 sources = [
972 "breakpad/src/client/windows/crash_generation/client_info.cc",
973 "breakpad/src/client/windows/crash_generation/client_info.h",
974 "breakpad/src/client/windows/crash_generation/crash_generation_client.cc",
975 "breakpad/src/client/windows/crash_generation/crash_generation_client.h",
976 "breakpad/src/client/windows/crash_generation/crash_generation_server.cc",
977 "breakpad/src/client/windows/crash_generation/crash_generation_server.h",
978 "breakpad/src/client/windows/crash_generation/minidump_generator.cc",
979 "breakpad/src/client/windows/crash_generation/minidump_generator.h",
980 "breakpad/src/client/windows/handler/exception_handler.cc",
981 "breakpad/src/client/windows/handler/exception_handler.h",
982 "breakpad/src/common/windows/guid_string.cc",
983 "breakpad/src/common/windows/guid_string.h",
984 "breakpad/src/common/windows/string_utils-inl.h",
985 "breakpad/src/google_breakpad/common/minidump_format.h",
986 ]
987 configs += [ ":breakpad_handler_warnings" ]
988 }
989
990 source_set("breakpad_sender") {
991 sources = [
992 "breakpad/src/client/windows/sender/crash_report_sender.cc",
993 "breakpad/src/client/windows/sender/crash_report_sender.h",
994 "breakpad/src/common/windows/http_upload.cc",
995 "breakpad/src/common/windows/http_upload.h",
996 ]
997 configs += [ ":sender_config" ]
998 public_configs = [ ":sender_config" ]
999 }
1000}