forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.gn
1319 lines (1186 loc) · 51.1 KB
/
BUILD.gn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/rust.gni")
import("//build/symlink.gni")
import("//build/toolchain/toolchain.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")
if (is_win) {
import("//build/config/win/visual_studio_version.gni")
}
# Breakpad executables are only built with the system allocator toolchains,
# because when built with PartitionAlloc-Everywhere enabled, we see that they
# OOM and crash: https://crbug.com/345514993.
#
# IMPORTANT: The executables here may almost all be built for the *host*
# machine, not the target machine. However they are still built into the
# root_build_dir where normally you'd find the outputs of the default_toolchain
# which are meant to run on the *target* machine. This is quite abnormal, but
# our GN dependencies and test scripts expect the binary to be in the
# root_build_dir, and expect to run it on the host machine any time the tests
# are run in a VM or on a device (such as IOS, Android, and ChromeOS). In other
# cases, where the test launcher is the same as the target (such as any desktop
# platform), we expect to run it on the target machine.
#
# As such, if the executables are built for the default toolchain, they will be
# built with the host or the default toolchain's settings depending on if we
# expect the tests to be launched from the target machine or from a host
# machine. Then they are copied up to the `root_out_dir` of the
# `default_toolchain.
#
# TODO(danakj): There is no support for building these on host A, launching
# tests on host B, and running tests on target C, where A and B are different
# machine types. This may become a problem on iOS for blink_web_tests, as on iOS
# we may build on x86, upload/launch tests from arm64, and run tests on iOS
# device. In that case, the host_toolchain is x86-mac, the default_toolchain
# arm64-ios. But there's a third arm64-mac toolchain which
# _tests_launcher_toolchain should point at, but it's not clear what that is
# called in GN. It's not the default or the host toolchain. One possibility to
# support this would be to make the host_system_allocator_toolchain build a
# multi architecture binary that supports both arm64 and x64 and treat the host
# as the test-launcher machine for iOS.
#
# IMPORTANT ALSO: symupload is different and special. This particular binary is
# run by official build bots after compiling. It is always run on the host
# machine, not the test-launcher machine. The official bots build and run
# `symupload` in the default toolchain, so that binary must redirect from the
# default toolchain to the *host* and not to the test laucher.
#
# TODO(danakj): It would be nice to move the host-targeting `symupload` to a
# different directory that still remains fixed. Maybe something like
# `out/Release/host/symupload`. But that will require:
# - building it into both places temporarily
# - updating a bunch of scripts in internal repositories.
# - remove it from the default toolchain's outdir.
if (is_ios || is_android || is_chromeos) {
_tests_launcher_toolchain = host_system_allocator_toolchain
_tests_launcher_toolchain_has_exe_suffix = host_os == "win"
_include_google_converter = true
} else if (is_win && (current_cpu == "arm" || current_cpu == "arm64")) {
# In a build for Windows-ARM, we choose between building things for the host
# machine, or for the target machine (Windows ARM64). If the host machine is
# Linux, then there is a problem with each of these:
# - If using the host (Linux), the `google_converter` tool can not be built as
# it only has build rules for Windows.
# - If using the target (Windows ARM64), compilation will fail as these tools
# simply do not build in that configuration.
#
# So we build these tools for the host machine. If the host is Windows-x64,
# the resulting binaries can still be run on the target. If the host is Linux,
# they can not, but we have no Linux-to-Windows-ARM builders at this time.
#
# The `google_converter` executable must be excluded from the build if the
# host is not Windows, as there's no way to build it for the host then.
#
# TODO(danakj): We could build these for "x86" cpu system-allocator instead,
# if we could find that toolchain. We don't want to do some hacky
# string-concat stuff here to invent the toolchain name, so we would want to
# add a `win_x86_system_allocator_toolchain` variable. See
# https://crrev.com/c/5690512/5 for this solution.
_tests_launcher_toolchain = host_system_allocator_toolchain
_tests_launcher_toolchain_has_exe_suffix = host_os == "win"
_include_google_converter = host_os == "win"
} else {
_tests_launcher_toolchain = default_system_allocator_toolchain
_tests_launcher_toolchain_has_exe_suffix = current_os == "win"
_include_google_converter = true
}
_symupload_toolchain = host_system_allocator_toolchain
_symupload_toolchain_has_exe_suffix = host_os == "win"
# Copies an executable target to the root directory of the current toolchain.
# Used to copy from another toolchain. This requires that the executable is
# built without component build enabled (see comment in //build/symlink.gni),
# which is true for the `host_system_allocator_toolchain` and
# `default_system_allocator_toolchain` toolchains in order to support this use
# case.
template("copy_exe") {
_build = true
if (defined(invoker.fuzzer) && invoker.fuzzer) {
# TODO(danakj): The fuzzer_test() template sometimes doesn't generate
# anything, but we can't tell from here whether it did or not. We can only
# depend on the target when it will build something. It should provide some
# way to know if it builds. For now we know that the fuzzer_test in this
# file is not built with `high_end_fuzzer_targets`.
if ((!use_libfuzzer && !use_centipede) || high_end_fuzzer_targets) {
_build = false
}
}
if (_build) {
if (invoker.has_exe_suffix) {
_exe = ".exe"
} else {
_exe = ""
}
copy(target_name) {
forward_variables_from(invoker,
TESTONLY_AND_VISIBILITY + [ "public_deps" ])
public_deps = [ invoker.target ]
sources = [ get_label_info(invoker.target, "root_out_dir") + "/" +
get_label_info(invoker.target, "name") + _exe ]
outputs = [ "$root_out_dir/{{source_file_part}}" ]
}
} else {
not_needed(invoker, "*")
not_needed([ "target_name" ])
}
}
config("tools_config") {
include_dirs = [
"breakpad/src",
"breakpad/src/third_party",
]
if (is_android) {
defines = [ "__ANDROID__" ]
}
if (is_clang) {
cflags = [ "-Wno-tautological-constant-out-of-range-compare" ]
}
}
config("internal_config") {
include_dirs = [ "breakpad/src" ]
defines = []
if (is_debug) {
# This is needed for GTMLogger to work correctly.
defines += [ "DEBUG" ]
}
if (is_android) {
defines += [ "__ANDROID__" ]
}
}
config("client_config") {
include_dirs = [ "breakpad/src" ]
if (is_android) {
include_dirs += [ "breakpad/src/common/android/include" ]
}
if (is_chromeos_ash) {
defines = [ "__CHROMEOS__" ]
}
}
config("handler_config") {
include_dirs = [ "breakpad/src" ]
}
config("sender_config") {
include_dirs = [ "breakpad/src" ]
}
config("breakpad_unittest_config") {
# One of the breakpad unit tests test that we can detect the proper build-id.
# We must override the build-id for this one target.
ldflags = [ "-Wl,--build-id=0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" ]
}
config("default_logging_severity_config") {
defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" ]
}
config("fuzzing_logging_severity_config") {
defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_CRITICAL" ]
}
default_breakpad_configs = [ ":tools_config" ]
if (use_fuzzing_engine) {
default_breakpad_configs += [ ":fuzzing_logging_severity_config" ]
} else {
default_breakpad_configs += [ ":default_logging_severity_config" ]
}
# {micro,mini}dump_stackwalk and minidump_dump are tool-type executables
# that do not build on Windows.
if (!is_win) {
if (current_toolchain == host_system_allocator_toolchain ||
current_toolchain == default_system_allocator_toolchain) {
# Contains the code shared by both {micro,mini}dump_stackwalk.
static_library("stackwalk_common") {
# Binaries that use this library are not debugged frequently and
# performance is vastly reduced without optimizations. So, force maximum
# optimization to get the lowest runtimes in Chromium tests that use these
# tools. These can be removed locally if debugging is actually needed.
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
sources = [
"breakpad/src/common/path_helper.cc",
"breakpad/src/common/path_helper.h",
"breakpad/src/common/scoped_ptr.h",
"breakpad/src/processor/basic_code_module.h",
"breakpad/src/processor/basic_code_modules.cc",
"breakpad/src/processor/basic_code_modules.h",
"breakpad/src/processor/basic_source_line_resolver.cc",
"breakpad/src/processor/call_stack.cc",
"breakpad/src/processor/cfi_frame_info.cc",
"breakpad/src/processor/cfi_frame_info.h",
"breakpad/src/processor/convert_old_arm64_context.cc",
"breakpad/src/processor/convert_old_arm64_context.h",
"breakpad/src/processor/disassembler_x86.cc",
"breakpad/src/processor/disassembler_x86.h",
"breakpad/src/processor/dump_context.cc",
"breakpad/src/processor/dump_object.cc",
"breakpad/src/processor/logging.cc",
"breakpad/src/processor/logging.h",
"breakpad/src/processor/pathname_stripper.cc",
"breakpad/src/processor/pathname_stripper.h",
"breakpad/src/processor/proc_maps_linux.cc",
"breakpad/src/processor/process_state.cc",
"breakpad/src/processor/simple_symbol_supplier.cc",
"breakpad/src/processor/simple_symbol_supplier.h",
"breakpad/src/processor/source_line_resolver_base.cc",
"breakpad/src/processor/stack_frame_cpu.cc",
"breakpad/src/processor/stack_frame_symbolizer.cc",
"breakpad/src/processor/stackwalk_common.cc",
"breakpad/src/processor/stackwalker.cc",
"breakpad/src/processor/stackwalker_amd64.cc",
"breakpad/src/processor/stackwalker_amd64.h",
"breakpad/src/processor/stackwalker_arm.cc",
"breakpad/src/processor/stackwalker_arm.h",
"breakpad/src/processor/stackwalker_arm64.cc",
"breakpad/src/processor/stackwalker_arm64.h",
"breakpad/src/processor/stackwalker_mips.cc",
"breakpad/src/processor/stackwalker_mips.h",
"breakpad/src/processor/stackwalker_ppc.cc",
"breakpad/src/processor/stackwalker_ppc.h",
"breakpad/src/processor/stackwalker_ppc64.cc",
"breakpad/src/processor/stackwalker_ppc64.h",
"breakpad/src/processor/stackwalker_riscv.cc",
"breakpad/src/processor/stackwalker_riscv.h",
"breakpad/src/processor/stackwalker_riscv64.cc",
"breakpad/src/processor/stackwalker_riscv64.h",
"breakpad/src/processor/stackwalker_sparc.cc",
"breakpad/src/processor/stackwalker_sparc.h",
"breakpad/src/processor/stackwalker_x86.cc",
"breakpad/src/processor/stackwalker_x86.h",
"breakpad/src/processor/tokenize.cc",
"breakpad/src/processor/tokenize.h",
# libdisasm
"breakpad/src/third_party/libdisasm/ia32_implicit.c",
"breakpad/src/third_party/libdisasm/ia32_implicit.h",
"breakpad/src/third_party/libdisasm/ia32_insn.c",
"breakpad/src/third_party/libdisasm/ia32_insn.h",
"breakpad/src/third_party/libdisasm/ia32_invariant.c",
"breakpad/src/third_party/libdisasm/ia32_invariant.h",
"breakpad/src/third_party/libdisasm/ia32_modrm.c",
"breakpad/src/third_party/libdisasm/ia32_modrm.h",
"breakpad/src/third_party/libdisasm/ia32_opcode_tables.c",
"breakpad/src/third_party/libdisasm/ia32_opcode_tables.h",
"breakpad/src/third_party/libdisasm/ia32_operand.c",
"breakpad/src/third_party/libdisasm/ia32_operand.h",
"breakpad/src/third_party/libdisasm/ia32_reg.c",
"breakpad/src/third_party/libdisasm/ia32_reg.h",
"breakpad/src/third_party/libdisasm/ia32_settings.c",
"breakpad/src/third_party/libdisasm/ia32_settings.h",
"breakpad/src/third_party/libdisasm/libdis.h",
"breakpad/src/third_party/libdisasm/qword.h",
"breakpad/src/third_party/libdisasm/x86_disasm.c",
"breakpad/src/third_party/libdisasm/x86_format.c",
"breakpad/src/third_party/libdisasm/x86_imm.c",
"breakpad/src/third_party/libdisasm/x86_imm.h",
"breakpad/src/third_party/libdisasm/x86_insn.c",
"breakpad/src/third_party/libdisasm/x86_misc.c",
"breakpad/src/third_party/libdisasm/x86_operand_list.c",
"breakpad/src/third_party/libdisasm/x86_operand_list.h",
]
if (is_linux || is_chromeos) {
sources += [
"breakpad/src/common/linux/scoped_pipe.cc",
"breakpad/src/common/linux/scoped_pipe.h",
"breakpad/src/common/linux/scoped_tmpfile.cc",
"breakpad/src/common/linux/scoped_tmpfile.h",
]
}
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += default_breakpad_configs
}
fuzzer_test("minidump_fuzzer") {
sources = [
"breakpad/src/processor/exploitability.cc",
"breakpad/src/processor/minidump.cc",
"breakpad/src/processor/minidump_processor.cc",
"minidump_fuzzer.cc",
]
deps = [
":stackwalk_common",
"//base",
]
additional_configs = [ ":fuzzing_logging_severity_config" ]
include_dirs = [ "breakpad/src" ]
libfuzzer_options = [
# Suppress stdout from stackwalk_common, as it uses printf() directly.
"close_fd_mask=1",
"max_len=128000",
]
sources += [
"breakpad/src/processor/exploitability_linux.cc",
"breakpad/src/processor/exploitability_linux.h",
"breakpad/src/processor/exploitability_win.cc",
"breakpad/src/processor/exploitability_win.h",
"breakpad/src/processor/symbolic_constants_win.cc",
"breakpad/src/processor/symbolic_constants_win.h",
]
if (is_linux || is_chromeos) {
sources += [
"breakpad/src/processor/disassembler_objdump.cc",
"breakpad/src/processor/disassembler_objdump.h",
]
}
}
executable("microdump_stackwalk") {
sources = [
"breakpad/src/processor/microdump.cc",
"breakpad/src/processor/microdump_processor.cc",
"breakpad/src/processor/microdump_stackwalk.cc",
]
deps = [ ":stackwalk_common" ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += default_breakpad_configs
}
executable("minidump_stackwalk") {
sources = [
"breakpad/src/processor/exploitability.cc",
"breakpad/src/processor/minidump.cc",
"breakpad/src/processor/minidump_processor.cc",
"breakpad/src/processor/minidump_stackwalk.cc",
]
deps = [ ":stackwalk_common" ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += default_breakpad_configs
sources += [
"breakpad/src/processor/exploitability_linux.cc",
"breakpad/src/processor/exploitability_linux.h",
"breakpad/src/processor/exploitability_win.cc",
"breakpad/src/processor/exploitability_win.h",
"breakpad/src/processor/symbolic_constants_win.cc",
"breakpad/src/processor/symbolic_constants_win.h",
]
if (is_linux || is_chromeos) {
sources += [
"breakpad/src/processor/disassembler_objdump.cc",
"breakpad/src/processor/disassembler_objdump.h",
]
}
}
executable("minidump_dump") {
sources = [
"breakpad/src/common/path_helper.cc",
"breakpad/src/common/path_helper.h",
"breakpad/src/common/scoped_ptr.h",
"breakpad/src/processor/basic_code_module.h",
"breakpad/src/processor/basic_code_modules.cc",
"breakpad/src/processor/basic_code_modules.h",
"breakpad/src/processor/convert_old_arm64_context.cc",
"breakpad/src/processor/convert_old_arm64_context.h",
"breakpad/src/processor/dump_context.cc",
"breakpad/src/processor/dump_object.cc",
"breakpad/src/processor/logging.cc",
"breakpad/src/processor/logging.h",
"breakpad/src/processor/minidump.cc",
"breakpad/src/processor/minidump_dump.cc",
"breakpad/src/processor/pathname_stripper.cc",
"breakpad/src/processor/pathname_stripper.h",
"breakpad/src/processor/proc_maps_linux.cc",
]
configs += [ ":tools_config" ]
# There are some warnings in this code.
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
} else if (current_toolchain == default_toolchain) {
# The default toolchain builds the system-allocator binaries, which are
# placed in the output dir of the default toolchain.
copy_exe("microdump_stackwalk") {
has_exe_suffix = _tests_launcher_toolchain_has_exe_suffix
target = ":$target_name($_tests_launcher_toolchain)"
}
copy_exe("minidump_stackwalk") {
has_exe_suffix = _tests_launcher_toolchain_has_exe_suffix
target = ":$target_name($_tests_launcher_toolchain)"
}
copy_exe("minidump_dump") {
has_exe_suffix = _tests_launcher_toolchain_has_exe_suffix
target = ":$target_name($_tests_launcher_toolchain)"
}
copy_exe("minidump_fuzzer") {
testonly = true
fuzzer = true
has_exe_suffix = _tests_launcher_toolchain_has_exe_suffix
target = ":$target_name($_tests_launcher_toolchain)"
}
}
}
# Mac --------------------------------------------------------------------------
if (is_mac) {
if (current_toolchain == host_system_allocator_toolchain ||
current_toolchain == default_system_allocator_toolchain) {
source_set("common") {
sources = [
"breakpad/src/common/dwarf/bytereader.cc",
"breakpad/src/common/dwarf/dwarf2diehandler.cc",
"breakpad/src/common/dwarf/dwarf2reader.cc",
"breakpad/src/common/dwarf/elf_reader.cc",
"breakpad/src/common/dwarf/elf_reader.h",
"breakpad/src/common/dwarf_cfi_to_module.cc",
"breakpad/src/common/dwarf_cu_to_module.cc",
"breakpad/src/common/dwarf_line_to_module.cc",
"breakpad/src/common/dwarf_range_list_handler.cc",
"breakpad/src/common/dwarf_range_list_handler.h",
"breakpad/src/common/language.cc",
"breakpad/src/common/mac/arch_utilities.cc",
"breakpad/src/common/mac/arch_utilities.h",
"breakpad/src/common/mac/dump_syms.cc",
"breakpad/src/common/mac/file_id.cc",
"breakpad/src/common/mac/macho_id.cc",
"breakpad/src/common/mac/macho_reader.cc",
"breakpad/src/common/mac/macho_utilities.cc",
"breakpad/src/common/mac/macho_walker.cc",
"breakpad/src/common/md5.cc",
"breakpad/src/common/memory_range.h",
"breakpad/src/common/module.cc",
"breakpad/src/common/path_helper.cc",
"breakpad/src/common/path_helper.h",
"breakpad/src/common/scoped_ptr.h",
"breakpad/src/common/stabs_reader.cc",
"breakpad/src/common/stabs_to_module.cc",
]
include_dirs = [ "breakpad/src/common/mac" ]
configs += [ ":internal_config" ]
# The DWARF utilities require -funsigned-char.
cflags = [ "-funsigned-char" ]
# dwarf2reader.cc uses dynamic_cast.
configs -= [ "//build/config/compiler:no_rtti" ]
configs += [ "//build/config/compiler:rtti" ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
# For breakpad/src/common/stabs_reader.h.
defines = [ "HAVE_MACH_O_NLIST_H" ]
if (enable_rust_crash) {
deps = [ "//third_party/rust/rustc_demangle_capi/v0_1:lib" ]
defines += [ "HAVE_RUSTC_DEMANGLE" ]
include_dirs += [ "//third_party/rust/chromium_crates_io/vendor/rustc-demangle-capi-0.1.0/include" ]
sources += [ "//third_party/rust/chromium_crates_io/vendor/rustc-demangle-capi-0.1.0/include/rustc_demangle.h" ]
}
}
test("breakpad_unittests") {
sources = [ "breakpad/src/common/module_unittest.cc" ]
deps = [
":common",
"//testing/gmock",
"//testing/gtest",
"//testing/gtest:gtest_main",
]
include_dirs = [
"breakpad/src",
"chromium", # Use our copy of breakpad_googletest_includes.h
".",
]
}
executable("dump_syms") {
sources = [ "breakpad/src/tools/mac/dump_syms/dump_syms_tool.cc" ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":internal_config" ]
frameworks = [ "Foundation.framework" ]
deps = [ ":common" ]
}
executable("symupload") {
sources = [
"breakpad/src/common/mac/HTTPGetRequest.m",
"breakpad/src/common/mac/HTTPMultipartUpload.m",
"breakpad/src/common/mac/HTTPPutRequest.m",
"breakpad/src/common/mac/HTTPRequest.m",
"breakpad/src/common/mac/HTTPSimplePostRequest.m",
"breakpad/src/common/mac/SymbolCollectorClient.m",
"breakpad/src/common/mac/encoding_util.m",
"breakpad/src/tools/mac/symupload/symupload.mm",
]
include_dirs = [ "breakpad/src/common/mac" ]
configs += [ ":internal_config" ]
frameworks = [ "Foundation.framework" ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
# Do not compile with ARC because Breakpad code is not compatible with
# being compiled with ARC.
configs -= [ "//build/config/compiler:enable_arc" ]
deps = [ ":common" ]
}
} else if (current_toolchain == default_toolchain) {
# The default toolchain builds the system-allocator binaries, which are
# placed in the output dir of the default toolchain.
copy_exe("dump_syms") {
has_exe_suffix = _tests_launcher_toolchain_has_exe_suffix
target = ":$target_name($_tests_launcher_toolchain)"
}
copy_exe("symupload") {
has_exe_suffix = _symupload_toolchain_has_exe_suffix
target = ":$target_name($_symupload_toolchain)"
}
copy_exe("breakpad_unittests") {
testonly = true
has_exe_suffix = _tests_launcher_toolchain_has_exe_suffix
target = ":$target_name($_tests_launcher_toolchain)"
}
} else if (current_toolchain == host_toolchain && current_cpu == "arm64") {
# TODO(crbug.com/349268750): This alias exists because the official Mac
# arm64 builders (which cross-build the x64 binaries) use the hardcoded
# path of the `$host_toolchain/symupload` to build and run the symupload
# binary. And the same recipes are used on all branches!! So we would break
# the stable branch builders by changing the recipe to build and run the
# binary from the root_build_dir.
#
# Once this code is in stable, we can land the following CLs to change how
# symupload is built and run on Mac arm64 official builders, and then this
# alias can be removed.
# Build: https://chrome-internal-review.googlesource.com/c/chrome/src-internal/+/7430844
# Run: https://chrome-internal-review.googlesource.com/c/chrome/tools/release/scripts/+/7430843
copy_exe("symupload") {
has_exe_suffix = _symupload_toolchain_has_exe_suffix
target = ":$target_name($_symupload_toolchain)"
}
}
action("gen_symbol_tools_packager") {
testonly = true
script = "scripts/gen_symbol_tools_packager.py"
_go_source_dir = "breakpad/src/tools/mac/upload_system_symbols"
_extra_sources = [
"breakpad/src/tools/mac/upload_system_symbols/upload_system_symbols.sh",
]
sources = [ "scripts/package_symbol_tools.py.template" ] +
[ _go_source_dir ] + _extra_sources
outputs = [ "$root_out_dir/package_symbol_tools.py" ]
deps = [
":dump_syms",
":symupload",
"//tools/mac:dsc_extractor",
]
args = [
"-a",
target_cpu,
"-t",
rebase_path("scripts/package_symbol_tools.py.template",
root_build_dir),
"-go_src",
rebase_path(_go_source_dir, root_build_dir),
"-extra",
] + rebase_path(_extra_sources, root_build_dir)
}
}
if (is_ios) {
if (current_toolchain == default_toolchain) {
copy_exe("dump_syms") {
has_exe_suffix = _tests_launcher_toolchain_has_exe_suffix
target = ":$target_name($_tests_launcher_toolchain)"
}
copy_exe("symupload") {
has_exe_suffix = _symupload_toolchain_has_exe_suffix
target = ":$target_name($_symupload_toolchain)"
}
}
}
if (is_linux || is_chromeos || is_android) {
if (current_toolchain == host_system_allocator_toolchain ||
current_toolchain == default_system_allocator_toolchain) {
executable("symupload") {
sources = [
"breakpad/src/common/linux/http_upload.cc",
"breakpad/src/common/linux/http_upload.h",
"breakpad/src/common/linux/libcurl_wrapper.cc",
"breakpad/src/common/linux/libcurl_wrapper.h",
"breakpad/src/common/linux/symbol_collector_client.cc",
"breakpad/src/common/linux/symbol_collector_client.h",
"breakpad/src/common/linux/symbol_upload.cc",
"breakpad/src/common/linux/symbol_upload.h",
"breakpad/src/common/path_helper.cc",
"breakpad/src/common/path_helper.h",
"breakpad/src/common/scoped_ptr.h",
"breakpad/src/tools/linux/symupload/sym_upload.cc",
]
include_dirs = [
"breakpad/src",
"breakpad/src/third_party",
]
configs += [ ":tools_config" ]
libs = [ "dl" ]
}
# dump_syms is a host tool, so only compile it for the host system.
executable("dump_syms") {
sources = [
"breakpad/src/common/dwarf/bytereader.cc",
"breakpad/src/common/dwarf/dwarf2diehandler.cc",
"breakpad/src/common/dwarf/dwarf2reader.cc",
"breakpad/src/common/dwarf/elf_reader.cc",
"breakpad/src/common/dwarf/elf_reader.h",
"breakpad/src/common/dwarf_cfi_to_module.cc",
"breakpad/src/common/dwarf_cfi_to_module.h",
"breakpad/src/common/dwarf_cu_to_module.cc",
"breakpad/src/common/dwarf_cu_to_module.h",
"breakpad/src/common/dwarf_line_to_module.cc",
"breakpad/src/common/dwarf_line_to_module.h",
"breakpad/src/common/dwarf_range_list_handler.cc",
"breakpad/src/common/dwarf_range_list_handler.h",
"breakpad/src/common/language.cc",
"breakpad/src/common/language.h",
"breakpad/src/common/linux/crc32.cc",
"breakpad/src/common/linux/crc32.h",
"breakpad/src/common/linux/dump_symbols.cc",
"breakpad/src/common/linux/dump_symbols.h",
"breakpad/src/common/linux/elf_symbols_to_module.cc",
"breakpad/src/common/linux/elf_symbols_to_module.h",
"breakpad/src/common/linux/elfutils.cc",
"breakpad/src/common/linux/elfutils.h",
"breakpad/src/common/linux/file_id.cc",
"breakpad/src/common/linux/file_id.h",
"breakpad/src/common/linux/guid_creator.h",
"breakpad/src/common/linux/linux_libc_support.cc",
"breakpad/src/common/linux/linux_libc_support.h",
"breakpad/src/common/linux/memory_mapped_file.cc",
"breakpad/src/common/linux/memory_mapped_file.h",
"breakpad/src/common/memory_allocator.h",
"breakpad/src/common/memory_range.h",
"breakpad/src/common/module.cc",
"breakpad/src/common/module.h",
"breakpad/src/common/path_helper.cc",
"breakpad/src/common/path_helper.h",
"breakpad/src/common/scoped_ptr.h",
"breakpad/src/common/stabs_reader.cc",
"breakpad/src/common/stabs_reader.h",
"breakpad/src/common/stabs_to_module.cc",
"breakpad/src/common/stabs_to_module.h",
"breakpad/src/tools/linux/dump_syms/dump_syms.cc",
]
# There are some warnings in this code.
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
# dwarf2reader.cc uses dynamic_cast. Because we don't typically
# don't support RTTI, we enable it for this single target. Since
# dump_syms doesn't share any object files with anything else,
# this doesn't end up polluting Chrome itself.
configs -= [ "//build/config/compiler:no_rtti" ]
configs += [ "//build/config/compiler:rtti" ]
# Breakpad rev 583 introduced this flag.
# Using this define, stabs_reader.h will include a.out.h to
# build on Linux.
defines = [ "HAVE_A_OUT_H" ]
include_dirs = [ "breakpad/src" ]
if (enable_rust_crash) {
deps = [ "//third_party/rust/rustc_demangle_capi/v0_1:lib" ]
defines += [ "HAVE_RUSTC_DEMANGLE" ]
include_dirs += [ "//third_party/rust/chromium_crates_io/vendor/rustc-demangle-capi-0.1.0/include" ]
sources += [ "//third_party/rust/chromium_crates_io/vendor/rustc-demangle-capi-0.1.0/include/rustc_demangle.h" ]
}
libs = [ "z" ]
}
} else if (current_toolchain == default_toolchain) {
# The default toolchain builds the system-allocator binaries, which are
# placed in the output dir of the default toolchain.
copy_exe("dump_syms") {
has_exe_suffix = _tests_launcher_toolchain_has_exe_suffix
target = ":$target_name($_tests_launcher_toolchain)"
}
copy_exe("symupload") {
has_exe_suffix = _symupload_toolchain_has_exe_suffix
target = ":$target_name($_symupload_toolchain)"
}
}
static_library("client") {
sources = [
"breakpad/src/client/linux/crash_generation/crash_generation_client.cc",
"breakpad/src/client/linux/crash_generation/crash_generation_client.h",
"breakpad/src/client/linux/dump_writer_common/mapping_info.h",
"breakpad/src/client/linux/dump_writer_common/thread_info.cc",
"breakpad/src/client/linux/dump_writer_common/thread_info.h",
"breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc",
"breakpad/src/client/linux/dump_writer_common/ucontext_reader.h",
"breakpad/src/client/linux/handler/exception_handler.cc",
"breakpad/src/client/linux/handler/exception_handler.h",
"breakpad/src/client/linux/handler/minidump_descriptor.cc",
"breakpad/src/client/linux/handler/minidump_descriptor.h",
"breakpad/src/client/linux/log/log.cc",
"breakpad/src/client/linux/log/log.h",
"breakpad/src/client/linux/microdump_writer/microdump_writer.cc",
"breakpad/src/client/linux/microdump_writer/microdump_writer.h",
"breakpad/src/client/linux/minidump_writer/cpu_set.h",
"breakpad/src/client/linux/minidump_writer/directory_reader.h",
"breakpad/src/client/linux/minidump_writer/line_reader.h",
"breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc",
"breakpad/src/client/linux/minidump_writer/linux_core_dumper.h",
"breakpad/src/client/linux/minidump_writer/linux_dumper.cc",
"breakpad/src/client/linux/minidump_writer/linux_dumper.h",
"breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc",
"breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.h",
"breakpad/src/client/linux/minidump_writer/minidump_writer.cc",
"breakpad/src/client/linux/minidump_writer/minidump_writer.h",
"breakpad/src/client/linux/minidump_writer/pe_file.cc",
"breakpad/src/client/linux/minidump_writer/pe_file.h",
"breakpad/src/client/linux/minidump_writer/pe_structs.h",
"breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h",
"breakpad/src/client/minidump_file_writer-inl.h",
"breakpad/src/client/minidump_file_writer.cc",
"breakpad/src/client/minidump_file_writer.h",
"breakpad/src/common/convert_UTF.cc",
"breakpad/src/common/convert_UTF.h",
"breakpad/src/common/linux/breakpad_getcontext.S",
"breakpad/src/common/linux/elf_core_dump.cc",
"breakpad/src/common/linux/elf_core_dump.h",
"breakpad/src/common/linux/elfutils.cc",
"breakpad/src/common/linux/elfutils.h",
"breakpad/src/common/linux/file_id.cc",
"breakpad/src/common/linux/file_id.h",
"breakpad/src/common/linux/google_crashdump_uploader.cc",
"breakpad/src/common/linux/google_crashdump_uploader.h",
"breakpad/src/common/linux/guid_creator.cc",
"breakpad/src/common/linux/guid_creator.h",
"breakpad/src/common/linux/libcurl_wrapper.cc",
"breakpad/src/common/linux/libcurl_wrapper.h",
"breakpad/src/common/linux/linux_libc_support.cc",
"breakpad/src/common/linux/linux_libc_support.h",
"breakpad/src/common/linux/memory_mapped_file.cc",
"breakpad/src/common/linux/memory_mapped_file.h",
"breakpad/src/common/linux/safe_readlink.cc",
"breakpad/src/common/linux/safe_readlink.h",
"breakpad/src/common/memory_allocator.h",
"breakpad/src/common/memory_range.h",
"breakpad/src/common/scoped_ptr.h",
"breakpad/src/common/simple_string_dictionary.cc",
"breakpad/src/common/simple_string_dictionary.h",
"breakpad/src/common/string_conversion.cc",
"breakpad/src/common/string_conversion.h",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
public_configs = [ ":client_config" ]
if (current_cpu == "arm" && is_chromeos_ash) {
# Avoid running out of registers in
# linux_syscall_support.h:sys_clone()'s inline assembly.
cflags = [ "-marm" ]
}
libs = [ "dl" ]
include_dirs = [
".",
"breakpad/src",
"breakpad/src/client",
"breakpad/src/third_party/linux/include",
]
}
static_library("processor_support") {
sources = [
"breakpad/src/common/scoped_ptr.h",
"breakpad/src/processor/basic_code_module.h",
"breakpad/src/processor/basic_code_modules.cc",
"breakpad/src/processor/basic_code_modules.h",
"breakpad/src/processor/convert_old_arm64_context.cc",
"breakpad/src/processor/convert_old_arm64_context.h",
"breakpad/src/processor/dump_context.cc",
"breakpad/src/processor/dump_object.cc",
"breakpad/src/processor/logging.cc",
"breakpad/src/processor/logging.h",
"breakpad/src/processor/minidump.cc",
"breakpad/src/processor/pathname_stripper.cc",
"breakpad/src/processor/pathname_stripper.h",
"breakpad/src/processor/proc_maps_linux.cc",
]
include_dirs = [
"breakpad/src",
"breakpad/src/client",
"breakpad/src/third_party/linux/include",
".",
]
# There are some warnings in this code.
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
test("breakpad_unittests") {
sources = [
"breakpad/src/client/linux/handler/exception_handler_unittest.cc",
"breakpad/src/client/linux/minidump_writer/cpu_set_unittest.cc",
"breakpad/src/client/linux/minidump_writer/directory_reader_unittest.cc",
"breakpad/src/client/linux/minidump_writer/line_reader_unittest.cc",
"breakpad/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc",
"breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc",
"breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc",
"breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
"breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
"breakpad/src/common/linux/breakpad_getcontext_unittest.cc",
"breakpad/src/common/linux/elf_core_dump_unittest.cc",
"breakpad/src/common/linux/file_id_unittest.cc",
"breakpad/src/common/linux/linux_libc_support_unittest.cc",
"breakpad/src/common/linux/scoped_pipe.cc",
"breakpad/src/common/linux/scoped_pipe.h",
"breakpad/src/common/linux/scoped_pipe_unittest.cc",
"breakpad/src/common/linux/scoped_tmpfile.cc",
"breakpad/src/common/linux/scoped_tmpfile.h",
"breakpad/src/common/linux/scoped_tmpfile_unittest.cc",
"breakpad/src/common/linux/synth_elf.cc",
"breakpad/src/common/linux/tests/crash_generator.cc",
"breakpad/src/common/linux/tests/crash_generator.h",
"breakpad/src/common/memory_allocator_unittest.cc",
"breakpad/src/common/memory_range.h",
"breakpad/src/common/simple_string_dictionary_unittest.cc",
"breakpad/src/common/test_assembler.cc",
"breakpad/src/common/tests/file_utils.cc",
"breakpad/src/common/tests/file_utils.h",
"breakpad/src/tools/linux/md2core/minidump_memory_range.h",
"breakpad/src/tools/linux/md2core/minidump_memory_range_unittest.cc",
"chromium/breakpad_googletest_includes.h",
]
deps = [
":client",
":processor_support",
"//testing/gmock",
"//testing/gtest",
"//testing/gtest:gtest_main",
]
data_deps = [ ":linux_dumper_unittest_helper" ]
include_dirs = [
"chromium", # Use our copy of breakpad_googletest_includes.h
".",
]
# There are some warnings in this code.
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":client_config",
"//build/config/compiler:no_chromium_code",
]
if (is_clang) {
# See https://crbug.com/138571#c18
cflags = [ "-Wno-unused-value" ]
}
if (is_android) {
use_raw_android_executable = true
libs = [ "log" ]
extra_dist_files = [ "$root_out_dir/linux_dumper_unittest_helper" ]
}
# Add the breakpad unittest config at the end to override all configs.
configs += [ ":breakpad_unittest_config" ]
}
if (current_toolchain == host_system_allocator_toolchain ||
current_toolchain == default_system_allocator_toolchain) {
executable("linux_dumper_unittest_helper") {
testonly = true
sources = [ "breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc" ]
deps = [ ":processor_support" ]
configs += [ ":client_config" ]
if (is_component_build) {
ldflags = [ "-Wl,-rpath,\$ORIGIN" ]
}
}
executable("generate_test_dump") {
testonly = true
sources = [ "linux/generate-test-dump.cc" ]
# This file has an unused variable warning.
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":client_config",
"//build/config/compiler:no_chromium_code",
]
deps = [ ":client" ]
if (is_android) {
libs = [ "log" ]
}
}
executable("minidump-2-core") {
sources = [
"breakpad/src/common/path_helper.cc",
"breakpad/src/common/path_helper.h",
"breakpad/src/tools/linux/md2core/minidump-2-core.cc",
"breakpad/src/tools/linux/md2core/minidump_memory_range.h",
]
include_dirs = [ "breakpad/src" ]
deps = [ ":client" ]
}
executable("core-2-minidump") {
sources = [
"breakpad/src/common/path_helper.cc",
"breakpad/src/common/path_helper.h",
"breakpad/src/tools/linux/core2md/core2md.cc",
]
deps = [ ":client" ]
include_dirs = [ "breakpad/src" ]
}
} else if (current_toolchain == default_toolchain) {
# The default toolchain builds the system-allocator binaries, which are
# linked from the output dir of the default toolchain.
# Most breakpad binaries are only built for the `_tests_launcher_toolchain`.
# This is different, as it's used _inside_ a test, and thus needs to be
# built for the target machine, not the test-launcher machine.