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",
225 libs = [ "Foundaction.framework" ]
230 static_library("utilities") {
232 "src/client/mac/crash_generation/ConfigFile.mm",
233 "src/client/mac/handler/breakpad_nlist_64.cc",
234 "src/client/mac/handler/dynamic_images.cc",
235 "src/client/mac/handler/minidump_generator.cc",
236 "src/client/minidump_file_writer.cc",
237 "src/common/convert_UTF.c",
238 "src/common/mac/MachIPC.mm",
239 "src/common/mac/arch_utilities.cc",
240 "src/common/mac/bootstrap_compat.cc",
241 "src/common/mac/file_id.cc",
242 "src/common/mac/launch_reporter.cc",
243 "src/common/mac/macho_id.cc",
244 "src/common/mac/macho_utilities.cc",
245 "src/common/mac/macho_walker.cc",
246 "src/common/mac/string_utilities.cc",
248 "src/common/simple_string_dictionary.cc",
249 "src/common/string_conversion.cc",
252 configs += [ ":internal_config" ]
255 executable("crash_inspector") {
257 "src/client/mac/crash_generation/Inspector.mm",
258 "src/client/mac/crash_generation/InspectorMain.mm",
261 # TODO(GYP): 'mac_real_dsym': 1,
264 "src/client/apple/Framework",
269 "CoreServices.framework",
270 "Foundation.framework",
278 executable("crash_report_sender") {
279 # TODO(GYP) this target has some mac_bundle_resources stuff.
282 config("breakpad_config") {
283 include_dirs = [ "src/client/apple/Framework" ]
286 static_library("breakpad") {
288 "src/client/mac/crash_generation/crash_generation_client.cc",
289 "src/client/mac/crash_generation/crash_generation_client.h",
290 "src/client/mac/handler/protected_memory_allocator.cc",
291 "src/client/mac/handler/exception_handler.cc",
292 "src/client/mac/Framework/Breakpad.mm",
293 "src/client/mac/Framework/OnDemandServer.mm",
296 configs += [ ":internal_config" ]
297 public_configs = [ ":breakpad_config" ]
299 defines = [ "USE_PROTECTED_ALLOCATIONS=1" ]
301 "src/client/apple/Framework",
307 # TODO(GYP): Make this link
308 #":crash_report_sender",
313 public_configs = [ ":client_config" ]
318 executable("symupload") {
320 "src/tools/linux/symupload/sym_upload.cc",
321 "src/common/linux/http_upload.cc",
322 "src/common/linux/http_upload.h",
330 configs += [ ":tools_config" ]
336 if (is_linux || is_android) {
337 if (current_toolchain == host_toolchain) {
338 # dump_syms is a host tool, so only compile it for the host system.
339 executable("dump_syms") {
341 "src/common/dwarf/bytereader.cc",
342 "src/common/dwarf_cfi_to_module.cc",
343 "src/common/dwarf_cfi_to_module.h",
344 "src/common/dwarf_cu_to_module.cc",
345 "src/common/dwarf_cu_to_module.h",
346 "src/common/dwarf/dwarf2diehandler.cc",
347 "src/common/dwarf/dwarf2reader.cc",
348 "src/common/dwarf_line_to_module.cc",
349 "src/common/dwarf_line_to_module.h",
350 "src/common/language.cc",
351 "src/common/language.h",
352 "src/common/linux/crc32.cc",
353 "src/common/linux/crc32.h",
354 "src/common/linux/dump_symbols.cc",
355 "src/common/linux/dump_symbols.h",
356 "src/common/linux/elf_symbols_to_module.cc",
357 "src/common/linux/elf_symbols_to_module.h",
358 "src/common/linux/elfutils.cc",
359 "src/common/linux/elfutils.h",
360 "src/common/linux/file_id.cc",
361 "src/common/linux/file_id.h",
362 "src/common/linux/linux_libc_support.cc",
363 "src/common/linux/linux_libc_support.h",
364 "src/common/linux/memory_mapped_file.cc",
365 "src/common/linux/memory_mapped_file.h",
366 "src/common/linux/guid_creator.h",
367 "src/common/module.cc",
368 "src/common/module.h",
369 "src/common/stabs_reader.cc",
370 "src/common/stabs_reader.h",
371 "src/common/stabs_to_module.cc",
372 "src/common/stabs_to_module.h",
373 "src/tools/linux/dump_syms/dump_syms.cc",
376 # There are some warnings in this code.
377 configs -= [ "//build/config/compiler:chromium_code" ]
378 configs += [ "//build/config/compiler:no_chromium_code" ]
380 # dwarf2reader.cc uses dynamic_cast. Because we don't typically
381 # don't support RTTI, we enable it for this single target. Since
382 # dump_syms doesn't share any object files with anything else,
383 # this doesn't end up polluting Chrome itself.
384 configs -= [ "//build/config/compiler:no_rtti" ]
385 configs += [ "//build/config/compiler:rtti" ]
387 # Breakpad rev 583 introduced this flag.
388 # Using this define, stabs_reader.h will include a.out.h to
390 defines = [ "HAVE_A_OUT_H" ]
392 include_dirs = [ "src" ]
396 static_library("client") {
397 # Want all these sources for both Linux and Android.
398 set_sources_assignment_filter([])
400 "src/client/linux/crash_generation/crash_generation_client.cc",
401 "src/client/linux/crash_generation/crash_generation_client.h",
402 "src/client/linux/dump_writer_common/mapping_info.h",
403 "src/client/linux/dump_writer_common/seccomp_unwinder.cc",
404 "src/client/linux/dump_writer_common/seccomp_unwinder.h",
405 "src/client/linux/dump_writer_common/thread_info.cc",
406 "src/client/linux/dump_writer_common/thread_info.h",
407 "src/client/linux/dump_writer_common/ucontext_reader.cc",
408 "src/client/linux/dump_writer_common/ucontext_reader.h",
409 "src/client/linux/handler/exception_handler.cc",
410 "src/client/linux/handler/exception_handler.h",
411 "src/client/linux/handler/minidump_descriptor.cc",
412 "src/client/linux/handler/minidump_descriptor.h",
413 "src/client/linux/log/log.cc",
414 "src/client/linux/log/log.h",
415 "src/client/linux/minidump_writer/cpu_set.h",
416 "src/client/linux/minidump_writer/directory_reader.h",
417 "src/client/linux/minidump_writer/line_reader.h",
418 "src/client/linux/minidump_writer/linux_core_dumper.cc",
419 "src/client/linux/minidump_writer/linux_core_dumper.h",
420 "src/client/linux/minidump_writer/linux_dumper.cc",
421 "src/client/linux/minidump_writer/linux_dumper.h",
422 "src/client/linux/minidump_writer/linux_ptrace_dumper.cc",
423 "src/client/linux/minidump_writer/linux_ptrace_dumper.h",
424 "src/client/linux/minidump_writer/minidump_writer.cc",
425 "src/client/linux/minidump_writer/minidump_writer.h",
426 "src/client/linux/minidump_writer/proc_cpuinfo_reader.h",
427 "src/client/minidump_file_writer-inl.h",
428 "src/client/minidump_file_writer.cc",
429 "src/client/minidump_file_writer.h",
430 "src/common/convert_UTF.c",
431 "src/common/convert_UTF.h",
432 "src/common/linux/elf_core_dump.cc",
433 "src/common/linux/elf_core_dump.h",
434 "src/common/linux/elfutils.cc",
435 "src/common/linux/elfutils.h",
436 "src/common/linux/file_id.cc",
437 "src/common/linux/file_id.h",
438 "src/common/linux/google_crashdump_uploader.cc",
439 "src/common/linux/google_crashdump_uploader.h",
440 "src/common/linux/guid_creator.cc",
441 "src/common/linux/guid_creator.h",
442 "src/common/linux/libcurl_wrapper.cc",
443 "src/common/linux/libcurl_wrapper.h",
444 "src/common/linux/linux_libc_support.cc",
445 "src/common/linux/linux_libc_support.h",
446 "src/common/linux/memory_mapped_file.cc",
447 "src/common/linux/memory_mapped_file.h",
448 "src/common/linux/safe_readlink.cc",
449 "src/common/linux/safe_readlink.h",
450 "src/common/memory.h",
451 "src/common/simple_string_dictionary.cc",
452 "src/common/simple_string_dictionary.h",
453 "src/common/string_conversion.cc",
454 "src/common/string_conversion.h",
457 configs -= [ "//build/config/compiler:chromium_code" ]
458 configs += [ "//build/config/compiler:no_chromium_code" ]
459 public_configs = [ ":client_config" ]
461 if (cpu_arch == "arm" && is_chromeos) {
462 # Avoid running out of registers in
463 # linux_syscall_support.h:sys_clone()'s inline assembly.
468 sources += [ "src/common/android/breakpad_getcontext.S" ]
477 "src/third_party/linux/include",
481 static_library("processor_support") {
483 "src/common/scoped_ptr.h",
484 "src/processor/basic_code_modules.cc",
485 "src/processor/basic_code_modules.h",
486 "src/processor/dump_context.cc",
487 "src/processor/dump_object.cc",
488 "src/processor/logging.cc",
489 "src/processor/logging.h",
490 "src/processor/minidump.cc",
491 "src/processor/pathname_stripper.cc",
492 "src/processor/pathname_stripper.h",
498 "src/third_party/linux/include",
502 # There are some warnings in this code.
503 configs -= [ "//build/config/compiler:chromium_code" ]
504 configs += [ "//build/config/compiler:no_chromium_code" ]
509 test("breakpad_unittests") {
511 "linux/breakpad_googletest_includes.h",
512 "src/client/linux/handler/exception_handler_unittest.cc",
513 "src/client/linux/minidump_writer/cpu_set_unittest.cc",
514 "src/client/linux/minidump_writer/directory_reader_unittest.cc",
515 "src/client/linux/minidump_writer/line_reader_unittest.cc",
516 "src/client/linux/minidump_writer/linux_core_dumper_unittest.cc",
517 "src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc",
518 "src/client/linux/minidump_writer/minidump_writer_unittest.cc",
519 "src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
520 "src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
521 "src/common/linux/elf_core_dump_unittest.cc",
522 "src/common/linux/file_id_unittest.cc",
523 "src/common/linux/linux_libc_support_unittest.cc",
524 "src/common/linux/synth_elf.cc",
525 "src/common/linux/tests/auto_testfile.h",
526 "src/common/linux/tests/crash_generator.cc",
527 "src/common/linux/tests/crash_generator.h",
528 "src/common/memory_range.h",
529 "src/common/memory_unittest.cc",
530 "src/common/simple_string_dictionary_unittest.cc",
531 "src/common/test_assembler.cc",
532 "src/common/tests/file_utils.cc",
533 "src/common/tests/file_utils.h",
534 "src/tools/linux/md2core/minidump_memory_range.h",
535 "src/tools/linux/md2core/minidump_memory_range_unittest.cc",
540 ":processor_support",
541 ":linux_dumper_unittest_helper",
543 "//testing/gtest:gtest_main",
548 "linux", # Use our copy of breakpad_googletest_includes.h
553 # There are some warnings in this code.
554 configs -= [ "//build/config/compiler:chromium_code" ]
555 configs += [ "//build/config/compiler:no_chromium_code" ]
558 # See http://crbug.com/138571#c18
559 cflags = [ "-Wno-unused-value" ]
564 sources += [ "src/common/android/breakpad_getcontext_unittest.cc" ]
566 include_dirs += [ "src/common/android/include" ]
570 executable("linux_dumper_unittest_helper") {
573 "src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc",
576 ":processor_support",
583 if (cpu_arch == "mipsel" && is_android) {
584 include_dirs += [ "src/common/android/include" ]
589 executable("generate_test_dump") {
592 "linux/generate-test-dump.cc",
595 # This file has an unused variable warning.
596 configs -= [ "//build/config/compiler:chromium_code" ]
597 configs += [ "//build/config/compiler:no_chromium_code" ]
601 include_dirs = [ "src" ]
605 include_dirs += [ "src/common/android/include" ]
609 executable("minidump-2-core") {
610 sources = [ "src/tools/linux/md2core/minidump-2-core.cc" ]
612 include_dirs = [ "src" ]
617 executable("core-2-minidump") {
619 "src/tools/linux/core2md/core2md.cc",
626 include_dirs = [ "src" ]
631 static_library("client") {
633 "src/client/ios/Breakpad.h",
634 "src/client/ios/Breakpad.mm",
635 "src/client/ios/BreakpadController.h",
636 "src/client/ios/BreakpadController.mm",
637 "src/client/ios/handler/ios_exception_minidump_generator.mm",
638 "src/client/ios/handler/ios_exception_minidump_generator.h",
639 "src/client/mac/crash_generation/ConfigFile.h",
640 "src/client/mac/crash_generation/ConfigFile.mm",
641 "src/client/mac/handler/breakpad_nlist_64.cc",
642 "src/client/mac/handler/breakpad_nlist_64.h",
643 "src/client/mac/handler/dynamic_images.cc",
644 "src/client/mac/handler/dynamic_images.h",
645 "src/client/mac/handler/protected_memory_allocator.cc",
646 "src/client/mac/handler/protected_memory_allocator.h",
647 "src/client/mac/handler/exception_handler.cc",
648 "src/client/mac/handler/exception_handler.h",
649 "src/client/mac/handler/minidump_generator.cc",
650 "src/client/mac/handler/minidump_generator.h",
651 "src/client/mac/sender/uploader.h",
652 "src/client/mac/sender/uploader.mm",
653 "src/client/minidump_file_writer.cc",
654 "src/client/minidump_file_writer.h",
655 "src/client/minidump_file_writer-inl.h",
656 "src/common/convert_UTF.c",
657 "src/common/convert_UTF.h",
658 "src/common/mac/file_id.cc",
659 "src/common/mac/file_id.h",
660 "src/common/mac/HTTPMultipartUpload.m",
661 "src/common/mac/macho_id.cc",
662 "src/common/mac/macho_id.h",
663 "src/common/mac/macho_utilities.cc",
664 "src/common/mac/macho_utilities.h",
665 "src/common/mac/macho_walker.cc",
666 "src/common/mac/macho_walker.h",
667 "src/common/mac/string_utilities.cc",
668 "src/common/mac/string_utilities.h",
671 "src/common/simple_string_dictionary.cc",
672 "src/common/simple_string_dictionary.h",
673 "src/common/string_conversion.cc",
674 "src/common/string_conversion.h",
675 "src/google_breakpad/common/minidump_format.h",
680 "src/client/mac/Framework",
685 # TODO(GYP) There is some XCode-only targets like ninja-breakpad.
690 public_configs = [ ":client_config" ]
693 source_set("breakpad_handler") {
694 configs += [ ":handler_config" ]
696 public_configs = [ ":handler_config" ]
699 defines = [ "BREAKPAD_NO_TERMINATE_THREAD" ]
702 "src/client/windows/crash_generation/client_info.cc",
703 "src/client/windows/crash_generation/client_info.h",
704 "src/client/windows/crash_generation/crash_generation_client.cc",
705 "src/client/windows/crash_generation/crash_generation_client.h",
706 "src/client/windows/crash_generation/crash_generation_server.cc",
707 "src/client/windows/crash_generation/crash_generation_server.h",
708 "src/client/windows/handler/exception_handler.cc",
709 "src/client/windows/handler/exception_handler.h",
710 "src/common/windows/guid_string.cc",
711 "src/common/windows/guid_string.h",
712 "src/google_breakpad/common/minidump_format.h",
713 "src/client/windows/crash_generation/minidump_generator.cc",
714 "src/client/windows/crash_generation/minidump_generator.h",
715 "src/common/windows/string_utils-inl.h",