Revert "Use the authoritative upstream source for Breakpad, move to third_party"
This reverts commit 5b41612edd88c44f77a686d85f0a8d7cc42ba56e.
Reason for revert: https://crbug.com/768262
Original change's description:
> Use the authoritative upstream source for Breakpad, move to third_party
>
> Breakpad was being synced from a read-only mirror of a subdirectory
> rather than the authoritative upstream source. This encouraged Chrome
> developers to send patches against the read-only mirror. Those patches
> couldn’t be committed and needed to be duplicated in the correct
> repository. Once, a patch against the read-only mirror accidentally was
> committed, and it broke mirroring.
>
> This odd setup existed from the time of the git migration. Prior to
> that, Breakpad was hosted in Subversion, and Chrome incidentally pulled
> Breakpad’s src subdirectory rather than the entire trunk directory.
> Because it wasn‘t easy to do the same thing with git, the read-only
> mirror of src was created to avoid having to change lots of paths in
> Chrome. But now I’m changing the paths.
>
> This also moves Breakpad from the top-level breakpad directory in Chrome
> to third_party/breakpad. It should have been there all along, but
> Breakpad was one of the earliest dependencies added to Chrome, and at
> that time, there was no firm policy on where to put Google-originated
> external code.
>
> Bug: 766917
> TBR: pinkerton@chromium.org
> Change-Id: I860a3e92b0327898ba73b8678af258a9020eeaaf
> Reviewed-on: https://chromium-review.googlesource.com/677280
> Commit-Queue: Mark Mentovai <mark@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#503925}
TBR=thestig@chromium.org,pinkerton@chromium.org,mark@chromium.org
NOTREECHECKS=true
NOTRY=true
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: 766917
Change-Id: Ie1590163f53cc7180506101aacf6cf39964e1457
Reviewed-on: https://chromium-review.googlesource.com/681014
Commit-Queue: Peter Conn <peconn@chromium.org>
Reviewed-by: Peter Conn <peconn@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#504018}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0b24f77010b8af4dabc0d3cf37c2e864b29f5ed7
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..fb2aeea
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,993 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/symlink.gni")
+import("//testing/libfuzzer/fuzzer_test.gni")
+import("//testing/test.gni")
+
+if (is_win) {
+ import("//build/config/win/visual_studio_version.gni")
+}
+
+config("tools_config") {
+ include_dirs = [
+ "src",
+ "src/third_party",
+ ]
+ if (is_android) {
+ defines = [ "__ANDROID__" ]
+ }
+ if (is_clang) {
+ cflags = [ "-Wno-tautological-constant-out-of-range-compare" ]
+ }
+}
+
+config("internal_config") {
+ include_dirs = [ "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 = [ "src" ]
+ if (is_android) {
+ include_dirs += [ "src/common/android/include" ]
+ }
+ if (is_chromeos) {
+ defines = [ "__CHROMEOS__" ]
+ }
+}
+
+config("handler_config") {
+ include_dirs = [ "src" ]
+}
+
+config("sender_config") {
+ include_dirs = [ "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" ]
+}
+
+# {micro,mini}dump_stackwalk and minidump_dump are tool-type executables
+# that do not build on Windows.
+if (!is_win) {
+ if (current_toolchain == host_toolchain) {
+ # Contains the code shared by both {micro,mini}dump_stackwalk.
+ static_library("stackwalk_common") {
+ # Always want these files included regardless of platform.
+ set_sources_assignment_filter([])
+ sources = [
+ "src/processor/basic_code_module.h",
+ "src/processor/basic_code_modules.cc",
+ "src/processor/basic_code_modules.h",
+ "src/processor/basic_source_line_resolver.cc",
+ "src/processor/call_stack.cc",
+ "src/processor/cfi_frame_info.cc",
+ "src/processor/cfi_frame_info.h",
+ "src/processor/disassembler_x86.cc",
+ "src/processor/disassembler_x86.h",
+ "src/processor/dump_context.cc",
+ "src/processor/dump_object.cc",
+ "src/processor/logging.cc",
+ "src/processor/logging.h",
+ "src/processor/pathname_stripper.cc",
+ "src/processor/pathname_stripper.h",
+ "src/processor/proc_maps_linux.cc",
+ "src/processor/process_state.cc",
+ "src/processor/simple_symbol_supplier.cc",
+ "src/processor/simple_symbol_supplier.h",
+ "src/processor/source_line_resolver_base.cc",
+ "src/processor/stack_frame_cpu.cc",
+ "src/processor/stack_frame_symbolizer.cc",
+ "src/processor/stackwalk_common.cc",
+ "src/processor/stackwalker.cc",
+ "src/processor/stackwalker_amd64.cc",
+ "src/processor/stackwalker_amd64.h",
+ "src/processor/stackwalker_arm.cc",
+ "src/processor/stackwalker_arm.h",
+ "src/processor/stackwalker_arm64.cc",
+ "src/processor/stackwalker_arm64.h",
+ "src/processor/stackwalker_mips.cc",
+ "src/processor/stackwalker_mips.h",
+ "src/processor/stackwalker_ppc.cc",
+ "src/processor/stackwalker_ppc.h",
+ "src/processor/stackwalker_ppc64.cc",
+ "src/processor/stackwalker_ppc64.h",
+ "src/processor/stackwalker_sparc.cc",
+ "src/processor/stackwalker_sparc.h",
+ "src/processor/stackwalker_x86.cc",
+ "src/processor/stackwalker_x86.h",
+ "src/processor/tokenize.cc",
+ "src/processor/tokenize.h",
+
+ # libdisasm
+ "src/third_party/libdisasm/ia32_implicit.c",
+ "src/third_party/libdisasm/ia32_implicit.h",
+ "src/third_party/libdisasm/ia32_insn.c",
+ "src/third_party/libdisasm/ia32_insn.h",
+ "src/third_party/libdisasm/ia32_invariant.c",
+ "src/third_party/libdisasm/ia32_invariant.h",
+ "src/third_party/libdisasm/ia32_modrm.c",
+ "src/third_party/libdisasm/ia32_modrm.h",
+ "src/third_party/libdisasm/ia32_opcode_tables.c",
+ "src/third_party/libdisasm/ia32_opcode_tables.h",
+ "src/third_party/libdisasm/ia32_operand.c",
+ "src/third_party/libdisasm/ia32_operand.h",
+ "src/third_party/libdisasm/ia32_reg.c",
+ "src/third_party/libdisasm/ia32_reg.h",
+ "src/third_party/libdisasm/ia32_settings.c",
+ "src/third_party/libdisasm/ia32_settings.h",
+ "src/third_party/libdisasm/libdis.h",
+ "src/third_party/libdisasm/qword.h",
+ "src/third_party/libdisasm/x86_disasm.c",
+ "src/third_party/libdisasm/x86_format.c",
+ "src/third_party/libdisasm/x86_imm.c",
+ "src/third_party/libdisasm/x86_imm.h",
+ "src/third_party/libdisasm/x86_insn.c",
+ "src/third_party/libdisasm/x86_misc.c",
+ "src/third_party/libdisasm/x86_operand_list.c",
+ "src/third_party/libdisasm/x86_operand_list.h",
+ ]
+
+ defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" ]
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ configs += [ ":tools_config" ]
+ }
+
+ fuzzer_test("minidump_fuzzer") {
+ sources = [
+ "minidump_fuzzer.cc",
+ "src/processor/exploitability.cc",
+ "src/processor/minidump.cc",
+ "src/processor/minidump_processor.cc",
+ ]
+
+ deps = [
+ ":stackwalk_common",
+ "//base",
+ ]
+
+ defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" ]
+ include_dirs = [ "src" ]
+ dict = "minidump_fuzzer.dict"
+
+ libfuzzer_options = [
+ "close_fd_mask=3",
+ "max_len=128000",
+ ]
+
+ # Always want these files included regardless of platform.
+ set_sources_assignment_filter([])
+ sources += [
+ "src/processor/exploitability_linux.cc",
+ "src/processor/exploitability_linux.h",
+ "src/processor/exploitability_win.cc",
+ "src/processor/exploitability_win.h",
+ "src/processor/symbolic_constants_win.cc",
+ "src/processor/symbolic_constants_win.h",
+ ]
+ }
+
+ executable("microdump_stackwalk") {
+ sources = [
+ "src/processor/microdump.cc",
+ "src/processor/microdump_processor.cc",
+ "src/processor/microdump_stackwalk.cc",
+ ]
+
+ deps = [
+ ":stackwalk_common",
+ "//build/config:exe_and_shlib_deps",
+ ]
+
+ defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" ]
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ configs += [ ":tools_config" ]
+ }
+
+ executable("minidump_stackwalk") {
+ sources = [
+ "src/processor/exploitability.cc",
+ "src/processor/minidump.cc",
+ "src/processor/minidump_processor.cc",
+ "src/processor/minidump_stackwalk.cc",
+ ]
+
+ deps = [
+ ":stackwalk_common",
+ "//build/config:exe_and_shlib_deps",
+ ]
+
+ defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" ]
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ configs += [ ":tools_config" ]
+
+ # Always want these files included regardless of platform.
+ set_sources_assignment_filter([])
+ sources += [
+ "src/processor/exploitability_linux.cc",
+ "src/processor/exploitability_linux.h",
+ "src/processor/exploitability_win.cc",
+ "src/processor/exploitability_win.h",
+ "src/processor/symbolic_constants_win.cc",
+ "src/processor/symbolic_constants_win.h",
+ ]
+ }
+
+ executable("minidump_dump") {
+ set_sources_assignment_filter([])
+ sources = [
+ "src/processor/basic_code_module.h",
+ "src/processor/basic_code_modules.cc",
+ "src/processor/basic_code_modules.h",
+ "src/processor/dump_context.cc",
+ "src/processor/dump_object.cc",
+ "src/processor/logging.cc",
+ "src/processor/logging.h",
+ "src/processor/minidump.cc",
+ "src/processor/minidump_dump.cc",
+ "src/processor/pathname_stripper.cc",
+ "src/processor/pathname_stripper.h",
+ "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" ]
+
+ deps = [
+ "//build/config:exe_and_shlib_deps",
+ ]
+ }
+ } else {
+ # Aliases for convenience.
+ binary_symlink("microdump_stackwalk") {
+ binary_label = ":$target_name($host_toolchain)"
+ }
+ binary_symlink("minidump_stackwalk") {
+ binary_label = ":$target_name($host_toolchain)"
+ }
+ binary_symlink("minidump_dump") {
+ binary_label = ":$target_name($host_toolchain)"
+ }
+ }
+}
+
+# Mac --------------------------------------------------------------------------
+
+if (is_mac) {
+ if (current_toolchain == host_toolchain) {
+ # TODO(GYP) This should be only 64-bit on Mac. From .gypi:
+ # Like ld, dump_syms needs to operate on enough data that it may
+ # actually need to be able to address more than 4GB. Use x86_64.
+ # Don't worry! An x86_64 dump_syms is perfectly able to dump
+ # 32-bit files.
+ executable("dump_syms") {
+ sources = [
+ "src/common/dwarf/bytereader.cc",
+ "src/common/dwarf/dwarf2diehandler.cc",
+ "src/common/dwarf/dwarf2reader.cc",
+ "src/common/dwarf/elf_reader.cc",
+ "src/common/dwarf/elf_reader.h",
+ "src/common/dwarf_cfi_to_module.cc",
+ "src/common/dwarf_cu_to_module.cc",
+ "src/common/dwarf_line_to_module.cc",
+ "src/common/language.cc",
+ "src/common/mac/arch_utilities.cc",
+ "src/common/mac/arch_utilities.h",
+ "src/common/mac/dump_syms.cc",
+ "src/common/mac/file_id.cc",
+ "src/common/mac/macho_id.cc",
+ "src/common/mac/macho_reader.cc",
+ "src/common/mac/macho_utilities.cc",
+ "src/common/mac/macho_walker.cc",
+ "src/common/md5.cc",
+ "src/common/module.cc",
+ "src/common/stabs_reader.cc",
+ "src/common/stabs_to_module.cc",
+ "src/tools/mac/dump_syms/dump_syms_tool.cc",
+ ]
+
+ # For src/common/stabs_reader.h.
+ defines = [ "HAVE_MACH_O_NLIST_H" ]
+ include_dirs = [ "src/common/mac" ]
+
+ # The DWARF utilities require -funsigned-char.
+ cflags = [ "-funsigned-char" ]
+
+ configs += [ ":internal_config" ]
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+
+ # dwarf2reader.cc uses dynamic_cast.
+ configs -= [ "//build/config/compiler:no_rtti" ]
+ configs += [ "//build/config/compiler:rtti" ]
+
+ libs = [ "Foundation.framework" ]
+
+ if (!is_debug) {
+ # dump_syms crashes when built at -O1, -O2, and -O3. It does
+ # not crash at -Os. To play it safe, dump_syms is always built
+ # at -O0 until this can be sorted out.
+ # http://code.google.com/p/google-breakpad/issues/detail?id=329
+ configs -= [ "//build/config/compiler:default_optimization" ]
+ cflags += [ "-O0" ]
+ }
+
+ deps = [
+ "//build/config:exe_and_shlib_deps",
+ ]
+ }
+
+ executable("symupload") {
+ sources = [
+ "src/common/mac/HTTPMultipartUpload.m",
+ "src/tools/mac/symupload/symupload.m",
+ ]
+
+ include_dirs = [ "src/common/mac" ]
+
+ libs = [ "Foundation.framework" ]
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+
+ deps = [
+ "//build/config:exe_and_shlib_deps",
+ ]
+ }
+ } else {
+ binary_symlink("dump_syms") {
+ binary_label = ":$target_name($host_toolchain)"
+ }
+ binary_symlink("symupload") {
+ binary_label = ":$target_name($host_toolchain)"
+ }
+ }
+}
+
+if (is_ios) {
+ binary_symlink("dump_syms") {
+ binary_label = ":$target_name($host_toolchain)"
+ }
+ binary_symlink("symupload") {
+ binary_label = ":$target_name($host_toolchain)"
+ }
+}
+
+if (is_mac) {
+ static_library("utilities") {
+ sources = [
+ "src/client/mac/crash_generation/ConfigFile.mm",
+ "src/client/mac/handler/breakpad_nlist_64.cc",
+ "src/client/mac/handler/dynamic_images.cc",
+ "src/client/mac/handler/minidump_generator.cc",
+ "src/client/minidump_file_writer.cc",
+ "src/common/convert_UTF.c",
+ "src/common/mac/MachIPC.mm",
+ "src/common/mac/arch_utilities.cc",
+ "src/common/mac/bootstrap_compat.cc",
+ "src/common/mac/file_id.cc",
+ "src/common/mac/launch_reporter.cc",
+ "src/common/mac/macho_id.cc",
+ "src/common/mac/macho_utilities.cc",
+ "src/common/mac/macho_walker.cc",
+ "src/common/mac/string_utilities.cc",
+ "src/common/md5.cc",
+ "src/common/simple_string_dictionary.cc",
+ "src/common/string_conversion.cc",
+ ]
+
+ configs += [ ":internal_config" ]
+
+ # There are some warnings in this code.
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ }
+
+ executable("crash_inspector") {
+ sources = [
+ "src/client/mac/crash_generation/Inspector.mm",
+ "src/client/mac/crash_generation/InspectorMain.mm",
+ ]
+
+ # TODO(GYP): 'mac_real_dsym': 1,
+
+ include_dirs = [
+ "src/client/apple/Framework",
+ "src/common/mac",
+ "src",
+ ]
+ libs = [
+ "CoreServices.framework",
+ "Foundation.framework",
+ ]
+
+ deps = [
+ ":utilities",
+ "//build/config:exe_and_shlib_deps",
+ ]
+ }
+
+ # TODO(GYP) this target has some mac_bundle_resources stuff.
+ # executable("crash_report_sender") {
+ # }
+ group("crash_report_sender") {
+ }
+
+ config("breakpad_config") {
+ include_dirs = [ "src/client/apple/Framework" ]
+ }
+
+ static_library("breakpad") {
+ sources = [
+ "src/client/mac/Framework/Breakpad.mm",
+ "src/client/mac/Framework/OnDemandServer.mm",
+ "src/client/mac/crash_generation/crash_generation_client.cc",
+ "src/client/mac/crash_generation/crash_generation_client.h",
+ "src/client/mac/handler/exception_handler.cc",
+ "src/client/mac/handler/protected_memory_allocator.cc",
+ ]
+
+ configs += [ ":internal_config" ]
+ public_configs = [ ":breakpad_config" ]
+
+ defines = [ "USE_PROTECTED_ALLOCATIONS=1" ]
+ include_dirs = [ "src/client/apple/Framework" ]
+
+ deps = [
+ ":crash_inspector",
+ ":crash_report_sender",
+ ":utilities",
+ ]
+ }
+
+ group("client") {
+ public_configs = [ ":client_config" ]
+ }
+}
+
+if (is_linux || is_android) {
+ if (current_toolchain == host_toolchain) {
+ executable("symupload") {
+ sources = [
+ "src/common/linux/http_upload.cc",
+ "src/common/linux/http_upload.h",
+ "src/common/linux/symbol_upload.cc",
+ "src/common/linux/symbol_upload.h",
+ "src/tools/linux/symupload/sym_upload.cc",
+ ]
+
+ include_dirs = [
+ "src",
+ "src/third_party",
+ ]
+
+ configs += [ ":tools_config" ]
+
+ libs = [ "dl" ]
+
+ deps = [
+ "//build/config:exe_and_shlib_deps",
+ ]
+ }
+
+ # dump_syms is a host tool, so only compile it for the host system.
+ executable("dump_syms") {
+ sources = [
+ "src/common/dwarf/bytereader.cc",
+ "src/common/dwarf/dwarf2diehandler.cc",
+ "src/common/dwarf/dwarf2reader.cc",
+ "src/common/dwarf/elf_reader.cc",
+ "src/common/dwarf/elf_reader.h",
+ "src/common/dwarf_cfi_to_module.cc",
+ "src/common/dwarf_cfi_to_module.h",
+ "src/common/dwarf_cu_to_module.cc",
+ "src/common/dwarf_cu_to_module.h",
+ "src/common/dwarf_line_to_module.cc",
+ "src/common/dwarf_line_to_module.h",
+ "src/common/language.cc",
+ "src/common/language.h",
+ "src/common/linux/crc32.cc",
+ "src/common/linux/crc32.h",
+ "src/common/linux/dump_symbols.cc",
+ "src/common/linux/dump_symbols.h",
+ "src/common/linux/elf_symbols_to_module.cc",
+ "src/common/linux/elf_symbols_to_module.h",
+ "src/common/linux/elfutils.cc",
+ "src/common/linux/elfutils.h",
+ "src/common/linux/file_id.cc",
+ "src/common/linux/file_id.h",
+ "src/common/linux/guid_creator.h",
+ "src/common/linux/linux_libc_support.cc",
+ "src/common/linux/linux_libc_support.h",
+ "src/common/linux/memory_mapped_file.cc",
+ "src/common/linux/memory_mapped_file.h",
+ "src/common/module.cc",
+ "src/common/module.h",
+ "src/common/stabs_reader.cc",
+ "src/common/stabs_reader.h",
+ "src/common/stabs_to_module.cc",
+ "src/common/stabs_to_module.h",
+ "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 = [ "src" ]
+
+ deps = [
+ "//build/config:exe_and_shlib_deps",
+ ]
+ }
+ } else {
+ # Aliases for convenience.
+ binary_symlink("dump_syms") {
+ binary_label = ":dump_syms($host_toolchain)"
+ }
+ binary_symlink("symupload") {
+ binary_label = ":symupload($host_toolchain)"
+ }
+ }
+
+ static_library("client") {
+ # Want all these sources for both Linux and Android.
+ set_sources_assignment_filter([])
+ sources = [
+ "src/client/linux/crash_generation/crash_generation_client.cc",
+ "src/client/linux/crash_generation/crash_generation_client.h",
+ "src/client/linux/dump_writer_common/mapping_info.h",
+ "src/client/linux/dump_writer_common/thread_info.cc",
+ "src/client/linux/dump_writer_common/thread_info.h",
+ "src/client/linux/dump_writer_common/ucontext_reader.cc",
+ "src/client/linux/dump_writer_common/ucontext_reader.h",
+ "src/client/linux/handler/exception_handler.cc",
+ "src/client/linux/handler/exception_handler.h",
+ "src/client/linux/handler/minidump_descriptor.cc",
+ "src/client/linux/handler/minidump_descriptor.h",
+ "src/client/linux/log/log.cc",
+ "src/client/linux/log/log.h",
+ "src/client/linux/microdump_writer/microdump_writer.cc",
+ "src/client/linux/microdump_writer/microdump_writer.h",
+ "src/client/linux/minidump_writer/cpu_set.h",
+ "src/client/linux/minidump_writer/directory_reader.h",
+ "src/client/linux/minidump_writer/line_reader.h",
+ "src/client/linux/minidump_writer/linux_core_dumper.cc",
+ "src/client/linux/minidump_writer/linux_core_dumper.h",
+ "src/client/linux/minidump_writer/linux_dumper.cc",
+ "src/client/linux/minidump_writer/linux_dumper.h",
+ "src/client/linux/minidump_writer/linux_ptrace_dumper.cc",
+ "src/client/linux/minidump_writer/linux_ptrace_dumper.h",
+ "src/client/linux/minidump_writer/minidump_writer.cc",
+ "src/client/linux/minidump_writer/minidump_writer.h",
+ "src/client/linux/minidump_writer/proc_cpuinfo_reader.h",
+ "src/client/minidump_file_writer-inl.h",
+ "src/client/minidump_file_writer.cc",
+ "src/client/minidump_file_writer.h",
+ "src/common/convert_UTF.c",
+ "src/common/convert_UTF.h",
+ "src/common/linux/elf_core_dump.cc",
+ "src/common/linux/elf_core_dump.h",
+ "src/common/linux/elfutils.cc",
+ "src/common/linux/elfutils.h",
+ "src/common/linux/file_id.cc",
+ "src/common/linux/file_id.h",
+ "src/common/linux/google_crashdump_uploader.cc",
+ "src/common/linux/google_crashdump_uploader.h",
+ "src/common/linux/guid_creator.cc",
+ "src/common/linux/guid_creator.h",
+ "src/common/linux/libcurl_wrapper.cc",
+ "src/common/linux/libcurl_wrapper.h",
+ "src/common/linux/linux_libc_support.cc",
+ "src/common/linux/linux_libc_support.h",
+ "src/common/linux/memory_mapped_file.cc",
+ "src/common/linux/memory_mapped_file.h",
+ "src/common/linux/safe_readlink.cc",
+ "src/common/linux/safe_readlink.h",
+ "src/common/memory.h",
+ "src/common/simple_string_dictionary.cc",
+ "src/common/simple_string_dictionary.h",
+ "src/common/string_conversion.cc",
+ "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) {
+ # Avoid running out of registers in
+ # linux_syscall_support.h:sys_clone()'s inline assembly.
+ cflags = [ "-marm" ]
+ }
+
+ # Clang's -mstackrealign doesn't work well with
+ # linux_syscall_support.h hand written asm syscalls.
+ # See https://crbug.com/556393
+ configs -= [ "//build/config/compiler:clang_stackrealign" ]
+
+ if (is_android) {
+ sources += [ "src/common/android/breakpad_getcontext.S" ]
+ }
+
+ libs = [ "dl" ]
+
+ include_dirs = [
+ ".",
+ "src",
+ "src/client",
+ "src/third_party/linux/include",
+ ]
+ }
+
+ static_library("processor_support") {
+ set_sources_assignment_filter([])
+ sources = [
+ "src/common/scoped_ptr.h",
+ "src/processor/basic_code_modules.cc",
+ "src/processor/basic_code_modules.h",
+ "src/processor/dump_context.cc",
+ "src/processor/dump_object.cc",
+ "src/processor/logging.cc",
+ "src/processor/logging.h",
+ "src/processor/minidump.cc",
+ "src/processor/pathname_stripper.cc",
+ "src/processor/pathname_stripper.h",
+ "src/processor/proc_maps_linux.cc",
+ ]
+
+ include_dirs = [
+ "src",
+ "src/client",
+ "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") {
+ set_sources_assignment_filter([])
+ sources = [
+ "linux/breakpad_googletest_includes.h",
+ "src/client/linux/handler/exception_handler_unittest.cc",
+ "src/client/linux/minidump_writer/cpu_set_unittest.cc",
+ "src/client/linux/minidump_writer/directory_reader_unittest.cc",
+ "src/client/linux/minidump_writer/line_reader_unittest.cc",
+ "src/client/linux/minidump_writer/linux_core_dumper_unittest.cc",
+ "src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc",
+ "src/client/linux/minidump_writer/minidump_writer_unittest.cc",
+ "src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
+ "src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
+ "src/common/linux/elf_core_dump_unittest.cc",
+ "src/common/linux/file_id_unittest.cc",
+ "src/common/linux/linux_libc_support_unittest.cc",
+ "src/common/linux/synth_elf.cc",
+ "src/common/linux/tests/auto_testfile.h",
+ "src/common/linux/tests/crash_generator.cc",
+ "src/common/linux/tests/crash_generator.h",
+ "src/common/memory_range.h",
+ "src/common/memory_unittest.cc",
+ "src/common/simple_string_dictionary_unittest.cc",
+ "src/common/test_assembler.cc",
+ "src/common/tests/file_utils.cc",
+ "src/common/tests/file_utils.h",
+ "src/tools/linux/md2core/minidump_memory_range.h",
+ "src/tools/linux/md2core/minidump_memory_range_unittest.cc",
+ ]
+
+ deps = [
+ ":client",
+ ":linux_dumper_unittest_helper",
+ ":processor_support",
+ "//build/config:exe_and_shlib_deps",
+ "//testing/gmock",
+ "//testing/gtest",
+ "//testing/gtest:gtest_main",
+ ]
+
+ include_dirs = [
+ "linux", # 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 http://crbug.com/138571#c18
+ cflags = [ "-Wno-unused-value" ]
+ }
+
+ if (is_android) {
+ use_raw_android_executable = true
+ sources += [ "src/common/android/breakpad_getcontext_unittest.cc" ]
+ libs = [ "log" ]
+ extra_dist_files = [ "$root_out_dir/linux_dumper_unittest_helper" ]
+ }
+
+ # Clang's -mstackrealign doesn't work well with
+ # linux_syscall_support.h hand written asm syscalls.
+ # See https://crbug.com/556393
+ configs -= [ "//build/config/compiler:clang_stackrealign" ]
+
+ # Add the breakpad unittest config at the end to override all configs.
+ configs += [ ":breakpad_unittest_config" ]
+ }
+
+ executable("linux_dumper_unittest_helper") {
+ set_sources_assignment_filter([])
+ testonly = true
+ sources = [
+ "src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc",
+ ]
+ deps = [
+ ":processor_support",
+ "//build/config:exe_and_shlib_deps",
+ ]
+
+ configs += [ ":client_config" ]
+
+ if (is_component_build) {
+ ldflags = [
+ "-Wl,-rpath,",
+ rebase_path(root_build_dir),
+ ]
+ }
+ }
+
+ executable("generate_test_dump") {
+ set_sources_assignment_filter([])
+ 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",
+ "//build/config:exe_and_shlib_deps",
+ ]
+
+ if (is_android) {
+ libs = [ "log" ]
+ }
+ }
+
+ executable("minidump-2-core") {
+ set_sources_assignment_filter([])
+ sources = [
+ "src/tools/linux/md2core/minidump-2-core.cc",
+ ]
+
+ include_dirs = [ "src" ]
+
+ deps = [
+ ":client",
+ "//build/config:exe_and_shlib_deps",
+ ]
+ }
+
+ executable("core-2-minidump") {
+ set_sources_assignment_filter([])
+ sources = [
+ "src/tools/linux/core2md/core2md.cc",
+ ]
+
+ deps = [
+ ":client",
+ "//build/config:exe_and_shlib_deps",
+ ]
+
+ include_dirs = [ "src" ]
+ }
+}
+
+if (is_win) {
+ executable("dump_syms") {
+ # TODO(scottmg) using this with VS2015 may break the crash server.
+ # https://crbug.com/696671
+ include_dirs = [
+ "$visual_studio_path/DIA SDK/include",
+ "src",
+ ]
+
+ sources = [
+ "src/common/windows/dia_util.cc",
+ "src/common/windows/dia_util.h",
+ "src/common/windows/guid_string.cc",
+ "src/common/windows/guid_string.h",
+ "src/common/windows/omap.cc",
+ "src/common/windows/omap.h",
+ "src/common/windows/pdb_source_line_writer.cc",
+ "src/common/windows/pdb_source_line_writer.h",
+ "src/common/windows/string_utils-inl.h",
+ "src/common/windows/string_utils.cc",
+ "src/tools/windows/dump_syms/dump_syms.cc",
+ ]
+
+ lib_dirs = []
+ if (target_cpu == "x64") {
+ lib_dirs += [ "$visual_studio_path/DIA SDK/lib/amd64" ]
+ } else {
+ lib_dirs += [ "$visual_studio_path/DIA SDK/lib" ]
+ }
+
+ libs = [
+ "diaguids.lib",
+ "imagehlp.lib",
+ ]
+ if (is_clang) {
+ # clang complains about microsoft-specific goto extensions. Instead of
+ # rewriting decade-old, goto-ridden code, disable the warning.
+ cflags = [ "-Wno-microsoft-goto" ]
+ }
+ }
+}
+
+if (is_ios) {
+ static_library("client") {
+ set_sources_assignment_filter([])
+ sources = [
+ "src/client/ios/Breakpad.h",
+ "src/client/ios/Breakpad.mm",
+ "src/client/ios/BreakpadController.h",
+ "src/client/ios/BreakpadController.mm",
+ "src/client/ios/handler/ios_exception_minidump_generator.h",
+ "src/client/ios/handler/ios_exception_minidump_generator.mm",
+ "src/client/mac/crash_generation/ConfigFile.h",
+ "src/client/mac/crash_generation/ConfigFile.mm",
+ "src/client/mac/handler/breakpad_nlist_64.cc",
+ "src/client/mac/handler/breakpad_nlist_64.h",
+ "src/client/mac/handler/dynamic_images.cc",
+ "src/client/mac/handler/dynamic_images.h",
+ "src/client/mac/handler/exception_handler.cc",
+ "src/client/mac/handler/exception_handler.h",
+ "src/client/mac/handler/minidump_generator.cc",
+ "src/client/mac/handler/minidump_generator.h",
+ "src/client/mac/handler/protected_memory_allocator.cc",
+ "src/client/mac/handler/protected_memory_allocator.h",
+ "src/client/mac/sender/uploader.h",
+ "src/client/mac/sender/uploader.mm",
+ "src/client/minidump_file_writer-inl.h",
+ "src/client/minidump_file_writer.cc",
+ "src/client/minidump_file_writer.h",
+ "src/common/convert_UTF.c",
+ "src/common/convert_UTF.h",
+ "src/common/mac/HTTPMultipartUpload.m",
+ "src/common/mac/file_id.cc",
+ "src/common/mac/file_id.h",
+ "src/common/mac/macho_id.cc",
+ "src/common/mac/macho_id.h",
+ "src/common/mac/macho_utilities.cc",
+ "src/common/mac/macho_utilities.h",
+ "src/common/mac/macho_walker.cc",
+ "src/common/mac/macho_walker.h",
+ "src/common/mac/string_utilities.cc",
+ "src/common/mac/string_utilities.h",
+ "src/common/md5.cc",
+ "src/common/md5.h",
+ "src/common/simple_string_dictionary.cc",
+ "src/common/simple_string_dictionary.h",
+ "src/common/string_conversion.cc",
+ "src/common/string_conversion.h",
+ "src/google_breakpad/common/minidump_format.h",
+ ]
+ set_sources_assignment_filter(sources_assignment_filter)
+
+ include_dirs = [
+ "src",
+ "src/client/mac/Framework",
+ "src/common/mac",
+ ]
+
+ deps = [
+ "//third_party/google_toolbox_for_mac",
+ ]
+
+ public_configs = [ ":client_config" ]
+
+ if (is_clang) {
+ # See https://bugs.chromium.org/p/google-breakpad/issues/detail?id=675.
+ cflags = [ "-Wno-deprecated-declarations" ]
+ }
+ }
+ # TODO(GYP) There is some XCode-only targets like ninja-breakpad.
+}
+
+if (is_win) {
+ group("client") {
+ public_configs = [ ":client_config" ]
+ }
+
+ config("breakpad_handler_warnings") {
+ if (is_clang) {
+ # See https://code.google.com/p/google-breakpad/issues/detail?id=658.
+ cflags = [ "-Wno-reorder" ]
+ }
+ }
+
+ static_library("breakpad_handler") {
+ configs += [ ":handler_config" ]
+ if (is_win) {
+ public_configs = [ ":handler_config" ]
+ }
+
+ defines = [ "BREAKPAD_NO_TERMINATE_THREAD" ]
+
+ sources = [
+ "src/client/windows/crash_generation/client_info.cc",
+ "src/client/windows/crash_generation/client_info.h",
+ "src/client/windows/crash_generation/crash_generation_client.cc",
+ "src/client/windows/crash_generation/crash_generation_client.h",
+ "src/client/windows/crash_generation/crash_generation_server.cc",
+ "src/client/windows/crash_generation/crash_generation_server.h",
+ "src/client/windows/crash_generation/minidump_generator.cc",
+ "src/client/windows/crash_generation/minidump_generator.h",
+ "src/client/windows/handler/exception_handler.cc",
+ "src/client/windows/handler/exception_handler.h",
+ "src/common/windows/guid_string.cc",
+ "src/common/windows/guid_string.h",
+ "src/common/windows/string_utils-inl.h",
+ "src/google_breakpad/common/minidump_format.h",
+ ]
+ configs += [ ":breakpad_handler_warnings" ]
+ }
+
+ source_set("breakpad_sender") {
+ sources = [
+ "src/client/windows/sender/crash_report_sender.cc",
+ "src/client/windows/sender/crash_report_sender.h",
+ "src/common/windows/http_upload.cc",
+ "src/common/windows/http_upload.h",
+ ]
+ configs += [ ":sender_config" ]
+ public_configs = [ ":sender_config" ]
+ }
+}
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..2a66be3
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,88 @@
+Copyright (c) 2006, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 1996 - 2011, Daniel Stenberg, <daniel@haxx.se>.
+
+All rights reserved.
+
+Permission to use, copy, modify, and distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright
+notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
+NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization of the copyright holder.
+
+
+Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+
+@APPLE_LICENSE_HEADER_START@
+
+This file contains Original Code and/or Modifications of Original Code
+as defined in and that are subject to the Apple Public Source License
+Version 2.0 (the 'License'). You may not use this file except in
+compliance with the License. Please obtain a copy of the License at
+http://www.opensource.apple.com/apsl/ and read it before using this
+file.
+
+The Original Code and all software distributed under the License are
+distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+Please see the License for the specific language governing rights and
+limitations under the License.
+
+@APPLE_LICENSE_HEADER_END@
+
+
+Copyright 2007-2008 Google Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy
+of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..c70e545
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,5 @@
+mark@chromium.org
+thestig@chromium.org
+
+# TEAM: google-breakpad-dev@googlegroups.com
+# COMPONENT: Internals>CrashReporting
diff --git a/README.chromium b/README.chromium
new file mode 100644
index 0000000..bab0a12
--- /dev/null
+++ b/README.chromium
@@ -0,0 +1,12 @@
+Name: Breakpad, An open-source multi-platform crash reporting system
+Short Name: breakpad
+URL: https://chromium.googlesource.com/breakpad/breakpad
+License: New BSD, Apple PSL 2.0 and Apache 2.0
+Security Critical: no
+
+This directory contains Chrome's version of Breakpad's Visual Studio build
+files (*.vcproj) and a compiled version of Breakpad's symupload.exe utility
+for Windows.
+
+Part of the upstream Breakpad project is pulled into the src/ subdirectory via
+DEPS.
diff --git a/linux/breakpad_googletest_includes.h b/linux/breakpad_googletest_includes.h
new file mode 100644
index 0000000..aeab315
--- /dev/null
+++ b/linux/breakpad_googletest_includes.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2009, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef BREAKPAD_GOOGLETEST_INCLUDES_H__
+#define BREAKPAD_GOOGLETEST_INCLUDES_H__
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+#endif // BREAKPAD_GOOGLETEST_INCLUDES_H__
diff --git a/linux/generate-test-dump.cc b/linux/generate-test-dump.cc
new file mode 100644
index 0000000..b0dca00
--- /dev/null
+++ b/linux/generate-test-dump.cc
@@ -0,0 +1,67 @@
+// Copyright (c) 2009, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// This code exists to generate minidump files for testing.
+
+#include <stdlib.h>
+
+#include <unistd.h>
+
+#include "breakpad/src/client/linux/handler/exception_handler.h"
+#include "breakpad/src/common/linux/linux_libc_support.h"
+#include "third_party/lss/linux_syscall_support.h"
+
+static bool DumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
+ void* context, bool success) {
+ if (!success) {
+ static const char msg[] = "Failed to write minidump\n";
+ sys_write(2, msg, sizeof(msg) - 1);
+ return false;
+ }
+
+ static const char msg[] = "Wrote minidump: ";
+ sys_write(2, msg, sizeof(msg) - 1);
+ sys_write(2, descriptor.path(), strlen(descriptor.path()));
+ sys_write(2, "\n", 1);
+
+ return true;
+}
+
+static void DoSomethingWhichCrashes() {
+ int local_var = 1;
+ *reinterpret_cast<volatile char*>(NULL) = 1;
+}
+
+int main() {
+ google_breakpad::MinidumpDescriptor minidump(".");
+ google_breakpad::ExceptionHandler breakpad(minidump, NULL, DumpCallback, NULL,
+ true, -1);
+ DoSomethingWhichCrashes();
+ return 0;
+}
diff --git a/minidump_fuzzer.cc b/minidump_fuzzer.cc
new file mode 100644
index 0000000..8af4532
--- /dev/null
+++ b/minidump_fuzzer.cc
@@ -0,0 +1,88 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include <streambuf>
+#include <istream>
+#include <memory>
+
+#include "base/memory/free_deleter.h"
+#include "google_breakpad/processor/basic_source_line_resolver.h"
+#include "google_breakpad/processor/minidump.h"
+#include "google_breakpad/processor/minidump_processor.h"
+#include "google_breakpad/processor/process_state.h"
+#include "processor/logging.h"
+#include "processor/simple_symbol_supplier.h"
+#include "processor/stackwalk_common.h"
+
+namespace {
+
+using google_breakpad::BasicSourceLineResolver;
+using google_breakpad::Minidump;
+using google_breakpad::MinidumpProcessor;
+using google_breakpad::ProcessState;
+using google_breakpad::SimpleSymbolSupplier;
+
+struct membuf : std::streambuf {
+ membuf(char* begin, char* end) { setg(begin, begin, end); }
+
+ protected:
+ virtual pos_type seekoff(off_type off,
+ std::ios_base::seekdir dir,
+ std::ios_base::openmode which = std::ios_base::in) {
+ if (dir == std::ios_base::cur)
+ gbump(off);
+ return gptr() - eback();
+ }
+};
+
+bool PrintMinidumpProcess(const uint8_t* data,
+ size_t size,
+ const std::vector<string>& symbol_paths) {
+ std::unique_ptr<SimpleSymbolSupplier> symbol_supplier;
+ char* ptr = static_cast<char*>(malloc(size));
+ if (!ptr)
+ return false;
+
+ std::unique_ptr<char, base::FreeDeleter> buffer(ptr);
+ memcpy(buffer.get(), data, size);
+
+ membuf sbuf(buffer.get(), buffer.get() + size);
+ std::istream input(&sbuf);
+
+ if (!symbol_paths.empty()) {
+ symbol_supplier.reset(new SimpleSymbolSupplier(symbol_paths));
+ }
+
+ BasicSourceLineResolver resolver;
+ MinidumpProcessor minidump_processor(symbol_supplier.get(), &resolver);
+
+ // Process the minidump.
+ Minidump dump(input);
+ if (!dump.Read()) {
+ BPLOG(ERROR) << "Minidump " << dump.path() << " could not be read";
+ return false;
+ }
+ ProcessState process_state;
+ if (minidump_processor.Process(&dump, &process_state) !=
+ google_breakpad::PROCESS_OK) {
+ BPLOG(ERROR) << "MinidumpProcessor::Process failed";
+ return false;
+ }
+
+ PrintProcessStateMachineReadable(process_state);
+
+ return true;
+}
+
+} // namespace
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ // TODO(wfh): Somehow pull symbols in.
+ PrintMinidumpProcess(data, size, std::vector<string>());
+ return 0;
+}
diff --git a/minidump_fuzzer.dict b/minidump_fuzzer.dict
new file mode 100644
index 0000000..ecd94eb
--- /dev/null
+++ b/minidump_fuzzer.dict
@@ -0,0 +1,2 @@
+minidump_sig="PMDM"
+minidump_ver="\x93\xa7"
diff --git a/symupload.exe b/symupload.exe
new file mode 100755
index 0000000..7e0e9fb
--- /dev/null
+++ b/symupload.exe
Binary files differ
diff --git a/using_breakpad.vsprops b/using_breakpad.vsprops
new file mode 100644
index 0000000..7d7ab92
--- /dev/null
+++ b/using_breakpad.vsprops
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="using_breakpad"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""$(SolutionDir)..\breakpad\src""
+ />
+</VisualStudioPropertySheet>