chromeos: Move some network related UI in ui/chromeos/
[chromium-blink-merge.git] / breakpad / BUILD.gn
blob2c0ae49abbde09b0922b004f451e26cac916793f
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" ]
7   if (is_android) {
8     defines = [ "__ANDROID__" ]
9   }
10   if (is_clang) {
11     cflags = [ "-Wno-tautological-constant-out-of-range-compare" ]
12   }
15 config("internal_config") {
16   include_dirs = [ "src" ]
17   defines = []
18   if (is_debug) {
19     # This is needed for GTMLogger to work correctly.
20     defines += [ "DEBUG" ]
21   }
22   if (is_android) {
23     defines += [ "__ANDROID__" ]
24   }
27 # minidump_stackwalk and minidump_dump are tool-type executables that do
28 # not build on iOS.
29 if (current_toolchain == host_toolchain && !is_win) {
30   executable("minidump_stackwalk") {
31     sources = [
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",
76       # libdisasm
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",
103     ]
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([])
113     sources += [
114       "src/processor/exploitability_linux.cc",
115       "src/processor/exploitability_linux.h",
116       "src/processor/exploitability_win.cc",
117       "src/processor/exploitability_win.h",
118     ]
119   }
121   executable("minidump_dump") {
122     sources = [
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",
132     ]
134     configs += [ ":tools_config" ]
135   }
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
145   # 32-bit files.
146   executable("dump_syms") {
147     sources = [
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",
163       "src/common/md5.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",
168     ]
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" ]
188     if (!is_debug) {
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" ]
194       cflags += [ "-O0" ]
195     }
196   }
198   executable("symupload") {
199     sources = [
200       "src/common/mac/HTTPMultipartUpload.m",
201       "src/tools/mac/symupload/symupload.m",
202     ]
204     libs = [ "Foundaction.framework" ]
205   }
208 if (is_mac) {
209   static_library("breakpad_utilities") {
210     sources = [
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",
224       "src/common/md5.cc",
225       "src/common/simple_string_dictionary.cc",
226       "src/common/string_conversion.cc",
227     ]
229     configs += [ ":internal_config" ]
230   }
232   executable("crash_inspector") {
233     sources = [
234       "src/client/mac/crash_generation/ConfigFile.mm",
235       "src/client/mac/crash_generation/Inspector.mm",
236       "src/client/mac/crash_generation/InspectorMain.mm",
237     ]
239     # TODO(GYP): 'mac_real_dsym': 1,
241     include_dirs = [
242       "src/client/apple/Framework",
243       "src/common/mac",
244     ]
245     libs = [
246       "CoreServices.framework",
247       "Foundation.framework",
248     ]
250     deps = [
251       ":breakpad_utilities"
252     ]
253   }
255   executable("crash_report_sender") {
256     # TODO(GYP) this target has some mac_bundle_resources stuff.
257   }
259   config("breakpad_config") {
260     include_dirs = [ "src/client/apple/Framework" ]
261   }
263   static_library("breakpad") {
264     sources = [
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",
271     ]
273     configs += [ ":internal_config" ]
274     direct_dependent_configs = [ ":breakpad_config" ]
276     defines = [ "USE_PROTECTED_ALLOCATIONS=1" ]
277     include_dirs = [
278       "src/client/apple/Framework",
279     ]
281     deps = [
282       ":breakpad_utilities",
283       ":crash_inspector",
284       ":crash_report_sender",
285     ]
286   }
289 if (is_linux || is_android) {
290   executable("symupload") {
291     sources = [
292       "src/tools/linux/symupload/sym_upload.cc",
293       "src/common/linux/http_upload.cc",
294       "src/common/linux/http_upload.h",
295     ]
297     include_dirs = [
298       "src",
299       "src/third_party",
300     ]
302     configs += [ ":tools_config" ]
304     libs = [ "dl" ]
305   }
308 if (is_linux && current_toolchain == host_toolchain) {
309   executable("dump_syms") {
310     sources = [
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",
344     ]
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
359     # build on Linux.
360     defines = [ "HAVE_A_OUT_H" ]
362     include_dirs = [ "src" ]
363   }
365   config("breakpad_client_config") {
366     if (is_android) {
367       include_dirs = [ "src/common/android/include" ]
368     }
369   }
371   static_library("breakpad_client") {
372     sources = [
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",
421     ]
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" ]
428     }
429     if (cpu_arch == "arm" && is_chromeos) {
430       # Avoid running out of registers in
431       # linux_syscall_support.h:sys_clone()'s inline assembly.
432       cflags = [ "-marm" ]
433     }
435     if (is_android) {
436       sources += [ "src/common/android/breakpad_getcontext.S" ]
437     }
439     libs = [ "dl" ]
441     include_dirs = [
442       ".",
443       "src",
444       "src/client",
445       "src/third_party/linux/include",
446     ]
447   }
449   static_library("breakpad_processor_support") {
450     sources = [
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",
459     ]
461     include_dirs = [
462       "src",
463       "src/client",
464       "src/third_party/linux/include",
465       ".",
466     ]
467   }
469   executable("breakpad_unittests") {
470     sources = [
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",
496     ]
498     deps = [
499       ":breakpad_client",
500       ":breakpad_processor_support",
501       ":linux_dumper_unittest_helper",
502       "//testing/gtest",
503       "//testing/gtest:gtest_main",
504       "//testing/gmock",
505     ]
507     include_dirs = [
508       "linux",  # Use our copy of breakpad_googletest_includes.h
509       "src",
510       ".",
511     ]
513     # There are some warnings in this code.
514     configs -= [ "//build/config/compiler:chromium_code" ]
515     configs += [ "//build/config/compiler:no_chromium_code" ]
517     if (is_clang) {
518       # See http://crbug.com/138571#c18
519       cflags = [ "-Wno-unused-value" ]
520     }
523     if (is_android) {
524       sources += [ "src/common/android/breakpad_getcontext_unittest.cc" ]
525       libs = [ "log" ]
526       include_dirs = [ "src/common/android/include" ]
527     }
528   }
530   executable("linux_dumper_unittest_helper") {
531     sources = [
532       "src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc",
533     ]
534     deps = [
535       ":breakpad_processor_support",
536     ]
538     include_dirs = [
539       "src",
540     ]
542     if (cpu_arch == "mipsel" && is_android) {
543       include_dirs += [ "src/common/android/include" ]
544     }
545   }
548   executable("generate_test_dump") {
549     sources = [
550       "linux/generate-test-dump.cc",
551     ]
553     # This file has an unused variable warning.
554     cflags = [ "-Wno-unused-variable" ]
556     deps = [ ":breakpad_client" ]
558     include_dirs = [ "src" ]
560     if (is_android) {
561       libs = [ "log" ]
562       include_dirs += [ "src/common/android/include" ]
563     }
564   }
566   executable("minidump-2-core") {
567     sources = [ "src/tools/linux/md2core/minidump-2-core.cc" ]
569     include_dirs = [ "src" ]
571     deps = [ ":breakpad_client" ]
572   }
574   executable("core-2-minidump") {
575     sources = [
576       "src/tools/linux/core2md/core2md.cc",
577     ]
579     deps = [
580       ":breakpad_client",
581     ]
583     include_dirs = [ "src" ]
584   }
587 if (is_ios) {
588   static_library("breakpad_client") {
589     sources = [
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",
626       "src/common/md5.cc",
627       "src/common/md5.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",
633     ]
635     include_dirs = [
636       "src",
637       "src/client/mac/Framework",
638       "src/common/mac",
639     ]
640   }
642   # TODO(GYP) There is some XCode-only targets like ninja-breakpad.