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 # minidump_stackwalk and minidump_dump are tool-type executables that do
29 if (current_toolchain == host_toolchain && !is_win) {
30 executable("minidump_stackwalk") {
32 "src/processor/basic_code_module.h",
33 "src/processor/basic_code_modules.cc",
34 "src/processor/basic_code_modules.h",
35 "src/processor/basic_source_line_resolver.cc",
36 "src/processor/binarystream.cc",
37 "src/processor/binarystream.h",
38 "src/processor/call_stack.cc",
39 "src/processor/cfi_frame_info.cc",
40 "src/processor/cfi_frame_info.h",
41 "src/processor/disassembler_x86.cc",
42 "src/processor/disassembler_x86.h",
43 "src/processor/exploitability.cc",
44 "src/processor/logging.cc",
45 "src/processor/logging.h",
46 "src/processor/minidump.cc",
47 "src/processor/minidump_processor.cc",
48 "src/processor/minidump_stackwalk.cc",
49 "src/processor/pathname_stripper.cc",
50 "src/processor/pathname_stripper.h",
51 "src/processor/process_state.cc",
52 "src/processor/simple_symbol_supplier.cc",
53 "src/processor/simple_symbol_supplier.h",
54 "src/processor/source_line_resolver_base.cc",
55 "src/processor/stack_frame_cpu.cc",
56 "src/processor/stack_frame_symbolizer.cc",
57 "src/processor/stackwalker.cc",
58 "src/processor/stackwalker_amd64.cc",
59 "src/processor/stackwalker_amd64.h",
60 "src/processor/stackwalker_arm.cc",
61 "src/processor/stackwalker_arm.h",
62 "src/processor/stackwalker_arm64.cc",
63 "src/processor/stackwalker_arm64.h",
64 "src/processor/stackwalker_mips.cc",
65 "src/processor/stackwalker_mips.h",
66 "src/processor/stackwalker_ppc.cc",
67 "src/processor/stackwalker_ppc.h",
68 "src/processor/stackwalker_ppc64.cc",
69 "src/processor/stackwalker_ppc64.h",
70 "src/processor/stackwalker_sparc.cc",
71 "src/processor/stackwalker_sparc.h",
72 "src/processor/stackwalker_x86.cc",
73 "src/processor/stackwalker_x86.h",
74 "src/processor/tokenize.cc",
75 "src/processor/tokenize.h",
77 "src/third_party/libdisasm/ia32_implicit.c",
78 "src/third_party/libdisasm/ia32_implicit.h",
79 "src/third_party/libdisasm/ia32_insn.c",
80 "src/third_party/libdisasm/ia32_insn.h",
81 "src/third_party/libdisasm/ia32_invariant.c",
82 "src/third_party/libdisasm/ia32_invariant.h",
83 "src/third_party/libdisasm/ia32_modrm.c",
84 "src/third_party/libdisasm/ia32_modrm.h",
85 "src/third_party/libdisasm/ia32_opcode_tables.c",
86 "src/third_party/libdisasm/ia32_opcode_tables.h",
87 "src/third_party/libdisasm/ia32_operand.c",
88 "src/third_party/libdisasm/ia32_operand.h",
89 "src/third_party/libdisasm/ia32_reg.c",
90 "src/third_party/libdisasm/ia32_reg.h",
91 "src/third_party/libdisasm/ia32_settings.c",
92 "src/third_party/libdisasm/ia32_settings.h",
93 "src/third_party/libdisasm/libdis.h",
94 "src/third_party/libdisasm/qword.h",
95 "src/third_party/libdisasm/x86_disasm.c",
96 "src/third_party/libdisasm/x86_format.c",
97 "src/third_party/libdisasm/x86_imm.c",
98 "src/third_party/libdisasm/x86_imm.h",
99 "src/third_party/libdisasm/x86_insn.c",
100 "src/third_party/libdisasm/x86_misc.c",
101 "src/third_party/libdisasm/x86_operand_list.c",
102 "src/third_party/libdisasm/x86_operand_list.h",
105 defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" ]
107 configs -= [ "//build/config/compiler:chromium_code" ]
108 configs += [ "//build/config/compiler:no_chromium_code" ]
109 configs += [ ":tools_config" ]
111 # Always want these files included regardless of platform.
112 set_sources_assignment_filter([])
114 "src/processor/exploitability_linux.cc",
115 "src/processor/exploitability_linux.h",
116 "src/processor/exploitability_win.cc",
117 "src/processor/exploitability_win.h",
121 executable("minidump_dump") {
123 "src/processor/basic_code_module.h",
124 "src/processor/basic_code_modules.cc",
125 "src/processor/basic_code_modules.h",
126 "src/processor/logging.cc",
127 "src/processor/logging.h",
128 "src/processor/minidump.cc",
129 "src/processor/minidump_dump.cc",
130 "src/processor/pathname_stripper.cc",
131 "src/processor/pathname_stripper.h",
134 configs += [ ":tools_config" ]
138 # Mac --------------------------------------------------------------------------
140 if (current_toolchain == host_toolchain && is_mac) {
141 # TODO(GYP) This should be only 64-bit on Mac. From .gypi:
142 # Like ld, dump_syms needs to operate on enough data that it may
143 # actually need to be able to address more than 4GB. Use x86_64.
144 # Don't worry! An x86_64 dump_syms is perfectly able to dump
146 executable("dump_syms") {
148 "src/common/dwarf/bytereader.cc",
149 "src/common/dwarf_cfi_to_module.cc",
150 "src/common/dwarf_cu_to_module.cc",
151 "src/common/dwarf/dwarf2diehandler.cc",
152 "src/common/dwarf/dwarf2reader.cc",
153 "src/common/dwarf_line_to_module.cc",
154 "src/common/language.cc",
155 "src/common/mac/arch_utilities.cc",
156 "src/common/mac/arch_utilities.h",
157 "src/common/mac/dump_syms.mm",
158 "src/common/mac/file_id.cc",
159 "src/common/mac/macho_id.cc",
160 "src/common/mac/macho_reader.cc",
161 "src/common/mac/macho_utilities.cc",
162 "src/common/mac/macho_walker.cc",
164 "src/common/module.cc",
165 "src/common/stabs_reader.cc",
166 "src/common/stabs_to_module.cc",
167 "src/tools/mac/dump_syms/dump_syms_tool.mm",
170 # For src/common/stabs_reader.h.
171 defines = [ "HAVE_MACH_O_NLIST_H" ]
172 include_dirs = [ "src/common/mac" ]
174 # The DWARF utilities require -funsigned-char.
175 cflags = [ "-funsigned-char" ]
177 configs += [ ":internal_config" ]
179 configs -= [ "//build/config/compiler:chromium_code" ]
180 configs += [ "//build/config/compiler:no_chromium_code" ]
182 # dwarf2reader.cc uses dynamic_cast.
183 configs -= [ "//build/config/compiler:no_rtti" ]
184 configs += [ "//build/config/compiler:rtti" ]
186 libs = [ "Foundation.framework" ]
189 # dump_syms crashes when built at -O1, -O2, and -O3. It does
190 # not crash at -Os. To play it safe, dump_syms is always built
191 # at -O0 until this can be sorted out.
192 # http://code.google.com/p/google-breakpad/issues/detail?id=329
193 configs -= [ "//build/config/compiler:optimize" ]
198 executable("symupload") {
200 "src/common/mac/HTTPMultipartUpload.m",
201 "src/tools/mac/symupload/symupload.m",
204 libs = [ "Foundaction.framework" ]
209 static_library("breakpad_utilities") {
211 "src/client/mac/handler/breakpad_nlist_64.cc",
212 "src/client/mac/handler/dynamic_images.cc",
213 "src/client/mac/handler/minidump_generator.cc",
214 "src/client/minidump_file_writer.cc",
215 "src/common/convert_UTF.c",
216 "src/common/mac/MachIPC.mm",
217 "src/common/mac/arch_utilities.cc",
218 "src/common/mac/bootstrap_compat.cc",
219 "src/common/mac/file_id.cc",
220 "src/common/mac/macho_id.cc",
221 "src/common/mac/macho_utilities.cc",
222 "src/common/mac/macho_walker.cc",
223 "src/common/mac/string_utilities.cc",
225 "src/common/simple_string_dictionary.cc",
226 "src/common/string_conversion.cc",
229 configs += [ ":internal_config" ]
232 executable("crash_inspector") {
234 "src/client/mac/crash_generation/ConfigFile.mm",
235 "src/client/mac/crash_generation/Inspector.mm",
236 "src/client/mac/crash_generation/InspectorMain.mm",
239 # TODO(GYP): 'mac_real_dsym': 1,
242 "src/client/apple/Framework",
246 "CoreServices.framework",
247 "Foundation.framework",
251 ":breakpad_utilities"
255 executable("crash_report_sender") {
256 # TODO(GYP) this target has some mac_bundle_resources stuff.
259 config("breakpad_config") {
260 include_dirs = [ "src/client/apple/Framework" ]
263 static_library("breakpad") {
265 "src/client/mac/crash_generation/crash_generation_client.cc",
266 "src/client/mac/crash_generation/crash_generation_client.h",
267 "src/client/mac/handler/protected_memory_allocator.cc",
268 "src/client/mac/handler/exception_handler.cc",
269 "src/client/mac/Framework/Breakpad.mm",
270 "src/client/mac/Framework/OnDemandServer.mm",
273 configs += [ ":internal_config" ]
274 direct_dependent_configs = [ ":breakpad_config" ]
276 defines = [ "USE_PROTECTED_ALLOCATIONS=1" ]
278 "src/client/apple/Framework",
282 ":breakpad_utilities",
284 ":crash_report_sender",
289 if (is_linux || is_android) {
290 executable("symupload") {
292 "src/tools/linux/symupload/sym_upload.cc",
293 "src/common/linux/http_upload.cc",
294 "src/common/linux/http_upload.h",
302 configs += [ ":tools_config" ]
308 if (is_linux && current_toolchain == host_toolchain) {
309 executable("dump_syms") {
311 "src/common/dwarf/bytereader.cc",
312 "src/common/dwarf_cfi_to_module.cc",
313 "src/common/dwarf_cfi_to_module.h",
314 "src/common/dwarf_cu_to_module.cc",
315 "src/common/dwarf_cu_to_module.h",
316 "src/common/dwarf/dwarf2diehandler.cc",
317 "src/common/dwarf/dwarf2reader.cc",
318 "src/common/dwarf_line_to_module.cc",
319 "src/common/dwarf_line_to_module.h",
320 "src/common/language.cc",
321 "src/common/language.h",
322 "src/common/linux/crc32.cc",
323 "src/common/linux/crc32.h",
324 "src/common/linux/dump_symbols.cc",
325 "src/common/linux/dump_symbols.h",
326 "src/common/linux/elf_symbols_to_module.cc",
327 "src/common/linux/elf_symbols_to_module.h",
328 "src/common/linux/elfutils.cc",
329 "src/common/linux/elfutils.h",
330 "src/common/linux/file_id.cc",
331 "src/common/linux/file_id.h",
332 "src/common/linux/linux_libc_support.cc",
333 "src/common/linux/linux_libc_support.h",
334 "src/common/linux/memory_mapped_file.cc",
335 "src/common/linux/memory_mapped_file.h",
336 "src/common/linux/guid_creator.h",
337 "src/common/module.cc",
338 "src/common/module.h",
339 "src/common/stabs_reader.cc",
340 "src/common/stabs_reader.h",
341 "src/common/stabs_to_module.cc",
342 "src/common/stabs_to_module.h",
343 "src/tools/linux/dump_syms/dump_syms.cc",
346 # There are some warnings in this code.
347 configs -= [ "//build/config/compiler:chromium_code" ]
348 configs += [ "//build/config/compiler:no_chromium_code" ]
350 # dwarf2reader.cc uses dynamic_cast. Because we don't typically
351 # don't support RTTI, we enable it for this single target. Since
352 # dump_syms doesn't share any object files with anything else,
353 # this doesn't end up polluting Chrome itself.
354 configs -= [ "//build/config/compiler:no_rtti" ]
355 configs += [ "//build/config/compiler:rtti" ]
357 # Breakpad rev 583 introduced this flag.
358 # Using this define, stabs_reader.h will include a.out.h to
360 defines = [ "HAVE_A_OUT_H" ]
362 include_dirs = [ "src" ]
365 config("breakpad_client_config") {
367 include_dirs = [ "src/common/android/include" ]
371 static_library("breakpad_client") {
373 "src/client/linux/crash_generation/crash_generation_client.cc",
374 "src/client/linux/crash_generation/crash_generation_client.h",
375 "src/client/linux/handler/exception_handler.cc",
376 "src/client/linux/handler/exception_handler.h",
377 "src/client/linux/handler/minidump_descriptor.cc",
378 "src/client/linux/handler/minidump_descriptor.h",
379 "src/client/linux/log/log.cc",
380 "src/client/linux/log/log.h",
381 "src/client/linux/minidump_writer/cpu_set.h",
382 "src/client/linux/minidump_writer/directory_reader.h",
383 "src/client/linux/minidump_writer/line_reader.h",
384 "src/client/linux/minidump_writer/linux_core_dumper.cc",
385 "src/client/linux/minidump_writer/linux_core_dumper.h",
386 "src/client/linux/minidump_writer/linux_dumper.cc",
387 "src/client/linux/minidump_writer/linux_dumper.h",
388 "src/client/linux/minidump_writer/linux_ptrace_dumper.cc",
389 "src/client/linux/minidump_writer/linux_ptrace_dumper.h",
390 "src/client/linux/minidump_writer/minidump_writer.cc",
391 "src/client/linux/minidump_writer/minidump_writer.h",
392 "src/client/linux/minidump_writer/proc_cpuinfo_reader.h",
393 "src/client/minidump_file_writer-inl.h",
394 "src/client/minidump_file_writer.cc",
395 "src/client/minidump_file_writer.h",
396 "src/common/convert_UTF.c",
397 "src/common/convert_UTF.h",
398 "src/common/linux/elf_core_dump.cc",
399 "src/common/linux/elf_core_dump.h",
400 "src/common/linux/elfutils.cc",
401 "src/common/linux/elfutils.h",
402 "src/common/linux/file_id.cc",
403 "src/common/linux/file_id.h",
404 "src/common/linux/google_crashdump_uploader.cc",
405 "src/common/linux/google_crashdump_uploader.h",
406 "src/common/linux/guid_creator.cc",
407 "src/common/linux/guid_creator.h",
408 "src/common/linux/libcurl_wrapper.cc",
409 "src/common/linux/libcurl_wrapper.h",
410 "src/common/linux/linux_libc_support.cc",
411 "src/common/linux/linux_libc_support.h",
412 "src/common/linux/memory_mapped_file.cc",
413 "src/common/linux/memory_mapped_file.h",
414 "src/common/linux/safe_readlink.cc",
415 "src/common/linux/safe_readlink.h",
416 "src/common/memory.h",
417 "src/common/simple_string_dictionary.cc",
418 "src/common/simple_string_dictionary.h",
419 "src/common/string_conversion.cc",
420 "src/common/string_conversion.h",
423 direct_dependent_configs = [ ":breakpad_client_config" ]
425 # Android NDK toolchain doesn't support -mimplicit-it=always
426 if (cpu_arch == "arm" && !is_android) {
427 cflags = [ "-Wa,-mimplicit-it=always" ]
429 if (cpu_arch == "arm" && is_chromeos) {
430 # Avoid running out of registers in
431 # linux_syscall_support.h:sys_clone()'s inline assembly.
436 sources += [ "src/common/android/breakpad_getcontext.S" ]
445 "src/third_party/linux/include",
449 static_library("breakpad_processor_support") {
451 "src/common/scoped_ptr.h",
452 "src/processor/basic_code_modules.cc",
453 "src/processor/basic_code_modules.h",
454 "src/processor/logging.cc",
455 "src/processor/logging.h",
456 "src/processor/minidump.cc",
457 "src/processor/pathname_stripper.cc",
458 "src/processor/pathname_stripper.h",
464 "src/third_party/linux/include",
469 executable("breakpad_unittests") {
471 "linux/breakpad_googletest_includes.h",
472 "src/client/linux/handler/exception_handler_unittest.cc",
473 "src/client/linux/minidump_writer/cpu_set_unittest.cc",
474 "src/client/linux/minidump_writer/directory_reader_unittest.cc",
475 "src/client/linux/minidump_writer/line_reader_unittest.cc",
476 "src/client/linux/minidump_writer/linux_core_dumper_unittest.cc",
477 "src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc",
478 "src/client/linux/minidump_writer/minidump_writer_unittest.cc",
479 "src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
480 "src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
481 "src/common/linux/elf_core_dump_unittest.cc",
482 "src/common/linux/file_id_unittest.cc",
483 "src/common/linux/linux_libc_support_unittest.cc",
484 "src/common/linux/synth_elf.cc",
485 "src/common/linux/tests/auto_testfile.h",
486 "src/common/linux/tests/crash_generator.cc",
487 "src/common/linux/tests/crash_generator.h",
488 "src/common/memory_range.h",
489 "src/common/memory_unittest.cc",
490 "src/common/simple_string_dictionary_unittest.cc",
491 "src/common/test_assembler.cc",
492 "src/common/tests/file_utils.cc",
493 "src/common/tests/file_utils.h",
494 "src/tools/linux/md2core/minidump_memory_range.h",
495 "src/tools/linux/md2core/minidump_memory_range_unittest.cc",
500 ":breakpad_processor_support",
501 ":linux_dumper_unittest_helper",
503 "//testing/gtest:gtest_main",
508 "linux", # Use our copy of breakpad_googletest_includes.h
513 # There are some warnings in this code.
514 configs -= [ "//build/config/compiler:chromium_code" ]
515 configs += [ "//build/config/compiler:no_chromium_code" ]
518 # See http://crbug.com/138571#c18
519 cflags = [ "-Wno-unused-value" ]
524 sources += [ "src/common/android/breakpad_getcontext_unittest.cc" ]
526 include_dirs = [ "src/common/android/include" ]
530 executable("linux_dumper_unittest_helper") {
532 "src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc",
535 ":breakpad_processor_support",
542 if (cpu_arch == "mipsel" && is_android) {
543 include_dirs += [ "src/common/android/include" ]
548 executable("generate_test_dump") {
550 "linux/generate-test-dump.cc",
553 # This file has an unused variable warning.
554 cflags = [ "-Wno-unused-variable" ]
556 deps = [ ":breakpad_client" ]
558 include_dirs = [ "src" ]
562 include_dirs += [ "src/common/android/include" ]
566 executable("minidump-2-core") {
567 sources = [ "src/tools/linux/md2core/minidump-2-core.cc" ]
569 include_dirs = [ "src" ]
571 deps = [ ":breakpad_client" ]
574 executable("core-2-minidump") {
576 "src/tools/linux/core2md/core2md.cc",
583 include_dirs = [ "src" ]
588 static_library("breakpad_client") {
590 "src/client/ios/Breakpad.h",
591 "src/client/ios/Breakpad.mm",
592 "src/client/ios/BreakpadController.h",
593 "src/client/ios/BreakpadController.mm",
594 "src/client/ios/handler/ios_exception_minidump_generator.mm",
595 "src/client/ios/handler/ios_exception_minidump_generator.h",
596 "src/client/mac/crash_generation/ConfigFile.h",
597 "src/client/mac/crash_generation/ConfigFile.mm",
598 "src/client/mac/handler/breakpad_nlist_64.cc",
599 "src/client/mac/handler/breakpad_nlist_64.h",
600 "src/client/mac/handler/dynamic_images.cc",
601 "src/client/mac/handler/dynamic_images.h",
602 "src/client/mac/handler/protected_memory_allocator.cc",
603 "src/client/mac/handler/protected_memory_allocator.h",
604 "src/client/mac/handler/exception_handler.cc",
605 "src/client/mac/handler/exception_handler.h",
606 "src/client/mac/handler/minidump_generator.cc",
607 "src/client/mac/handler/minidump_generator.h",
608 "src/client/mac/sender/uploader.h",
609 "src/client/mac/sender/uploader.mm",
610 "src/client/minidump_file_writer.cc",
611 "src/client/minidump_file_writer.h",
612 "src/client/minidump_file_writer-inl.h",
613 "src/common/convert_UTF.c",
614 "src/common/convert_UTF.h",
615 "src/common/mac/file_id.cc",
616 "src/common/mac/file_id.h",
617 "src/common/mac/HTTPMultipartUpload.m",
618 "src/common/mac/macho_id.cc",
619 "src/common/mac/macho_id.h",
620 "src/common/mac/macho_utilities.cc",
621 "src/common/mac/macho_utilities.h",
622 "src/common/mac/macho_walker.cc",
623 "src/common/mac/macho_walker.h",
624 "src/common/mac/string_utilities.cc",
625 "src/common/mac/string_utilities.h",
628 "src/common/simple_string_dictionary.cc",
629 "src/common/simple_string_dictionary.h",
630 "src/common/string_conversion.cc",
631 "src/common/string_conversion.h",
632 "src/google_breakpad/common/minidump_format.h",
637 "src/client/mac/Framework",
642 # TODO(GYP) There is some XCode-only targets like ninja-breakpad.