1 # 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.
5 config("tools_config") {
6 include_dirs = [ "src", "src/third_party" ]
8 defines = [ "__ANDROID__" ]
11 cflags = [ "-Wno-tautological-constant-out-of-range-compare" ]
15 config("internal_config") {
16 include_dirs = [ "src" ]
19 # This is needed for GTMLogger to work correctly.
20 defines += [ "DEBUG" ]
23 defines += [ "__ANDROID__" ]
27 config("client_config") {
28 include_dirs = [ "src" ]
30 include_dirs += [ "src/common/android/include" ]
34 config("handler_config") {
40 # minidump_stackwalk and minidump_dump are tool-type executables that do
42 if (current_toolchain == host_toolchain && !is_win) {
43 executable("minidump_stackwalk") {
45 "src/processor/basic_code_module.h",
46 "src/processor/basic_code_modules.cc",
47 "src/processor/basic_code_modules.h",
48 "src/processor/basic_source_line_resolver.cc",
49 "src/processor/binarystream.cc",
50 "src/processor/binarystream.h",
51 "src/processor/call_stack.cc",
52 "src/processor/cfi_frame_info.cc",
53 "src/processor/cfi_frame_info.h",
54 "src/processor/disassembler_x86.cc",
55 "src/processor/disassembler_x86.h",
56 "src/processor/dump_context.cc",
57 "src/processor/dump_object.cc",
58 "src/processor/exploitability.cc",
59 "src/processor/logging.cc",
60 "src/processor/logging.h",
61 "src/processor/minidump.cc",
62 "src/processor/minidump_processor.cc",
63 "src/processor/minidump_stackwalk.cc",
64 "src/processor/pathname_stripper.cc",
65 "src/processor/pathname_stripper.h",
66 "src/processor/process_state.cc",
67 "src/processor/simple_symbol_supplier.cc",
68 "src/processor/simple_symbol_supplier.h",
69 "src/processor/source_line_resolver_base.cc",
70 "src/processor/stack_frame_cpu.cc",
71 "src/processor/stack_frame_symbolizer.cc",
72 "src/processor/stackwalker.cc",
73 "src/processor/stackwalker_amd64.cc",
74 "src/processor/stackwalker_amd64.h",
75 "src/processor/stackwalker_arm.cc",
76 "src/processor/stackwalker_arm.h",
77 "src/processor/stackwalker_arm64.cc",
78 "src/processor/stackwalker_arm64.h",
79 "src/processor/stackwalker_mips.cc",
80 "src/processor/stackwalker_mips.h",
81 "src/processor/stackwalker_ppc.cc",
82 "src/processor/stackwalker_ppc.h",
83 "src/processor/stackwalker_ppc64.cc",
84 "src/processor/stackwalker_ppc64.h",
85 "src/processor/stackwalker_sparc.cc",
86 "src/processor/stackwalker_sparc.h",
87 "src/processor/stackwalker_x86.cc",
88 "src/processor/stackwalker_x86.h",
89 "src/processor/tokenize.cc",
90 "src/processor/tokenize.h",
92 "src/third_party/libdisasm/ia32_implicit.c",
93 "src/third_party/libdisasm/ia32_implicit.h",
94 "src/third_party/libdisasm/ia32_insn.c",
95 "src/third_party/libdisasm/ia32_insn.h",
96 "src/third_party/libdisasm/ia32_invariant.c",
97 "src/third_party/libdisasm/ia32_invariant.h",
98 "src/third_party/libdisasm/ia32_modrm.c",
99 "src/third_party/libdisasm/ia32_modrm.h",
100 "src/third_party/libdisasm/ia32_opcode_tables.c",
101 "src/third_party/libdisasm/ia32_opcode_tables.h",
102 "src/third_party/libdisasm/ia32_operand.c",
103 "src/third_party/libdisasm/ia32_operand.h",
104 "src/third_party/libdisasm/ia32_reg.c",
105 "src/third_party/libdisasm/ia32_reg.h",
106 "src/third_party/libdisasm/ia32_settings.c",
107 "src/third_party/libdisasm/ia32_settings.h",
108 "src/third_party/libdisasm/libdis.h",
109 "src/third_party/libdisasm/qword.h",
110 "src/third_party/libdisasm/x86_disasm.c",
111 "src/third_party/libdisasm/x86_format.c",
112 "src/third_party/libdisasm/x86_imm.c",
113 "src/third_party/libdisasm/x86_imm.h",
114 "src/third_party/libdisasm/x86_insn.c",
115 "src/third_party/libdisasm/x86_misc.c",
116 "src/third_party/libdisasm/x86_operand_list.c",
117 "src/third_party/libdisasm/x86_operand_list.h",
120 defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" ]
122 configs -= [ "//build/config/compiler:chromium_code" ]
123 configs += [ "//build/config/compiler:no_chromium_code" ]
124 configs += [ ":tools_config" ]
126 # Always want these files included regardless of platform.
127 set_sources_assignment_filter([])
129 "src/processor/exploitability_linux.cc",
130 "src/processor/exploitability_linux.h",
131 "src/processor/exploitability_win.cc",
132 "src/processor/exploitability_win.h",
136 executable("minidump_dump") {
138 "src/processor/basic_code_module.h",
139 "src/processor/basic_code_modules.cc",
140 "src/processor/basic_code_modules.h",
141 "src/processor/dump_context.cc",
142 "src/processor/dump_object.cc",
143 "src/processor/logging.cc",
144 "src/processor/logging.h",
145 "src/processor/minidump.cc",
146 "src/processor/minidump_dump.cc",
147 "src/processor/pathname_stripper.cc",
148 "src/processor/pathname_stripper.h",
151 configs += [ ":tools_config" ]
153 # There are some warnings in this code.
154 configs -= [ "//build/config/compiler:chromium_code" ]
155 configs += [ "//build/config/compiler:no_chromium_code" ]
159 # Mac --------------------------------------------------------------------------
161 if (current_toolchain == host_toolchain && is_mac) {
162 # TODO(GYP) This should be only 64-bit on Mac. From .gypi:
163 # Like ld, dump_syms needs to operate on enough data that it may
164 # actually need to be able to address more than 4GB. Use x86_64.
165 # Don't worry! An x86_64 dump_syms is perfectly able to dump
167 executable("dump_syms") {
169 "src/common/dwarf/bytereader.cc",
170 "src/common/dwarf_cfi_to_module.cc",
171 "src/common/dwarf_cu_to_module.cc",
172 "src/common/dwarf/dwarf2diehandler.cc",
173 "src/common/dwarf/dwarf2reader.cc",
174 "src/common/dwarf_line_to_module.cc",
175 "src/common/language.cc",
176 "src/common/mac/arch_utilities.cc",
177 "src/common/mac/arch_utilities.h",
178 "src/common/mac/dump_syms.mm",
179 "src/common/mac/file_id.cc",
180 "src/common/mac/macho_id.cc",
181 "src/common/mac/macho_reader.cc",
182 "src/common/mac/macho_utilities.cc",
183 "src/common/mac/macho_walker.cc",
185 "src/common/module.cc",
186 "src/common/stabs_reader.cc",
187 "src/common/stabs_to_module.cc",
188 "src/tools/mac/dump_syms/dump_syms_tool.mm",
191 # For src/common/stabs_reader.h.
192 defines = [ "HAVE_MACH_O_NLIST_H" ]
193 include_dirs = [ "src/common/mac" ]
195 # The DWARF utilities require -funsigned-char.
196 cflags = [ "-funsigned-char" ]
198 configs += [ ":internal_config" ]
200 configs -= [ "//build/config/compiler:chromium_code" ]
201 configs += [ "//build/config/compiler:no_chromium_code" ]
203 # dwarf2reader.cc uses dynamic_cast.
204 configs -= [ "//build/config/compiler:no_rtti" ]
205 configs += [ "//build/config/compiler:rtti" ]
207 libs = [ "Foundation.framework" ]
210 # dump_syms crashes when built at -O1, -O2, and -O3. It does
211 # not crash at -Os. To play it safe, dump_syms is always built
212 # at -O0 until this can be sorted out.
213 # http://code.google.com/p/google-breakpad/issues/detail?id=329
214 configs -= [ "//build/config/compiler:optimize" ]
219 executable("symupload") {
221 "src/common/mac/HTTPMultipartUpload.m",
222 "src/tools/mac/symupload/symupload.m",
229 libs = [ "Foundation.framework" ]
231 configs -= [ "//build/config/compiler:chromium_code" ]
232 configs += [ "//build/config/compiler:no_chromium_code" ]
237 static_library("utilities") {
239 "src/client/mac/crash_generation/ConfigFile.mm",
240 "src/client/mac/handler/breakpad_nlist_64.cc",
241 "src/client/mac/handler/dynamic_images.cc",
242 "src/client/mac/handler/minidump_generator.cc",
243 "src/client/minidump_file_writer.cc",
244 "src/common/convert_UTF.c",
245 "src/common/mac/MachIPC.mm",
246 "src/common/mac/arch_utilities.cc",
247 "src/common/mac/bootstrap_compat.cc",
248 "src/common/mac/file_id.cc",
249 "src/common/mac/launch_reporter.cc",
250 "src/common/mac/macho_id.cc",
251 "src/common/mac/macho_utilities.cc",
252 "src/common/mac/macho_walker.cc",
253 "src/common/mac/string_utilities.cc",
255 "src/common/simple_string_dictionary.cc",
256 "src/common/string_conversion.cc",
259 configs += [ ":internal_config" ]
261 # There are some warnings in this code.
262 configs -= [ "//build/config/compiler:chromium_code" ]
263 configs += [ "//build/config/compiler:no_chromium_code" ]
266 executable("crash_inspector") {
268 "src/client/mac/crash_generation/Inspector.mm",
269 "src/client/mac/crash_generation/InspectorMain.mm",
272 # TODO(GYP): 'mac_real_dsym': 1,
275 "src/client/apple/Framework",
280 "CoreServices.framework",
281 "Foundation.framework",
289 # TODO(GYP) this target has some mac_bundle_resources stuff.
290 # executable("crash_report_sender") {
292 group("crash_report_sender") {
295 config("breakpad_config") {
296 include_dirs = [ "src/client/apple/Framework" ]
299 static_library("breakpad") {
301 "src/client/mac/crash_generation/crash_generation_client.cc",
302 "src/client/mac/crash_generation/crash_generation_client.h",
303 "src/client/mac/handler/protected_memory_allocator.cc",
304 "src/client/mac/handler/exception_handler.cc",
305 "src/client/mac/Framework/Breakpad.mm",
306 "src/client/mac/Framework/OnDemandServer.mm",
309 configs += [ ":internal_config" ]
310 public_configs = [ ":breakpad_config" ]
312 defines = [ "USE_PROTECTED_ALLOCATIONS=1" ]
314 "src/client/apple/Framework",
320 ":crash_report_sender",
325 public_configs = [ ":client_config" ]
330 executable("symupload") {
332 "src/tools/linux/symupload/sym_upload.cc",
333 "src/common/linux/http_upload.cc",
334 "src/common/linux/http_upload.h",
342 configs += [ ":tools_config" ]
348 if (is_linux || is_android) {
349 if (current_toolchain == host_toolchain) {
350 # dump_syms is a host tool, so only compile it for the host system.
351 executable("dump_syms") {
353 "src/common/dwarf/bytereader.cc",
354 "src/common/dwarf_cfi_to_module.cc",
355 "src/common/dwarf_cfi_to_module.h",
356 "src/common/dwarf_cu_to_module.cc",
357 "src/common/dwarf_cu_to_module.h",
358 "src/common/dwarf/dwarf2diehandler.cc",
359 "src/common/dwarf/dwarf2reader.cc",
360 "src/common/dwarf_line_to_module.cc",
361 "src/common/dwarf_line_to_module.h",
362 "src/common/language.cc",
363 "src/common/language.h",
364 "src/common/linux/crc32.cc",
365 "src/common/linux/crc32.h",
366 "src/common/linux/dump_symbols.cc",
367 "src/common/linux/dump_symbols.h",
368 "src/common/linux/elf_symbols_to_module.cc",
369 "src/common/linux/elf_symbols_to_module.h",
370 "src/common/linux/elfutils.cc",
371 "src/common/linux/elfutils.h",
372 "src/common/linux/file_id.cc",
373 "src/common/linux/file_id.h",
374 "src/common/linux/linux_libc_support.cc",
375 "src/common/linux/linux_libc_support.h",
376 "src/common/linux/memory_mapped_file.cc",
377 "src/common/linux/memory_mapped_file.h",
378 "src/common/linux/guid_creator.h",
379 "src/common/module.cc",
380 "src/common/module.h",
381 "src/common/stabs_reader.cc",
382 "src/common/stabs_reader.h",
383 "src/common/stabs_to_module.cc",
384 "src/common/stabs_to_module.h",
385 "src/tools/linux/dump_syms/dump_syms.cc",
388 # There are some warnings in this code.
389 configs -= [ "//build/config/compiler:chromium_code" ]
390 configs += [ "//build/config/compiler:no_chromium_code" ]
392 # dwarf2reader.cc uses dynamic_cast. Because we don't typically
393 # don't support RTTI, we enable it for this single target. Since
394 # dump_syms doesn't share any object files with anything else,
395 # this doesn't end up polluting Chrome itself.
396 configs -= [ "//build/config/compiler:no_rtti" ]
397 configs += [ "//build/config/compiler:rtti" ]
399 # Breakpad rev 583 introduced this flag.
400 # Using this define, stabs_reader.h will include a.out.h to
402 defines = [ "HAVE_A_OUT_H" ]
404 include_dirs = [ "src" ]
408 static_library("client") {
409 # Want all these sources for both Linux and Android.
410 set_sources_assignment_filter([])
412 "src/client/linux/crash_generation/crash_generation_client.cc",
413 "src/client/linux/crash_generation/crash_generation_client.h",
414 "src/client/linux/dump_writer_common/mapping_info.h",
415 "src/client/linux/dump_writer_common/seccomp_unwinder.cc",
416 "src/client/linux/dump_writer_common/seccomp_unwinder.h",
417 "src/client/linux/dump_writer_common/thread_info.cc",
418 "src/client/linux/dump_writer_common/thread_info.h",
419 "src/client/linux/dump_writer_common/ucontext_reader.cc",
420 "src/client/linux/dump_writer_common/ucontext_reader.h",
421 "src/client/linux/handler/exception_handler.cc",
422 "src/client/linux/handler/exception_handler.h",
423 "src/client/linux/handler/minidump_descriptor.cc",
424 "src/client/linux/handler/minidump_descriptor.h",
425 "src/client/linux/log/log.cc",
426 "src/client/linux/log/log.h",
427 "src/client/linux/minidump_writer/cpu_set.h",
428 "src/client/linux/minidump_writer/directory_reader.h",
429 "src/client/linux/minidump_writer/line_reader.h",
430 "src/client/linux/minidump_writer/linux_core_dumper.cc",
431 "src/client/linux/minidump_writer/linux_core_dumper.h",
432 "src/client/linux/minidump_writer/linux_dumper.cc",
433 "src/client/linux/minidump_writer/linux_dumper.h",
434 "src/client/linux/minidump_writer/linux_ptrace_dumper.cc",
435 "src/client/linux/minidump_writer/linux_ptrace_dumper.h",
436 "src/client/linux/minidump_writer/minidump_writer.cc",
437 "src/client/linux/minidump_writer/minidump_writer.h",
438 "src/client/linux/minidump_writer/proc_cpuinfo_reader.h",
439 "src/client/minidump_file_writer-inl.h",
440 "src/client/minidump_file_writer.cc",
441 "src/client/minidump_file_writer.h",
442 "src/common/convert_UTF.c",
443 "src/common/convert_UTF.h",
444 "src/common/linux/elf_core_dump.cc",
445 "src/common/linux/elf_core_dump.h",
446 "src/common/linux/elfutils.cc",
447 "src/common/linux/elfutils.h",
448 "src/common/linux/file_id.cc",
449 "src/common/linux/file_id.h",
450 "src/common/linux/google_crashdump_uploader.cc",
451 "src/common/linux/google_crashdump_uploader.h",
452 "src/common/linux/guid_creator.cc",
453 "src/common/linux/guid_creator.h",
454 "src/common/linux/libcurl_wrapper.cc",
455 "src/common/linux/libcurl_wrapper.h",
456 "src/common/linux/linux_libc_support.cc",
457 "src/common/linux/linux_libc_support.h",
458 "src/common/linux/memory_mapped_file.cc",
459 "src/common/linux/memory_mapped_file.h",
460 "src/common/linux/safe_readlink.cc",
461 "src/common/linux/safe_readlink.h",
462 "src/common/memory.h",
463 "src/common/simple_string_dictionary.cc",
464 "src/common/simple_string_dictionary.h",
465 "src/common/string_conversion.cc",
466 "src/common/string_conversion.h",
469 configs -= [ "//build/config/compiler:chromium_code" ]
470 configs += [ "//build/config/compiler:no_chromium_code" ]
471 public_configs = [ ":client_config" ]
473 if (cpu_arch == "arm" && is_chromeos) {
474 # Avoid running out of registers in
475 # linux_syscall_support.h:sys_clone()'s inline assembly.
480 sources += [ "src/common/android/breakpad_getcontext.S" ]
489 "src/third_party/linux/include",
493 static_library("processor_support") {
495 "src/common/scoped_ptr.h",
496 "src/processor/basic_code_modules.cc",
497 "src/processor/basic_code_modules.h",
498 "src/processor/dump_context.cc",
499 "src/processor/dump_object.cc",
500 "src/processor/logging.cc",
501 "src/processor/logging.h",
502 "src/processor/minidump.cc",
503 "src/processor/pathname_stripper.cc",
504 "src/processor/pathname_stripper.h",
510 "src/third_party/linux/include",
514 # There are some warnings in this code.
515 configs -= [ "//build/config/compiler:chromium_code" ]
516 configs += [ "//build/config/compiler:no_chromium_code" ]
521 test("breakpad_unittests") {
523 "linux/breakpad_googletest_includes.h",
524 "src/client/linux/handler/exception_handler_unittest.cc",
525 "src/client/linux/minidump_writer/cpu_set_unittest.cc",
526 "src/client/linux/minidump_writer/directory_reader_unittest.cc",
527 "src/client/linux/minidump_writer/line_reader_unittest.cc",
528 "src/client/linux/minidump_writer/linux_core_dumper_unittest.cc",
529 "src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc",
530 "src/client/linux/minidump_writer/minidump_writer_unittest.cc",
531 "src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
532 "src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
533 "src/common/linux/elf_core_dump_unittest.cc",
534 "src/common/linux/file_id_unittest.cc",
535 "src/common/linux/linux_libc_support_unittest.cc",
536 "src/common/linux/synth_elf.cc",
537 "src/common/linux/tests/auto_testfile.h",
538 "src/common/linux/tests/crash_generator.cc",
539 "src/common/linux/tests/crash_generator.h",
540 "src/common/memory_range.h",
541 "src/common/memory_unittest.cc",
542 "src/common/simple_string_dictionary_unittest.cc",
543 "src/common/test_assembler.cc",
544 "src/common/tests/file_utils.cc",
545 "src/common/tests/file_utils.h",
546 "src/tools/linux/md2core/minidump_memory_range.h",
547 "src/tools/linux/md2core/minidump_memory_range_unittest.cc",
552 ":processor_support",
553 ":linux_dumper_unittest_helper",
555 "//testing/gtest:gtest_main",
560 "linux", # Use our copy of breakpad_googletest_includes.h
565 # There are some warnings in this code.
566 configs -= [ "//build/config/compiler:chromium_code" ]
567 configs += [ "//build/config/compiler:no_chromium_code" ]
570 # See http://crbug.com/138571#c18
571 cflags = [ "-Wno-unused-value" ]
576 sources += [ "src/common/android/breakpad_getcontext_unittest.cc" ]
578 include_dirs += [ "src/common/android/include" ]
582 executable("linux_dumper_unittest_helper") {
585 "src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc",
588 ":processor_support",
595 if (cpu_arch == "mipsel" && is_android) {
596 include_dirs += [ "src/common/android/include" ]
601 executable("generate_test_dump") {
604 "linux/generate-test-dump.cc",
607 # This file has an unused variable warning.
608 configs -= [ "//build/config/compiler:chromium_code" ]
609 configs += [ "//build/config/compiler:no_chromium_code" ]
613 include_dirs = [ "src" ]
617 include_dirs += [ "src/common/android/include" ]
621 executable("minidump-2-core") {
622 sources = [ "src/tools/linux/md2core/minidump-2-core.cc" ]
624 include_dirs = [ "src" ]
629 executable("core-2-minidump") {
631 "src/tools/linux/core2md/core2md.cc",
638 include_dirs = [ "src" ]
643 static_library("client") {
645 "src/client/ios/Breakpad.h",
646 "src/client/ios/Breakpad.mm",
647 "src/client/ios/BreakpadController.h",
648 "src/client/ios/BreakpadController.mm",
649 "src/client/ios/handler/ios_exception_minidump_generator.mm",
650 "src/client/ios/handler/ios_exception_minidump_generator.h",
651 "src/client/mac/crash_generation/ConfigFile.h",
652 "src/client/mac/crash_generation/ConfigFile.mm",
653 "src/client/mac/handler/breakpad_nlist_64.cc",
654 "src/client/mac/handler/breakpad_nlist_64.h",
655 "src/client/mac/handler/dynamic_images.cc",
656 "src/client/mac/handler/dynamic_images.h",
657 "src/client/mac/handler/protected_memory_allocator.cc",
658 "src/client/mac/handler/protected_memory_allocator.h",
659 "src/client/mac/handler/exception_handler.cc",
660 "src/client/mac/handler/exception_handler.h",
661 "src/client/mac/handler/minidump_generator.cc",
662 "src/client/mac/handler/minidump_generator.h",
663 "src/client/mac/sender/uploader.h",
664 "src/client/mac/sender/uploader.mm",
665 "src/client/minidump_file_writer.cc",
666 "src/client/minidump_file_writer.h",
667 "src/client/minidump_file_writer-inl.h",
668 "src/common/convert_UTF.c",
669 "src/common/convert_UTF.h",
670 "src/common/mac/file_id.cc",
671 "src/common/mac/file_id.h",
672 "src/common/mac/HTTPMultipartUpload.m",
673 "src/common/mac/macho_id.cc",
674 "src/common/mac/macho_id.h",
675 "src/common/mac/macho_utilities.cc",
676 "src/common/mac/macho_utilities.h",
677 "src/common/mac/macho_walker.cc",
678 "src/common/mac/macho_walker.h",
679 "src/common/mac/string_utilities.cc",
680 "src/common/mac/string_utilities.h",
683 "src/common/simple_string_dictionary.cc",
684 "src/common/simple_string_dictionary.h",
685 "src/common/string_conversion.cc",
686 "src/common/string_conversion.h",
687 "src/google_breakpad/common/minidump_format.h",
692 "src/client/mac/Framework",
697 # TODO(GYP) There is some XCode-only targets like ninja-breakpad.
702 public_configs = [ ":client_config" ]
705 source_set("breakpad_handler") {
706 configs += [ ":handler_config" ]
708 public_configs = [ ":handler_config" ]
711 defines = [ "BREAKPAD_NO_TERMINATE_THREAD" ]
714 "src/client/windows/crash_generation/client_info.cc",
715 "src/client/windows/crash_generation/client_info.h",
716 "src/client/windows/crash_generation/crash_generation_client.cc",
717 "src/client/windows/crash_generation/crash_generation_client.h",
718 "src/client/windows/crash_generation/crash_generation_server.cc",
719 "src/client/windows/crash_generation/crash_generation_server.h",
720 "src/client/windows/handler/exception_handler.cc",
721 "src/client/windows/handler/exception_handler.h",
722 "src/common/windows/guid_string.cc",
723 "src/common/windows/guid_string.h",
724 "src/google_breakpad/common/minidump_format.h",
725 "src/client/windows/crash_generation/minidump_generator.cc",
726 "src/client/windows/crash_generation/minidump_generator.h",
727 "src/common/windows/string_utils-inl.h",