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/handler/exception_handler.cc",
403 "src/client/linux/handler/exception_handler.h",
404 "src/client/linux/handler/minidump_descriptor.cc",
405 "src/client/linux/handler/minidump_descriptor.h",
406 "src/client/linux/log/log.cc",
407 "src/client/linux/log/log.h",
408 "src/client/linux/minidump_writer/cpu_set.h",
409 "src/client/linux/minidump_writer/directory_reader.h",
410 "src/client/linux/minidump_writer/line_reader.h",
411 "src/client/linux/minidump_writer/linux_core_dumper.cc",
412 "src/client/linux/minidump_writer/linux_core_dumper.h",
413 "src/client/linux/minidump_writer/linux_dumper.cc",
414 "src/client/linux/minidump_writer/linux_dumper.h",
415 "src/client/linux/minidump_writer/linux_ptrace_dumper.cc",
416 "src/client/linux/minidump_writer/linux_ptrace_dumper.h",
417 "src/client/linux/minidump_writer/minidump_writer.cc",
418 "src/client/linux/minidump_writer/minidump_writer.h",
419 "src/client/linux/minidump_writer/proc_cpuinfo_reader.h",
420 "src/client/minidump_file_writer-inl.h",
421 "src/client/minidump_file_writer.cc",
422 "src/client/minidump_file_writer.h",
423 "src/common/convert_UTF.c",
424 "src/common/convert_UTF.h",
425 "src/common/linux/elf_core_dump.cc",
426 "src/common/linux/elf_core_dump.h",
427 "src/common/linux/elfutils.cc",
428 "src/common/linux/elfutils.h",
429 "src/common/linux/file_id.cc",
430 "src/common/linux/file_id.h",
431 "src/common/linux/google_crashdump_uploader.cc",
432 "src/common/linux/google_crashdump_uploader.h",
433 "src/common/linux/guid_creator.cc",
434 "src/common/linux/guid_creator.h",
435 "src/common/linux/libcurl_wrapper.cc",
436 "src/common/linux/libcurl_wrapper.h",
437 "src/common/linux/linux_libc_support.cc",
438 "src/common/linux/linux_libc_support.h",
439 "src/common/linux/memory_mapped_file.cc",
440 "src/common/linux/memory_mapped_file.h",
441 "src/common/linux/safe_readlink.cc",
442 "src/common/linux/safe_readlink.h",
443 "src/common/memory.h",
444 "src/common/simple_string_dictionary.cc",
445 "src/common/simple_string_dictionary.h",
446 "src/common/string_conversion.cc",
447 "src/common/string_conversion.h",
450 configs -= [ "//build/config/compiler:chromium_code" ]
451 configs += [ "//build/config/compiler:no_chromium_code" ]
452 public_configs = [ ":client_config" ]
454 if (cpu_arch == "arm" && is_chromeos) {
455 # Avoid running out of registers in
456 # linux_syscall_support.h:sys_clone()'s inline assembly.
461 sources += [ "src/common/android/breakpad_getcontext.S" ]
470 "src/third_party/linux/include",
474 static_library("processor_support") {
476 "src/common/scoped_ptr.h",
477 "src/processor/basic_code_modules.cc",
478 "src/processor/basic_code_modules.h",
479 "src/processor/dump_context.cc",
480 "src/processor/dump_object.cc",
481 "src/processor/logging.cc",
482 "src/processor/logging.h",
483 "src/processor/minidump.cc",
484 "src/processor/pathname_stripper.cc",
485 "src/processor/pathname_stripper.h",
491 "src/third_party/linux/include",
495 # There are some warnings in this code.
496 configs -= [ "//build/config/compiler:chromium_code" ]
497 configs += [ "//build/config/compiler:no_chromium_code" ]
502 test("breakpad_unittests") {
504 "linux/breakpad_googletest_includes.h",
505 "src/client/linux/handler/exception_handler_unittest.cc",
506 "src/client/linux/minidump_writer/cpu_set_unittest.cc",
507 "src/client/linux/minidump_writer/directory_reader_unittest.cc",
508 "src/client/linux/minidump_writer/line_reader_unittest.cc",
509 "src/client/linux/minidump_writer/linux_core_dumper_unittest.cc",
510 "src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc",
511 "src/client/linux/minidump_writer/minidump_writer_unittest.cc",
512 "src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
513 "src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
514 "src/common/linux/elf_core_dump_unittest.cc",
515 "src/common/linux/file_id_unittest.cc",
516 "src/common/linux/linux_libc_support_unittest.cc",
517 "src/common/linux/synth_elf.cc",
518 "src/common/linux/tests/auto_testfile.h",
519 "src/common/linux/tests/crash_generator.cc",
520 "src/common/linux/tests/crash_generator.h",
521 "src/common/memory_range.h",
522 "src/common/memory_unittest.cc",
523 "src/common/simple_string_dictionary_unittest.cc",
524 "src/common/test_assembler.cc",
525 "src/common/tests/file_utils.cc",
526 "src/common/tests/file_utils.h",
527 "src/tools/linux/md2core/minidump_memory_range.h",
528 "src/tools/linux/md2core/minidump_memory_range_unittest.cc",
533 ":processor_support",
534 ":linux_dumper_unittest_helper",
536 "//testing/gtest:gtest_main",
541 "linux", # Use our copy of breakpad_googletest_includes.h
546 # There are some warnings in this code.
547 configs -= [ "//build/config/compiler:chromium_code" ]
548 configs += [ "//build/config/compiler:no_chromium_code" ]
551 # See http://crbug.com/138571#c18
552 cflags = [ "-Wno-unused-value" ]
557 sources += [ "src/common/android/breakpad_getcontext_unittest.cc" ]
559 include_dirs += [ "src/common/android/include" ]
563 executable("linux_dumper_unittest_helper") {
566 "src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc",
569 ":processor_support",
576 if (cpu_arch == "mipsel" && is_android) {
577 include_dirs += [ "src/common/android/include" ]
582 executable("generate_test_dump") {
585 "linux/generate-test-dump.cc",
588 # This file has an unused variable warning.
589 configs -= [ "//build/config/compiler:chromium_code" ]
590 configs += [ "//build/config/compiler:no_chromium_code" ]
594 include_dirs = [ "src" ]
598 include_dirs += [ "src/common/android/include" ]
602 executable("minidump-2-core") {
603 sources = [ "src/tools/linux/md2core/minidump-2-core.cc" ]
605 include_dirs = [ "src" ]
610 executable("core-2-minidump") {
612 "src/tools/linux/core2md/core2md.cc",
619 include_dirs = [ "src" ]
624 static_library("client") {
626 "src/client/ios/Breakpad.h",
627 "src/client/ios/Breakpad.mm",
628 "src/client/ios/BreakpadController.h",
629 "src/client/ios/BreakpadController.mm",
630 "src/client/ios/handler/ios_exception_minidump_generator.mm",
631 "src/client/ios/handler/ios_exception_minidump_generator.h",
632 "src/client/mac/crash_generation/ConfigFile.h",
633 "src/client/mac/crash_generation/ConfigFile.mm",
634 "src/client/mac/handler/breakpad_nlist_64.cc",
635 "src/client/mac/handler/breakpad_nlist_64.h",
636 "src/client/mac/handler/dynamic_images.cc",
637 "src/client/mac/handler/dynamic_images.h",
638 "src/client/mac/handler/protected_memory_allocator.cc",
639 "src/client/mac/handler/protected_memory_allocator.h",
640 "src/client/mac/handler/exception_handler.cc",
641 "src/client/mac/handler/exception_handler.h",
642 "src/client/mac/handler/minidump_generator.cc",
643 "src/client/mac/handler/minidump_generator.h",
644 "src/client/mac/sender/uploader.h",
645 "src/client/mac/sender/uploader.mm",
646 "src/client/minidump_file_writer.cc",
647 "src/client/minidump_file_writer.h",
648 "src/client/minidump_file_writer-inl.h",
649 "src/common/convert_UTF.c",
650 "src/common/convert_UTF.h",
651 "src/common/mac/file_id.cc",
652 "src/common/mac/file_id.h",
653 "src/common/mac/HTTPMultipartUpload.m",
654 "src/common/mac/macho_id.cc",
655 "src/common/mac/macho_id.h",
656 "src/common/mac/macho_utilities.cc",
657 "src/common/mac/macho_utilities.h",
658 "src/common/mac/macho_walker.cc",
659 "src/common/mac/macho_walker.h",
660 "src/common/mac/string_utilities.cc",
661 "src/common/mac/string_utilities.h",
664 "src/common/simple_string_dictionary.cc",
665 "src/common/simple_string_dictionary.h",
666 "src/common/string_conversion.cc",
667 "src/common/string_conversion.h",
668 "src/google_breakpad/common/minidump_format.h",
673 "src/client/mac/Framework",
678 # TODO(GYP) There is some XCode-only targets like ninja-breakpad.
683 public_configs = [ ":client_config" ]
686 source_set("breakpad_handler") {
687 configs += [ ":handler_config" ]
689 public_configs = [ ":handler_config" ]
692 defines = [ "BREAKPAD_NO_TERMINATE_THREAD" ]
695 "src/client/windows/crash_generation/client_info.cc",
696 "src/client/windows/crash_generation/client_info.h",
697 "src/client/windows/crash_generation/crash_generation_client.cc",
698 "src/client/windows/crash_generation/crash_generation_client.h",
699 "src/client/windows/crash_generation/crash_generation_server.cc",
700 "src/client/windows/crash_generation/crash_generation_server.h",
701 "src/client/windows/handler/exception_handler.cc",
702 "src/client/windows/handler/exception_handler.h",
703 "src/common/windows/guid_string.cc",
704 "src/common/windows/guid_string.h",
705 "src/google_breakpad/common/minidump_format.h",
706 "src/client/windows/crash_generation/minidump_generator.cc",
707 "src/client/windows/crash_generation/minidump_generator.h",
708 "src/common/windows/string_utils-inl.h",