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