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. 4 5import("//build/symlink.gni") 6import("//testing/libfuzzer/fuzzer_test.gni") 7import("//testing/test.gni") 8 9if (is_win) { 10 import("//build/config/win/visual_studio_version.gni") 11} 12 13config("tools_config") { 14 include_dirs = [ 15 "breakpad/src", 16 "breakpad/src/third_party", 17 ] 18 if (is_android) { 19 defines = [ "__ANDROID__" ] 20 } 21 if (is_clang) { 22 cflags = [ "-Wno-tautological-constant-out-of-range-compare" ] 23 } 24} 25 26config("internal_config") { 27 include_dirs = [ "breakpad/src" ] 28 defines = [] 29 if (is_debug) { 30 # This is needed for GTMLogger to work correctly. 31 defines += [ "DEBUG" ] 32 } 33 if (is_android) { 34 defines += [ "__ANDROID__" ] 35 } 36} 37 38config("client_config") { 39 include_dirs = [ "breakpad/src" ] 40 if (is_android) { 41 include_dirs += [ "breakpad/src/common/android/include" ] 42 } 43 if (is_chromeos) { 44 defines = [ "__CHROMEOS__" ] 45 } 46} 47 48config("handler_config") { 49 include_dirs = [ "breakpad/src" ] 50} 51 52config("sender_config") { 53 include_dirs = [ "breakpad/src" ] 54} 55 56config("breakpad_unittest_config") { 57 # One of the breakpad unit tests test that we can detect the proper build-id. 58 # We must override the build-id for this one target. 59 ldflags = [ "-Wl,--build-id=0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" ] 60} 61 62config("default_logging_severity_config") { 63 defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" ] 64} 65 66config("fuzzing_logging_severity_config") { 67 defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_CRITICAL" ] 68} 69 70default_breakpad_configs = [ ":tools_config" ] 71 72if (use_fuzzing_engine) { 73 default_breakpad_configs += [ ":fuzzing_logging_severity_config" ] 74} else { 75 default_breakpad_configs += [ ":default_logging_severity_config" ] 76} 77 78# {micro,mini}dump_stackwalk and minidump_dump are tool-type executables 79# that do not build on Windows. 80if (!is_win) { 81 if (current_toolchain == host_toolchain) { 82 # Contains the code shared by both {micro,mini}dump_stackwalk. 83 static_library("stackwalk_common") { 84 # Always want these files included regardless of platform. 85 set_sources_assignment_filter([]) 86 sources = [ 87 "breakpad/src/common/path_helper.cc", 88 "breakpad/src/common/path_helper.h", 89 "breakpad/src/processor/basic_code_module.h", 90 "breakpad/src/processor/basic_code_modules.cc", 91 "breakpad/src/processor/basic_code_modules.h", 92 "breakpad/src/processor/basic_source_line_resolver.cc", 93 "breakpad/src/processor/call_stack.cc", 94 "breakpad/src/processor/cfi_frame_info.cc", 95 "breakpad/src/processor/cfi_frame_info.h", 96 "breakpad/src/processor/convert_old_arm64_context.cc", 97 "breakpad/src/processor/convert_old_arm64_context.h", 98 "breakpad/src/processor/disassembler_x86.cc", 99 "breakpad/src/processor/disassembler_x86.h", 100 "breakpad/src/processor/dump_context.cc", 101 "breakpad/src/processor/dump_object.cc", 102 "breakpad/src/processor/logging.cc", 103 "breakpad/src/processor/logging.h", 104 "breakpad/src/processor/pathname_stripper.cc", 105 "breakpad/src/processor/pathname_stripper.h", 106 "breakpad/src/processor/proc_maps_linux.cc", 107 "breakpad/src/processor/process_state.cc", 108 "breakpad/src/processor/simple_symbol_supplier.cc", 109 "breakpad/src/processor/simple_symbol_supplier.h", 110 "breakpad/src/processor/source_line_resolver_base.cc", 111 "breakpad/src/processor/stack_frame_cpu.cc", 112 "breakpad/src/processor/stack_frame_symbolizer.cc", 113 "breakpad/src/processor/stackwalk_common.cc", 114 "breakpad/src/processor/stackwalker.cc", 115 "breakpad/src/processor/stackwalker_amd64.cc", 116 "breakpad/src/processor/stackwalker_amd64.h", 117 "breakpad/src/processor/stackwalker_arm.cc", 118 "breakpad/src/processor/stackwalker_arm.h", 119 "breakpad/src/processor/stackwalker_arm64.cc", 120 "breakpad/src/processor/stackwalker_arm64.h", 121 "breakpad/src/processor/stackwalker_mips.cc", 122 "breakpad/src/processor/stackwalker_mips.h", 123 "breakpad/src/processor/stackwalker_ppc.cc", 124 "breakpad/src/processor/stackwalker_ppc.h", 125 "breakpad/src/processor/stackwalker_ppc64.cc", 126 "breakpad/src/processor/stackwalker_ppc64.h", 127 "breakpad/src/processor/stackwalker_sparc.cc", 128 "breakpad/src/processor/stackwalker_sparc.h", 129 "breakpad/src/processor/stackwalker_x86.cc", 130 "breakpad/src/processor/stackwalker_x86.h", 131 "breakpad/src/processor/tokenize.cc", 132 "breakpad/src/processor/tokenize.h", 133 134 # libdisasm 135 "breakpad/src/third_party/libdisasm/ia32_implicit.c", 136 "breakpad/src/third_party/libdisasm/ia32_implicit.h", 137 "breakpad/src/third_party/libdisasm/ia32_insn.c", 138 "breakpad/src/third_party/libdisasm/ia32_insn.h", 139 "breakpad/src/third_party/libdisasm/ia32_invariant.c", 140 "breakpad/src/third_party/libdisasm/ia32_invariant.h", 141 "breakpad/src/third_party/libdisasm/ia32_modrm.c", 142 "breakpad/src/third_party/libdisasm/ia32_modrm.h", 143 "breakpad/src/third_party/libdisasm/ia32_opcode_tables.c", 144 "breakpad/src/third_party/libdisasm/ia32_opcode_tables.h", 145 "breakpad/src/third_party/libdisasm/ia32_operand.c", 146 "breakpad/src/third_party/libdisasm/ia32_operand.h", 147 "breakpad/src/third_party/libdisasm/ia32_reg.c", 148 "breakpad/src/third_party/libdisasm/ia32_reg.h", 149 "breakpad/src/third_party/libdisasm/ia32_settings.c", 150 "breakpad/src/third_party/libdisasm/ia32_settings.h", 151 "breakpad/src/third_party/libdisasm/libdis.h", 152 "breakpad/src/third_party/libdisasm/qword.h", 153 "breakpad/src/third_party/libdisasm/x86_disasm.c", 154 "breakpad/src/third_party/libdisasm/x86_format.c", 155 "breakpad/src/third_party/libdisasm/x86_imm.c", 156 "breakpad/src/third_party/libdisasm/x86_imm.h", 157 "breakpad/src/third_party/libdisasm/x86_insn.c", 158 "breakpad/src/third_party/libdisasm/x86_misc.c", 159 "breakpad/src/third_party/libdisasm/x86_operand_list.c", 160 "breakpad/src/third_party/libdisasm/x86_operand_list.h", 161 ] 162 163 configs -= [ "//build/config/compiler:chromium_code" ] 164 configs += [ "//build/config/compiler:no_chromium_code" ] 165 configs += default_breakpad_configs 166 } 167 168 fuzzer_test("minidump_fuzzer") { 169 sources = [ 170 "breakpad/src/processor/exploitability.cc", 171 "breakpad/src/processor/minidump.cc", 172 "breakpad/src/processor/minidump_processor.cc", 173 "minidump_fuzzer.cc", 174 ] 175 176 deps = [ 177 ":stackwalk_common", 178 "//base", 179 ] 180 181 additional_configs = [ ":fuzzing_logging_severity_config" ] 182 include_dirs = [ "breakpad/src" ] 183 184 libfuzzer_options = [ 185 # Suppress stdout from stackwalk_common, as it uses printf() directly. 186 "close_fd_mask=1", 187 "max_len=128000", 188 ] 189 190 # Always want these files included regardless of platform. 191 set_sources_assignment_filter([]) 192 sources += [ 193 "breakpad/src/processor/exploitability_linux.cc", 194 "breakpad/src/processor/exploitability_linux.h", 195 "breakpad/src/processor/exploitability_win.cc", 196 "breakpad/src/processor/exploitability_win.h", 197 "breakpad/src/processor/symbolic_constants_win.cc", 198 "breakpad/src/processor/symbolic_constants_win.h", 199 ] 200 } 201 202 executable("microdump_stackwalk") { 203 sources = [ 204 "breakpad/src/processor/microdump.cc", 205 "breakpad/src/processor/microdump_processor.cc", 206 "breakpad/src/processor/microdump_stackwalk.cc", 207 ] 208 209 deps = [ ":stackwalk_common" ] 210 211 configs -= [ "//build/config/compiler:chromium_code" ] 212 configs += [ "//build/config/compiler:no_chromium_code" ] 213 configs += default_breakpad_configs 214 } 215 216 executable("minidump_stackwalk") { 217 sources = [ 218 "breakpad/src/processor/exploitability.cc", 219 "breakpad/src/processor/minidump.cc", 220 "breakpad/src/processor/minidump_processor.cc", 221 "breakpad/src/processor/minidump_stackwalk.cc", 222 ] 223 224 deps = [ ":stackwalk_common" ] 225 226 configs -= [ "//build/config/compiler:chromium_code" ] 227 configs += [ "//build/config/compiler:no_chromium_code" ] 228 configs += default_breakpad_configs 229 230 # Always want these files included regardless of platform. 231 set_sources_assignment_filter([]) 232 sources += [ 233 "breakpad/src/processor/exploitability_linux.cc", 234 "breakpad/src/processor/exploitability_linux.h", 235 "breakpad/src/processor/exploitability_win.cc", 236 "breakpad/src/processor/exploitability_win.h", 237 "breakpad/src/processor/symbolic_constants_win.cc", 238 "breakpad/src/processor/symbolic_constants_win.h", 239 ] 240 } 241 242 executable("minidump_dump") { 243 set_sources_assignment_filter([]) 244 sources = [ 245 "breakpad/src/processor/basic_code_module.h", 246 "breakpad/src/processor/basic_code_modules.cc", 247 "breakpad/src/processor/basic_code_modules.h", 248 "breakpad/src/processor/convert_old_arm64_context.cc", 249 "breakpad/src/processor/convert_old_arm64_context.h", 250 "breakpad/src/processor/dump_context.cc", 251 "breakpad/src/processor/dump_object.cc", 252 "breakpad/src/processor/logging.cc", 253 "breakpad/src/processor/logging.h", 254 "breakpad/src/processor/minidump.cc", 255 "breakpad/src/processor/minidump_dump.cc", 256 "breakpad/src/processor/pathname_stripper.cc", 257 "breakpad/src/processor/pathname_stripper.h", 258 "breakpad/src/processor/proc_maps_linux.cc", 259 ] 260 261 configs += [ ":tools_config" ] 262 263 # There are some warnings in this code. 264 configs -= [ "//build/config/compiler:chromium_code" ] 265 configs += [ "//build/config/compiler:no_chromium_code" ] 266 } 267 } else { 268 # Aliases for convenience. 269 binary_symlink("microdump_stackwalk") { 270 binary_label = ":$target_name($host_toolchain)" 271 } 272 binary_symlink("minidump_stackwalk") { 273 binary_label = ":$target_name($host_toolchain)" 274 } 275 binary_symlink("minidump_dump") { 276 binary_label = ":$target_name($host_toolchain)" 277 } 278 } 279} 280 281# Mac -------------------------------------------------------------------------- 282 283if (is_mac) { 284 if (current_toolchain == host_toolchain) { 285 executable("dump_syms") { 286 sources = [ 287 "breakpad/src/common/dwarf/bytereader.cc", 288 "breakpad/src/common/dwarf/dwarf2diehandler.cc", 289 "breakpad/src/common/dwarf/dwarf2reader.cc", 290 "breakpad/src/common/dwarf/elf_reader.cc", 291 "breakpad/src/common/dwarf/elf_reader.h", 292 "breakpad/src/common/dwarf_cfi_to_module.cc", 293 "breakpad/src/common/dwarf_cu_to_module.cc", 294 "breakpad/src/common/dwarf_line_to_module.cc", 295 "breakpad/src/common/dwarf_range_list_handler.cc", 296 "breakpad/src/common/dwarf_range_list_handler.h", 297 "breakpad/src/common/language.cc", 298 "breakpad/src/common/mac/arch_utilities.cc", 299 "breakpad/src/common/mac/arch_utilities.h", 300 "breakpad/src/common/mac/dump_syms.cc", 301 "breakpad/src/common/mac/file_id.cc", 302 "breakpad/src/common/mac/macho_id.cc", 303 "breakpad/src/common/mac/macho_reader.cc", 304 "breakpad/src/common/mac/macho_utilities.cc", 305 "breakpad/src/common/mac/macho_walker.cc", 306 "breakpad/src/common/md5.cc", 307 "breakpad/src/common/module.cc", 308 "breakpad/src/common/path_helper.cc", 309 "breakpad/src/common/path_helper.h", 310 "breakpad/src/common/stabs_reader.cc", 311 "breakpad/src/common/stabs_to_module.cc", 312 "breakpad/src/tools/mac/dump_syms/dump_syms_tool.cc", 313 ] 314 315 # For breakpad/src/common/stabs_reader.h. 316 defines = [ "HAVE_MACH_O_NLIST_H" ] 317 include_dirs = [ "breakpad/src/common/mac" ] 318 319 # The DWARF utilities require -funsigned-char. 320 cflags = [ "-funsigned-char" ] 321 322 configs += [ ":internal_config" ] 323 324 configs -= [ "//build/config/compiler:chromium_code" ] 325 configs += [ "//build/config/compiler:no_chromium_code" ] 326 327 # dwarf2reader.cc uses dynamic_cast. 328 configs -= [ "//build/config/compiler:no_rtti" ] 329 configs += [ "//build/config/compiler:rtti" ] 330 331 libs = [ "Foundation.framework" ] 332 333 if (!is_debug) { 334 # dump_syms crashes when built at -O1, -O2, and -O3. It does 335 # not crash at -Os. To play it safe, dump_syms is always built 336 # at -O0 until this can be sorted out. 337 # https://crbug.com/google-breakpad/329 338 configs -= [ "//build/config/compiler:default_optimization" ] 339 cflags += [ "-O0" ] 340 } 341 } 342 343 executable("symupload") { 344 sources = [ 345 "breakpad/src/common/mac/HTTPMultipartUpload.m", 346 "breakpad/src/tools/mac/symupload/symupload.m", 347 ] 348 349 include_dirs = [ "breakpad/src/common/mac" ] 350 351 libs = [ "Foundation.framework" ] 352 353 configs -= [ "//build/config/compiler:chromium_code" ] 354 configs += [ "//build/config/compiler:no_chromium_code" ] 355 } 356 } else { 357 binary_symlink("dump_syms") { 358 binary_label = ":$target_name($host_toolchain)" 359 } 360 binary_symlink("symupload") { 361 binary_label = ":$target_name($host_toolchain)" 362 } 363 } 364} 365 366if (is_ios) { 367 binary_symlink("dump_syms") { 368 binary_label = ":$target_name($host_toolchain)" 369 } 370 binary_symlink("symupload") { 371 binary_label = ":$target_name($host_toolchain)" 372 } 373} 374 375if (is_mac) { 376 static_library("utilities") { 377 sources = [ 378 "breakpad/src/client/mac/crash_generation/ConfigFile.mm", 379 "breakpad/src/client/mac/handler/breakpad_nlist_64.cc", 380 "breakpad/src/client/mac/handler/dynamic_images.cc", 381 "breakpad/src/client/mac/handler/minidump_generator.cc", 382 "breakpad/src/client/minidump_file_writer.cc", 383 "breakpad/src/common/convert_UTF.cc", 384 "breakpad/src/common/mac/MachIPC.mm", 385 "breakpad/src/common/mac/arch_utilities.cc", 386 "breakpad/src/common/mac/bootstrap_compat.cc", 387 "breakpad/src/common/mac/file_id.cc", 388 "breakpad/src/common/mac/launch_reporter.cc", 389 "breakpad/src/common/mac/macho_id.cc", 390 "breakpad/src/common/mac/macho_utilities.cc", 391 "breakpad/src/common/mac/macho_walker.cc", 392 "breakpad/src/common/mac/string_utilities.cc", 393 "breakpad/src/common/md5.cc", 394 "breakpad/src/common/simple_string_dictionary.cc", 395 "breakpad/src/common/string_conversion.cc", 396 ] 397 398 configs += [ ":internal_config" ] 399 400 # There are some warnings in this code. 401 configs -= [ "//build/config/compiler:chromium_code" ] 402 configs += [ "//build/config/compiler:no_chromium_code" ] 403 } 404 405 executable("crash_inspector") { 406 sources = [ 407 "breakpad/src/client/mac/crash_generation/Inspector.mm", 408 "breakpad/src/client/mac/crash_generation/InspectorMain.mm", 409 ] 410 411 # TODO(GYP): 'mac_real_dsym': 1, 412 413 include_dirs = [ 414 "breakpad/src/client/apple/Framework", 415 "breakpad/src/common/mac", 416 "breakpad/src", 417 ] 418 libs = [ 419 "CoreServices.framework", 420 "Foundation.framework", 421 ] 422 423 deps = [ ":utilities" ] 424 } 425 426 # TODO(GYP) this target has some mac_bundle_resources stuff. 427 # executable("crash_report_sender") { 428 # } 429 group("crash_report_sender") { 430 } 431 432 config("breakpad_config") { 433 include_dirs = [ "breakpad/src/client/apple/Framework" ] 434 } 435 436 static_library("breakpad") { 437 sources = [ 438 "breakpad/src/client/mac/Framework/Breakpad.mm", 439 "breakpad/src/client/mac/Framework/OnDemandServer.mm", 440 "breakpad/src/client/mac/crash_generation/crash_generation_client.cc", 441 "breakpad/src/client/mac/crash_generation/crash_generation_client.h", 442 "breakpad/src/client/mac/handler/exception_handler.cc", 443 "breakpad/src/client/mac/handler/protected_memory_allocator.cc", 444 ] 445 446 configs += [ ":internal_config" ] 447 public_configs = [ ":breakpad_config" ] 448 449 defines = [ "USE_PROTECTED_ALLOCATIONS=1" ] 450 include_dirs = [ "breakpad/src/client/apple/Framework" ] 451 452 # TODO(crbug.com/841631): Breakpad uses bootstrap_subset() and 453 # bootstrap_create_server(), both of which are deprecated starting in 10.10. 454 cflags = [ "-Wno-deprecated-declarations" ] 455 456 deps = [ 457 ":crash_inspector", 458 ":crash_report_sender", 459 ":utilities", 460 ] 461 } 462 463 group("client") { 464 public_configs = [ ":client_config" ] 465 } 466} 467 468if (is_linux || is_android) { 469 if (current_toolchain == host_toolchain) { 470 executable("symupload") { 471 sources = [ 472 "breakpad/src/common/linux/http_upload.cc", 473 "breakpad/src/common/linux/http_upload.h", 474 "breakpad/src/common/linux/symbol_upload.cc", 475 "breakpad/src/common/linux/symbol_upload.h", 476 "breakpad/src/tools/linux/symupload/sym_upload.cc", 477 ] 478 479 include_dirs = [ 480 "breakpad/src", 481 "breakpad/src/third_party", 482 ] 483 484 configs += [ ":tools_config" ] 485 486 libs = [ "dl" ] 487 } 488 489 # dump_syms is a host tool, so only compile it for the host system. 490 executable("dump_syms") { 491 sources = [ 492 "breakpad/src/common/dwarf/bytereader.cc", 493 "breakpad/src/common/dwarf/dwarf2diehandler.cc", 494 "breakpad/src/common/dwarf/dwarf2reader.cc", 495 "breakpad/src/common/dwarf/elf_reader.cc", 496 "breakpad/src/common/dwarf/elf_reader.h", 497 "breakpad/src/common/dwarf_cfi_to_module.cc", 498 "breakpad/src/common/dwarf_cfi_to_module.h", 499 "breakpad/src/common/dwarf_cu_to_module.cc", 500 "breakpad/src/common/dwarf_cu_to_module.h", 501 "breakpad/src/common/dwarf_line_to_module.cc", 502 "breakpad/src/common/dwarf_line_to_module.h", 503 "breakpad/src/common/dwarf_range_list_handler.cc", 504 "breakpad/src/common/dwarf_range_list_handler.h", 505 "breakpad/src/common/language.cc", 506 "breakpad/src/common/language.h", 507 "breakpad/src/common/linux/crc32.cc", 508 "breakpad/src/common/linux/crc32.h", 509 "breakpad/src/common/linux/dump_symbols.cc", 510 "breakpad/src/common/linux/dump_symbols.h", 511 "breakpad/src/common/linux/elf_symbols_to_module.cc", 512 "breakpad/src/common/linux/elf_symbols_to_module.h", 513 "breakpad/src/common/linux/elfutils.cc", 514 "breakpad/src/common/linux/elfutils.h", 515 "breakpad/src/common/linux/file_id.cc", 516 "breakpad/src/common/linux/file_id.h", 517 "breakpad/src/common/linux/guid_creator.h", 518 "breakpad/src/common/linux/linux_libc_support.cc", 519 "breakpad/src/common/linux/linux_libc_support.h", 520 "breakpad/src/common/linux/memory_mapped_file.cc", 521 "breakpad/src/common/linux/memory_mapped_file.h", 522 "breakpad/src/common/module.cc", 523 "breakpad/src/common/module.h", 524 "breakpad/src/common/path_helper.cc", 525 "breakpad/src/common/path_helper.h", 526 "breakpad/src/common/stabs_reader.cc", 527 "breakpad/src/common/stabs_reader.h", 528 "breakpad/src/common/stabs_to_module.cc", 529 "breakpad/src/common/stabs_to_module.h", 530 "breakpad/src/tools/linux/dump_syms/dump_syms.cc", 531 ] 532 533 # There are some warnings in this code. 534 configs -= [ "//build/config/compiler:chromium_code" ] 535 configs += [ "//build/config/compiler:no_chromium_code" ] 536 537 # dwarf2reader.cc uses dynamic_cast. Because we don't typically 538 # don't support RTTI, we enable it for this single target. Since 539 # dump_syms doesn't share any object files with anything else, 540 # this doesn't end up polluting Chrome itself. 541 configs -= [ "//build/config/compiler:no_rtti" ] 542 configs += [ "//build/config/compiler:rtti" ] 543 544 # Breakpad rev 583 introduced this flag. 545 # Using this define, stabs_reader.h will include a.out.h to 546 # build on Linux. 547 defines = [ "HAVE_A_OUT_H" ] 548 549 include_dirs = [ "breakpad/src" ] 550 } 551 } else { 552 # Aliases for convenience. 553 binary_symlink("dump_syms") { 554 binary_label = ":dump_syms($host_toolchain)" 555 } 556 binary_symlink("symupload") { 557 binary_label = ":symupload($host_toolchain)" 558 } 559 } 560 561 static_library("client") { 562 # Want all these sources for both Linux and Android. 563 set_sources_assignment_filter([]) 564 sources = [ 565 "breakpad/src/client/linux/crash_generation/crash_generation_client.cc", 566 "breakpad/src/client/linux/crash_generation/crash_generation_client.h", 567 "breakpad/src/client/linux/dump_writer_common/mapping_info.h", 568 "breakpad/src/client/linux/dump_writer_common/thread_info.cc", 569 "breakpad/src/client/linux/dump_writer_common/thread_info.h", 570 "breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc", 571 "breakpad/src/client/linux/dump_writer_common/ucontext_reader.h", 572 "breakpad/src/client/linux/handler/exception_handler.cc", 573 "breakpad/src/client/linux/handler/exception_handler.h", 574 "breakpad/src/client/linux/handler/minidump_descriptor.cc", 575 "breakpad/src/client/linux/handler/minidump_descriptor.h", 576 "breakpad/src/client/linux/log/log.cc", 577 "breakpad/src/client/linux/log/log.h", 578 "breakpad/src/client/linux/microdump_writer/microdump_writer.cc", 579 "breakpad/src/client/linux/microdump_writer/microdump_writer.h", 580 "breakpad/src/client/linux/minidump_writer/cpu_set.h", 581 "breakpad/src/client/linux/minidump_writer/directory_reader.h", 582 "breakpad/src/client/linux/minidump_writer/line_reader.h", 583 "breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc", 584 "breakpad/src/client/linux/minidump_writer/linux_core_dumper.h", 585 "breakpad/src/client/linux/minidump_writer/linux_dumper.cc", 586 "breakpad/src/client/linux/minidump_writer/linux_dumper.h", 587 "breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc", 588 "breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.h", 589 "breakpad/src/client/linux/minidump_writer/minidump_writer.cc", 590 "breakpad/src/client/linux/minidump_writer/minidump_writer.h", 591 "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h", 592 "breakpad/src/client/minidump_file_writer-inl.h", 593 "breakpad/src/client/minidump_file_writer.cc", 594 "breakpad/src/client/minidump_file_writer.h", 595 "breakpad/src/common/convert_UTF.cc", 596 "breakpad/src/common/convert_UTF.h", 597 "breakpad/src/common/linux/elf_core_dump.cc", 598 "breakpad/src/common/linux/elf_core_dump.h", 599 "breakpad/src/common/linux/elfutils.cc", 600 "breakpad/src/common/linux/elfutils.h", 601 "breakpad/src/common/linux/file_id.cc", 602 "breakpad/src/common/linux/file_id.h", 603 "breakpad/src/common/linux/google_crashdump_uploader.cc", 604 "breakpad/src/common/linux/google_crashdump_uploader.h", 605 "breakpad/src/common/linux/guid_creator.cc", 606 "breakpad/src/common/linux/guid_creator.h", 607 "breakpad/src/common/linux/libcurl_wrapper.cc", 608 "breakpad/src/common/linux/libcurl_wrapper.h", 609 "breakpad/src/common/linux/linux_libc_support.cc", 610 "breakpad/src/common/linux/linux_libc_support.h", 611 "breakpad/src/common/linux/memory_mapped_file.cc", 612 "breakpad/src/common/linux/memory_mapped_file.h", 613 "breakpad/src/common/linux/safe_readlink.cc", 614 "breakpad/src/common/linux/safe_readlink.h", 615 "breakpad/src/common/memory_allocator.h", 616 "breakpad/src/common/simple_string_dictionary.cc", 617 "breakpad/src/common/simple_string_dictionary.h", 618 "breakpad/src/common/string_conversion.cc", 619 "breakpad/src/common/string_conversion.h", 620 ] 621 622 configs -= [ "//build/config/compiler:chromium_code" ] 623 configs += [ "//build/config/compiler:no_chromium_code" ] 624 public_configs = [ ":client_config" ] 625 626 if (current_cpu == "arm" && is_chromeos) { 627 # Avoid running out of registers in 628 # linux_syscall_support.h:sys_clone()'s inline assembly. 629 cflags = [ "-marm" ] 630 } 631 632 if (is_android) { 633 sources += [ "breakpad/src/common/android/breakpad_getcontext.S" ] 634 } 635 636 libs = [ "dl" ] 637 638 include_dirs = [ 639 ".", 640 "breakpad/src", 641 "breakpad/src/client", 642 "breakpad/src/third_party/linux/include", 643 ] 644 } 645 646 static_library("processor_support") { 647 set_sources_assignment_filter([]) 648 sources = [ 649 "breakpad/src/common/scoped_ptr.h", 650 "breakpad/src/processor/basic_code_modules.cc", 651 "breakpad/src/processor/basic_code_modules.h", 652 "breakpad/src/processor/convert_old_arm64_context.cc", 653 "breakpad/src/processor/convert_old_arm64_context.h", 654 "breakpad/src/processor/dump_context.cc", 655 "breakpad/src/processor/dump_object.cc", 656 "breakpad/src/processor/logging.cc", 657 "breakpad/src/processor/logging.h", 658 "breakpad/src/processor/minidump.cc", 659 "breakpad/src/processor/pathname_stripper.cc", 660 "breakpad/src/processor/pathname_stripper.h", 661 "breakpad/src/processor/proc_maps_linux.cc", 662 ] 663 664 include_dirs = [ 665 "breakpad/src", 666 "breakpad/src/client", 667 "breakpad/src/third_party/linux/include", 668 ".", 669 ] 670 671 # There are some warnings in this code. 672 configs -= [ "//build/config/compiler:chromium_code" ] 673 configs += [ "//build/config/compiler:no_chromium_code" ] 674 } 675 676 test("breakpad_unittests") { 677 set_sources_assignment_filter([]) 678 sources = [ 679 "breakpad/src/client/linux/handler/exception_handler_unittest.cc", 680 "breakpad/src/client/linux/minidump_writer/cpu_set_unittest.cc", 681 "breakpad/src/client/linux/minidump_writer/directory_reader_unittest.cc", 682 "breakpad/src/client/linux/minidump_writer/line_reader_unittest.cc", 683 "breakpad/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc", 684 "breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc", 685 "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc", 686 "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc", 687 "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc", 688 "breakpad/src/common/linux/elf_core_dump_unittest.cc", 689 "breakpad/src/common/linux/file_id_unittest.cc", 690 "breakpad/src/common/linux/linux_libc_support_unittest.cc", 691 "breakpad/src/common/linux/synth_elf.cc", 692 "breakpad/src/common/linux/tests/auto_testfile.h", 693 "breakpad/src/common/linux/tests/crash_generator.cc", 694 "breakpad/src/common/linux/tests/crash_generator.h", 695 "breakpad/src/common/memory_allocator_unittest.cc", 696 "breakpad/src/common/memory_range.h", 697 "breakpad/src/common/simple_string_dictionary_unittest.cc", 698 "breakpad/src/common/test_assembler.cc", 699 "breakpad/src/common/tests/file_utils.cc", 700 "breakpad/src/common/tests/file_utils.h", 701 "breakpad/src/tools/linux/md2core/minidump_memory_range.h", 702 "breakpad/src/tools/linux/md2core/minidump_memory_range_unittest.cc", 703 "linux/breakpad_googletest_includes.h", 704 ] 705 706 deps = [ 707 ":client", 708 ":processor_support", 709 "//testing/gmock", 710 "//testing/gtest", 711 "//testing/gtest:gtest_main", 712 ] 713 714 data_deps = [ 715 ":linux_dumper_unittest_helper", 716 "//testing/buildbot/filters:breakpad_unittests_filters", 717 ] 718 719 include_dirs = [ 720 "linux", # Use our copy of breakpad_googletest_includes.h 721 ".", 722 ] 723 724 # There are some warnings in this code. 725 configs -= [ "//build/config/compiler:chromium_code" ] 726 configs += [ 727 ":client_config", 728 "//build/config/compiler:no_chromium_code", 729 ] 730 731 if (is_clang) { 732 # See https://crbug.com/138571#c18 733 cflags = [ "-Wno-unused-value" ] 734 } 735 736 if (is_android) { 737 use_raw_android_executable = true 738 sources += 739 [ "breakpad/src/common/android/breakpad_getcontext_unittest.cc" ] 740 libs = [ "log" ] 741 extra_dist_files = [ "$root_out_dir/linux_dumper_unittest_helper" ] 742 } 743 744 # Add the breakpad unittest config at the end to override all configs. 745 configs += [ ":breakpad_unittest_config" ] 746 } 747 748 executable("linux_dumper_unittest_helper") { 749 set_sources_assignment_filter([]) 750 testonly = true 751 sources = [ "breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc" ] 752 deps = [ ":processor_support" ] 753 754 configs += [ ":client_config" ] 755 756 if (is_component_build) { 757 ldflags = [ "-Wl,-rpath,\$ORIGIN" ] 758 } 759 } 760 761 executable("generate_test_dump") { 762 set_sources_assignment_filter([]) 763 testonly = true 764 sources = [ "linux/generate-test-dump.cc" ] 765 766 # This file has an unused variable warning. 767 configs -= [ "//build/config/compiler:chromium_code" ] 768 configs += [ 769 ":client_config", 770 "//build/config/compiler:no_chromium_code", 771 ] 772 773 deps = [ ":client" ] 774 775 if (is_android) { 776 libs = [ "log" ] 777 } 778 } 779 780 executable("minidump-2-core") { 781 set_sources_assignment_filter([]) 782 sources = [ 783 "breakpad/src/common/path_helper.cc", 784 "breakpad/src/common/path_helper.h", 785 "breakpad/src/tools/linux/md2core/minidump-2-core.cc", 786 ] 787 788 include_dirs = [ "breakpad/src" ] 789 790 deps = [ ":client" ] 791 } 792 793 executable("core-2-minidump") { 794 set_sources_assignment_filter([]) 795 sources = [ "breakpad/src/tools/linux/core2md/core2md.cc" ] 796 797 deps = [ ":client" ] 798 799 include_dirs = [ "breakpad/src" ] 800 } 801} 802 803if (is_win) { 804 # Force a native symupload, since Chrome tries to be "helpful" and not really 805 # differentiate target vs. host for x86/x64 builds. 806 # 807 # Normally, this would just use the (current_toolchain == host_toolchain) 808 # condition, which would cause these targets to only be compiled for the host 809 # CPU (i.e. to only build "native" binaries), but the Chrome Windows build 810 # will "always use the target CPU for host builds for x86/x64": 811 # https://crrev.com/3258ed4d9d755a3564d98bef8707bbdb5f8a7974/config/BUILDCONFIG.gn#199 812 # This means that host_toolchain will be x86 (32-bit) if the target is x86, 813 # even when the host is actually x64 (64-bit), which causes this to create 814 # 32-bit binaries, despite wanting native, 64-bit binaries. 815 # 816 # Adding the second condition enables this block for the "true" host 817 # toolchain as well, which allows creating 64-bit binaries even when the host 818 # toolchain is redefined to a 32-bit target. 819 if (is_clang) { 820 symupload_toolchain = "//build/toolchain/win:win_clang_$host_cpu" 821 } else { 822 symupload_toolchain = "//build/toolchain/win:$host_cpu" 823 } 824 if (current_toolchain == host_toolchain || 825 current_toolchain == symupload_toolchain) { 826 static_library("common_windows") { 827 include_dirs = [ 828 "$visual_studio_path/DIA SDK/include", 829 "breakpad/src", 830 ] 831 832 sources = [ 833 "breakpad/src/common/windows/dia_util.cc", 834 "breakpad/src/common/windows/dia_util.h", 835 "breakpad/src/common/windows/guid_string.cc", 836 "breakpad/src/common/windows/guid_string.h", 837 "breakpad/src/common/windows/http_upload.cc", 838 "breakpad/src/common/windows/http_upload.h", 839 "breakpad/src/common/windows/module_info.h", 840 "breakpad/src/common/windows/omap.cc", 841 "breakpad/src/common/windows/omap.h", 842 "breakpad/src/common/windows/omap_internal.h", 843 "breakpad/src/common/windows/pdb_source_line_writer.cc", 844 "breakpad/src/common/windows/pdb_source_line_writer.h", 845 "breakpad/src/common/windows/pe_source_line_writer.cc", 846 "breakpad/src/common/windows/pe_source_line_writer.h", 847 "breakpad/src/common/windows/pe_util.cc", 848 "breakpad/src/common/windows/pe_util.h", 849 "breakpad/src/common/windows/string_utils-inl.h", 850 "breakpad/src/common/windows/string_utils.cc", 851 "breakpad/src/common/windows/symbol_collector_client.cc", 852 "breakpad/src/common/windows/symbol_collector_client.h", 853 ] 854 } 855 856 static_library("ms_symbol_server_converter") { 857 include_dirs = [ 858 "$visual_studio_path/DIA SDK/include", 859 "breakpad/src", 860 ] 861 862 sources = [ 863 "breakpad/src/tools/windows/converter/ms_symbol_server_converter.cc", 864 ] 865 866 deps = [ "//third_party/breakpad:common_windows" ] 867 868 libs = [ "Pathcch.lib" ] 869 } 870 871 executable("dump_syms") { 872 # TODO(scottmg) using this with VS2015 may break the crash server. 873 # https://crbug.com/696671 874 include_dirs = [ 875 "$visual_studio_path/DIA SDK/include", 876 "breakpad/src", 877 ] 878 879 sources = [ "breakpad/src/tools/windows/dump_syms/dump_syms.cc" ] 880 881 deps = [ "//third_party/breakpad:common_windows" ] 882 883 lib_dirs = [] 884 if (current_cpu == "x64") { 885 lib_dirs += [ "$visual_studio_path/DIA SDK/lib/amd64" ] 886 } else { 887 lib_dirs += [ "$visual_studio_path/DIA SDK/lib" ] 888 } 889 890 libs = [ 891 "diaguids.lib", 892 "imagehlp.lib", 893 ] 894 895 if (is_clang) { 896 # clang complains about microsoft-specific goto extensions. Instead of 897 # rewriting decade-old, goto-ridden code, disable the warning. 898 cflags = [ "-Wno-microsoft-goto" ] 899 } 900 } 901 902 group("symupload") { 903 deps = [ ":symupload_win($symupload_toolchain)" ] 904 } 905 executable("symupload_win") { 906 include_dirs = [ 907 "$visual_studio_path/DIA SDK/include", 908 "breakpad/src", 909 ] 910 output_name = "symupload" 911 912 # Invert the normal logic which puts binaries built with the default 913 # (target) toolchain into the root output directory, and other toolchain 914 # binaries into subdirs. This gives preference to the native symupload, 915 # which is what's wanted in most situations. The cross-compiled binary 916 # can still be created (by building "symupload_win" instead of 917 # "symupload") and found in the corresponding toolchain subdir (e.g. 918 # //out/Release/win_clang_x86/ when cross-compiling to x86). 919 if (current_toolchain == symupload_toolchain) { 920 output_dir = "$root_build_dir" 921 } else { 922 output_name = "symupload_$target_cpu" 923 toolchain_parts = 924 string_split(get_path_info(current_toolchain, "name"), ":") 925 output_dir = "$root_out_dir/" + toolchain_parts[1] 926 } 927 928 sources = [ "breakpad/src/tools/windows/symupload/symupload.cc" ] 929 930 deps = [ "//third_party/breakpad:common_windows" ] 931 932 ldflags = [ "/LARGEADDRESSAWARE" ] 933 934 lib_dirs = [] 935 if (current_cpu == "x64") { 936 lib_dirs += [ "$visual_studio_path/DIA SDK/lib/amd64" ] 937 } else { 938 lib_dirs += [ "$visual_studio_path/DIA SDK/lib" ] 939 } 940 941 libs = [ 942 "diaguids.lib", 943 "imagehlp.lib", 944 ] 945 946 if (is_clang) { 947 # clang complains about microsoft-specific goto extensions. Instead of 948 # rewriting decade-old, goto-ridden code, disable the warning. 949 cflags = [ "-Wno-microsoft-goto" ] 950 } 951 } 952 953 executable("google_converter") { 954 include_dirs = [ 955 "$visual_studio_path/DIA SDK/include", 956 "breakpad/src", 957 ] 958 959 sources = [ 960 "breakpad/src/tools/windows/converter_exe/converter.cc", 961 "breakpad/src/tools/windows/converter_exe/escaping.cc", 962 "breakpad/src/tools/windows/converter_exe/escaping.h", 963 "breakpad/src/tools/windows/converter_exe/http_download.cc", 964 "breakpad/src/tools/windows/converter_exe/tokenizer.cc", 965 "breakpad/src/tools/windows/converter_exe/winhttp_client.cc", 966 "breakpad/src/tools/windows/converter_exe/wininet_client.cc", 967 ] 968 969 deps = [ 970 "//third_party/breakpad:common_windows", 971 "//third_party/breakpad:ms_symbol_server_converter", 972 ] 973 974 ldflags = [ 975 "/DELAYLOAD:dbghelp.dll", 976 "/DELAYLOAD:dwmapi.dll", 977 "/DELAYLOAD:uxtheme.dll", 978 ] 979 980 lib_dirs = [] 981 if (current_cpu == "x64") { 982 lib_dirs += [ "$visual_studio_path/DIA SDK/lib/amd64" ] 983 } else { 984 lib_dirs += [ "$visual_studio_path/DIA SDK/lib" ] 985 } 986 987 libs = [ 988 "diaguids.lib", 989 "imagehlp.lib", 990 ] 991 992 if (is_clang) { 993 # clang complains about microsoft-specific goto extensions. Instead of 994 # rewriting decade-old, goto-ridden code, disable the warning. 995 cflags = [ "-Wno-microsoft-goto" ] 996 } 997 } 998 } else { 999 # handle dump_syms appropriately for Windows cross build when necessary, 1000 # such as symlinking. 1001 } 1002} 1003 1004if (is_ios) { 1005 static_library("client") { 1006 set_sources_assignment_filter([]) 1007 sources = [ 1008 "breakpad/src/client/ios/Breakpad.h", 1009 "breakpad/src/client/ios/Breakpad.mm", 1010 "breakpad/src/client/ios/BreakpadController.h", 1011 "breakpad/src/client/ios/BreakpadController.mm", 1012 "breakpad/src/client/ios/handler/ios_exception_minidump_generator.h", 1013 "breakpad/src/client/ios/handler/ios_exception_minidump_generator.mm", 1014 "breakpad/src/client/mac/crash_generation/ConfigFile.h", 1015 "breakpad/src/client/mac/crash_generation/ConfigFile.mm", 1016 "breakpad/src/client/mac/handler/breakpad_nlist_64.cc", 1017 "breakpad/src/client/mac/handler/breakpad_nlist_64.h", 1018 "breakpad/src/client/mac/handler/dynamic_images.cc", 1019 "breakpad/src/client/mac/handler/dynamic_images.h", 1020 "breakpad/src/client/mac/handler/exception_handler.cc", 1021 "breakpad/src/client/mac/handler/exception_handler.h", 1022 "breakpad/src/client/mac/handler/minidump_generator.cc", 1023 "breakpad/src/client/mac/handler/minidump_generator.h", 1024 "breakpad/src/client/mac/handler/protected_memory_allocator.cc", 1025 "breakpad/src/client/mac/handler/protected_memory_allocator.h", 1026 "breakpad/src/client/mac/sender/uploader.h", 1027 "breakpad/src/client/mac/sender/uploader.mm", 1028 "breakpad/src/client/minidump_file_writer-inl.h", 1029 "breakpad/src/client/minidump_file_writer.cc", 1030 "breakpad/src/client/minidump_file_writer.h", 1031 "breakpad/src/common/convert_UTF.cc", 1032 "breakpad/src/common/convert_UTF.h", 1033 "breakpad/src/common/long_string_dictionary.cc", 1034 "breakpad/src/common/mac/HTTPMultipartUpload.m", 1035 "breakpad/src/common/mac/file_id.cc", 1036 "breakpad/src/common/mac/file_id.h", 1037 "breakpad/src/common/mac/macho_id.cc", 1038 "breakpad/src/common/mac/macho_id.h", 1039 "breakpad/src/common/mac/macho_utilities.cc", 1040 "breakpad/src/common/mac/macho_utilities.h", 1041 "breakpad/src/common/mac/macho_walker.cc", 1042 "breakpad/src/common/mac/macho_walker.h", 1043 "breakpad/src/common/mac/string_utilities.cc", 1044 "breakpad/src/common/mac/string_utilities.h", 1045 "breakpad/src/common/md5.cc", 1046 "breakpad/src/common/md5.h", 1047 "breakpad/src/common/simple_string_dictionary.cc", 1048 "breakpad/src/common/simple_string_dictionary.h", 1049 "breakpad/src/common/string_conversion.cc", 1050 "breakpad/src/common/string_conversion.h", 1051 "breakpad/src/google_breakpad/common/minidump_format.h", 1052 ] 1053 set_sources_assignment_filter(sources_assignment_filter) 1054 1055 include_dirs = [ 1056 "breakpad/src", 1057 "breakpad/src/client/mac/Framework", 1058 "breakpad/src/common/mac", 1059 ] 1060 1061 public_configs = [ ":client_config" ] 1062 1063 if (is_clang) { 1064 # See https://crbug.com/google-breakpad/675. 1065 cflags = [ "-Wno-deprecated-declarations" ] 1066 } 1067 } 1068} 1069 1070if (is_win) { 1071 group("client") { 1072 public_configs = [ ":client_config" ] 1073 } 1074 1075 config("breakpad_handler_warnings") { 1076 if (is_clang) { 1077 # See https://crbug.com/google-breakpad/658. 1078 cflags = [ "-Wno-reorder" ] 1079 } 1080 } 1081 1082 static_library("breakpad_handler") { 1083 configs += [ ":handler_config" ] 1084 if (is_win) { 1085 public_configs = [ ":handler_config" ] 1086 } 1087 1088 defines = [ "BREAKPAD_NO_TERMINATE_THREAD" ] 1089 1090 sources = [ 1091 "breakpad/src/client/windows/crash_generation/client_info.cc", 1092 "breakpad/src/client/windows/crash_generation/client_info.h", 1093 "breakpad/src/client/windows/crash_generation/crash_generation_client.cc", 1094 "breakpad/src/client/windows/crash_generation/crash_generation_client.h", 1095 "breakpad/src/client/windows/crash_generation/crash_generation_server.cc", 1096 "breakpad/src/client/windows/crash_generation/crash_generation_server.h", 1097 "breakpad/src/client/windows/crash_generation/minidump_generator.cc", 1098 "breakpad/src/client/windows/crash_generation/minidump_generator.h", 1099 "breakpad/src/client/windows/handler/exception_handler.cc", 1100 "breakpad/src/client/windows/handler/exception_handler.h", 1101 "breakpad/src/common/windows/guid_string.cc", 1102 "breakpad/src/common/windows/guid_string.h", 1103 "breakpad/src/common/windows/string_utils-inl.h", 1104 "breakpad/src/google_breakpad/common/minidump_format.h", 1105 ] 1106 configs += [ ":breakpad_handler_warnings" ] 1107 } 1108 1109 source_set("breakpad_sender") { 1110 sources = [ 1111 "breakpad/src/client/windows/sender/crash_report_sender.cc", 1112 "breakpad/src/client/windows/sender/crash_report_sender.h", 1113 "breakpad/src/common/windows/http_upload.cc", 1114 "breakpad/src/common/windows/http_upload.h", 1115 ] 1116 configs += [ ":sender_config" ] 1117 public_configs = [ ":sender_config" ] 1118 } 1119} 1120