Added Breakpad crash dump generation

Fixed compiling on Windows

Make crash dump printing work better on Windows

Tweaked Breakpad build

Fixed Breakpad build for Godot 4

Switched to WINDOWS_ENABLED

Removed some non buildable files listed in the files to build

Ran clang format

Fixed the other formatting issues detected by CI

Removed a comment and added clarifying comment on crash dump message

as to why it is printed twice on Windows

Make an ugly string conversion to make Windows build work

Tweaked the build configuration and formatted again

removed lss

Add lss properly

Reinitialize breakpad after mono initialization on Linux

otherwise the breakpad signal handlers are not active

Disable Windows crash handler on destruction similarly to Linux

Renamed breakpad_enabled to use_breakpad

Forgot to wrap one piece of code inside ifdef USE_BREAKPAD

Updated copyright years in the added files

Fix register types for breakpad

Fixed dir access

Removed musl and elf_reader

which was the only thing seemingly depending on it

Updated header guards

Removed the memdelete call
This commit is contained in:
Ed Lu
2024-06-04 16:12:38 -07:00
committed by Álex Román Núñez
parent 19bf37b61a
commit 684f2d39c7
290 changed files with 75910 additions and 4 deletions
+3
View File
@@ -262,6 +262,9 @@ bld/
!thirdparty/**/arm/
!thirdparty/**/arm64/
# Do not ignore breakpad source files
!thirdparty/breakpad/src/client/linux/log
# Visual Studio 2015/2017 cache/options directory
.vs/
+5
View File
@@ -174,6 +174,11 @@ Comment: Basis Universal
Copyright: 2022, Binomial LLC.
License: Apache-2.0
Files: ./thirdparty/breakpad/
Comment: Breakpad is a set of client and server components which implement a crash-reporting system.
Copyright: 2006, Google Inc.
License: BSD-3-clause
Files: ./thirdparty/brotli/
Comment: Brotli
Copyright: 2009, 2010, 2013-2016 by the Brotli Authors.
+4
View File
@@ -230,6 +230,7 @@ opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loade
opts.Add(BoolVariable("disable_exceptions", "Force disabling exception handling code", True))
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
opts.Add(BoolVariable("use_breakpad", "Enable Breakpad crash dump creation.", False))
# Advanced options
opts.Add(
@@ -540,6 +541,9 @@ if not env["deprecated"]:
if env["precision"] == "double":
env.Append(CPPDEFINES=["REAL_T_IS_DOUBLE"])
if env["use_breakpad"]:
env.Append(CPPDEFINES=["USE_BREAKPAD"])
tmppath = "./platform/" + env["platform"]
sys.path.insert(0, tmppath)
import detect
+8
View File
@@ -134,6 +134,10 @@
#endif // TOOLS_ENABLED && !GDSCRIPT_NO_LSP
#endif // MODULE_GDSCRIPT_ENABLED
#ifdef USE_BREAKPAD
#include "modules/breakpad/breakpad.h"
#endif
/* Static members */
// Singletons
@@ -1880,6 +1884,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
ResourceUID::get_singleton()->load_from_cache(true); // load UUIDs from cache.
#ifdef USE_BREAKPAD
report_user_data_dir_usable();
#endif
if (ProjectSettings::get_singleton()->has_custom_feature("dedicated_server")) {
audio_driver = NULL_AUDIO_DRIVER;
display_driver = NULL_DISPLAY_DRIVER;
+187
View File
@@ -0,0 +1,187 @@
#!/usr/bin/env python
Import("env")
Import("env_modules")
env_breakpad = env_modules.Clone()
# Thirdparty source files
thirdparty_obj = []
thirdparty_dir = "#thirdparty/breakpad/"
# TODO: find out when these are needed (if at all)
dwarf_module = False
stabs_module = False
# Parts of this build script is based on the previous PR trying to implement this
# https://github.com/godotengine/godot/pull/22778/files
env_breakpad.Append(
CPPDEFINES=[
"PUBLIC",
"_HAS_EXCEPTIONS=0",
"_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS",
]
)
breakpad_src = [
"src/common/convert_UTF.cc",
"src/common/md5.cc",
"src/common/string_conversion.cc",
]
if env["platform"] == "linuxbsd":
breakpad_src += [
"src/client/linux/crash_generation/crash_generation_client.cc",
"src/client/linux/crash_generation/crash_generation_server.cc",
"src/client/linux/dump_writer_common/thread_info.cc",
"src/client/linux/dump_writer_common/ucontext_reader.cc",
"src/client/linux/handler/exception_handler.cc",
"src/client/linux/handler/minidump_descriptor.cc",
"src/client/linux/log/log.cc",
"src/client/linux/microdump_writer/microdump_writer.cc",
"src/client/linux/minidump_writer/pe_file.cc",
"src/client/linux/minidump_writer/linux_core_dumper.cc",
"src/client/linux/minidump_writer/linux_dumper.cc",
"src/client/linux/minidump_writer/linux_ptrace_dumper.cc",
"src/client/linux/minidump_writer/minidump_writer.cc",
"src/client/minidump_file_writer.cc",
"src/common/language.cc",
"src/common/linux/breakpad_getcontext.S",
"src/common/linux/crc32.cc",
"src/common/linux/elf_core_dump.cc",
"src/common/linux/elf_symbols_to_module.cc",
"src/common/linux/elfutils.cc",
"src/common/linux/file_id.cc",
"src/common/linux/guid_creator.cc",
"src/common/linux/linux_libc_support.cc",
"src/common/linux/memory_mapped_file.cc",
"src/common/linux/safe_readlink.cc",
"src/common/path_helper.cc",
]
if env["platform"] == "windows":
env_breakpad.Append(
CPPDEFINES=[
"_CRT_SECURE_NO_WARNINGS",
"NOMINMAX",
"WIN32_LEAN_AND_MEAN",
"_UNICODE",
"UNICODE",
]
)
breakpad_src += [
"src/client/windows/crash_generation/client_info.cc",
"src/client/windows/crash_generation/crash_generation_client.cc",
"src/client/windows/crash_generation/crash_generation_server.cc",
"src/client/windows/crash_generation/minidump_generator.cc",
"src/client/windows/handler/exception_handler.cc",
"src/common/windows/guid_string.cc",
"src/common/windows/pe_source_line_writer.cc",
"src/common/windows/string_utils.cc",
]
if env["platform"] == "osx" or env["platform"] == "iphone":
breakpad_src += [
"src/common/simple_string_dictionary.cc",
]
if env["platform"] == "osx":
breakpad_src += [
"src/client/mac/Framework/Breakpad.mm",
"src/client/mac/Framework/OnDemandServer.mm",
"src/client/mac/crash_generation/ConfigFile.mm",
"src/client/mac/crash_generation/Inspector.mm",
"src/client/mac/crash_generation/InspectorMain.mm",
"src/client/mac/crash_generation/crash_generation_client.cc",
"src/client/mac/crash_generation/crash_generation_server.cc",
"src/client/mac/handler/breakpad_nlist_64.cc",
"src/client/mac/handler/dynamic_images.cc",
"src/client/mac/handler/exception_handler.cc",
"src/client/mac/handler/minidump_generator.cc",
"src/client/mac/handler/protected_memory_allocator.cc",
"src/common/mac/GTMLogger.m",
"src/common/mac/HTTPGetRequest.m",
"src/common/mac/HTTPPutRequest.m",
"src/common/mac/HTTPRequest.m",
"src/common/mac/HTTPSimplePostRequest.m",
"src/common/mac/MachIPC.mm",
"src/common/mac/arch_utilities.cc",
"src/common/mac/bootstrap_compat.cc",
"src/common/mac/encoding_util.m",
"src/common/mac/file_id.cc",
"src/common/mac/launch_reporter.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/mac/string_utilities.cc",
]
if env["platform"] == "iphone":
breakpad_src += [
"src/client/ios/Breakpad.mm",
"src/client/ios/BreakpadController.mm",
"src/client/ios/exception_handler_no_mach.cc",
"src/client/ios/handler/ios_exception_minidump_generator.mm",
"src/common/long_string_dictionary.cc",
]
# if solaris:
# breakpad_src += [
# "src/client/solaris/handler/Makefile",
# "src/client/solaris/handler/exception_handler.cc",
# "src/client/solaris/handler/minidump_generator.cc",
# "src/client/solaris/handler/solaris_lwp.cc",
# "src/common/solaris/file_id.cc",
# "src/common/solaris/guid_creator.cc",
# ]
if dwarf_module:
breakpad_src += [
"src/common/dwarf/bytereader.cc",
"src/common/dwarf/cfi_assembler.cc",
"src/common/dwarf/dwarf2diehandler.cc",
"src/common/dwarf/dwarf2reader.cc",
"src/common/dwarf/elf_reader.cc",
"src/common/dwarf/functioninfo.cc",
"src/common/dwarf_cfi_to_module.cc",
"src/common/dwarf_cu_to_module.cc",
"src/common/dwarf_line_to_module.cc",
"src/common/dwarf_range_list_handler.cc",
"src/common/module.cc",
]
if stabs_module:
breakpad_src += [
"src/common/stabs_reader.cc",
"src/common/stabs_to_module.cc",
]
breakpad_src = [thirdparty_dir + file for file in breakpad_src]
env_breakpad.Prepend(CPPPATH=[thirdparty_dir + "src"])
env_thirdparty = env_breakpad.Clone()
env_thirdparty.disable_warnings()
env_thirdparty.add_source_files(thirdparty_obj, breakpad_src)
env.modules_sources += thirdparty_obj
# Godot source files
module_obj = []
if env["platform"] == "linuxbsd" or env["platform"] == "windows":
env_breakpad.add_source_files(module_obj, ["breakpad_linuxbsd_windows.cpp"])
else:
raise Exception("Breakpad not implemented for selected platform")
env.modules_sources += module_obj
# Needed to force rebuilding the module files when the thirdparty library is updated.
env.Depends(module_obj, thirdparty_obj)
+48
View File
@@ -0,0 +1,48 @@
/**************************************************************************/
/* breakpad.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* 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. */
/* 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. */
/**************************************************************************/
#ifndef BREAKPAD_H
#define BREAKPAD_H
void initialize_breakpad(bool register_handlers);
void disable_breakpad();
void report_user_data_dir_usable();
// Due to Mono runtime initialization in release mode overriding signal handlers, Breakpad needs re-initialization after loading it
void report_mono_loaded_to_breakpad();
// Linux crash handling goes through this
void breakpad_handle_signal(int sig);
// Windows crash handling goes through this
// TODO: should Windows header be included here to use an actual type?
void breakpad_handle_exception_pointers(void *exinfo);
#endif // BREAKPAD_H
@@ -0,0 +1,151 @@
/**************************************************************************/
/* breakpad_linuxbsd_windows.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* 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. */
/* 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. */
/**************************************************************************/
#include "breakpad.h"
#include "core/io/dir_access.h"
#include "core/os/os.h"
#ifdef WINDOWS_ENABLED
#include <thirdparty/breakpad/src/client/windows/handler/exception_handler.h>
#include <thirdparty/breakpad/src/google_breakpad/common/minidump_format.h>
#else
#include <thirdparty/breakpad/src/client/linux/handler/exception_handler.h>
#endif
static google_breakpad::ExceptionHandler *breakpad_handler = nullptr;
static bool register_breakpad_handlers;
#ifdef WINDOWS_ENABLED
static bool dump_callback(const wchar_t *dump_path, const wchar_t *minidump_id, void *context,
EXCEPTION_POINTERS *exinfo, MDRawAssertionInfo *assertion, bool succeeded) {
wprintf(L"Crash dump created at: %s/%s.dmp\n", dump_path, minidump_id);
// This, kind of duplicate print, is here as in the default Godot console window the dump created message is otherwise not visible
fwprintf(stderr, L"Crash dump created at: %s/%s.dmp\n", dump_path, minidump_id);
#else
static bool dump_callback(const google_breakpad::MinidumpDescriptor &descriptor, void *context, bool succeeded) {
printf("Crash dump created at: %s\n", descriptor.path());
#endif
return succeeded;
}
static void create_breakpad_handler(const String &crash_folder) {
#ifdef WINDOWS_ENABLED
// Automatic register to the exception handlers can be disabled when Godot crash handler listens to them
std::wstring crash_folder_w(reinterpret_cast<const wchar_t *>(crash_folder.utf16().get_data()));
breakpad_handler = new google_breakpad::ExceptionHandler(crash_folder_w, nullptr, dump_callback, nullptr,
register_breakpad_handlers ? google_breakpad::ExceptionHandler::HANDLER_ALL : google_breakpad::ExceptionHandler::HANDLER_NONE);
#else
google_breakpad::MinidumpDescriptor descriptor(crash_folder.utf8().get_data());
breakpad_handler = new google_breakpad::ExceptionHandler(descriptor, nullptr, dump_callback, nullptr, register_breakpad_handlers, -1);
#endif
}
static String get_settings_specific_crash_folder() {
String crash_folder = OS::get_singleton()->get_user_data_dir() + "/crashes";
Ref<DirAccess> dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (!dir->dir_exists(crash_folder)) {
dir->make_dir_recursive(crash_folder);
}
return crash_folder;
}
void initialize_breakpad(bool register_handlers) {
if (breakpad_handler != nullptr) {
return;
}
register_breakpad_handlers = register_handlers;
#ifdef WINDOWS_ENABLED
String crash_folder;
wchar_t tempPath[MAX_PATH + 1];
if (GetTempPathW(MAX_PATH + 1, tempPath) > 0) {
crash_folder = tempPath;
} else {
crash_folder = L"C:/temp";
}
create_breakpad_handler(crash_folder);
#else
create_breakpad_handler("/tmp");
#endif
}
void disable_breakpad() {
if (breakpad_handler == nullptr)
return;
delete breakpad_handler;
breakpad_handler = nullptr;
}
void report_user_data_dir_usable() {
if (breakpad_handler == nullptr)
return;
const String &crash_folder = get_settings_specific_crash_folder();
#ifdef WINDOWS_ENABLED
breakpad_handler->set_dump_path(reinterpret_cast<const wchar_t *>(crash_folder.utf16().get_data()));
#else
google_breakpad::MinidumpDescriptor descriptor(crash_folder.utf8().get_data());
breakpad_handler->set_minidump_descriptor(descriptor);
#endif
}
void breakpad_handle_signal(int signal) {
if (breakpad_handler == nullptr)
return;
#ifndef WINDOWS_ENABLED
// TODO: Should this use HandleSignal(int sig, siginfo_t* info, void* uc) instead?
// would require changing to sigaction in crash_handler_x11.cpp
breakpad_handler->SimulateSignalDelivery(signal);
#endif
}
void breakpad_handle_exception_pointers(void *exinfo) {
if (breakpad_handler == nullptr)
return;
#ifdef WINDOWS_ENABLED
breakpad_handler->WriteMinidumpForException(static_cast<EXCEPTION_POINTERS *>(exinfo));
#endif
}
+6
View File
@@ -0,0 +1,6 @@
def can_build(env, platform):
return env["use_breakpad"]
def configure(env):
pass
+43
View File
@@ -0,0 +1,43 @@
/**************************************************************************/
/* register_types.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* 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. */
/* 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. */
/**************************************************************************/
#ifndef BREAKPAD_REGISTER_TYPES_H
#define BREAKPAD_REGISTER_TYPES_H
/**
@author Henri Hyyryläinen
*/
#include "modules/register_module_types.h"
inline void initialize_breakpad_module(ModuleInitializationLevel p_level) {}
inline void uninitialize_breakpad_module(ModuleInitializationLevel p_level) {}
#endif // BREAKPAD_REGISTER_TYPES_H
+4
View File
@@ -68,6 +68,10 @@
#include <stdint.h>
#ifdef USE_BREAKPAD
#include "modules/breakpad/breakpad.h"
#endif
// Types that will be skipped over (in favor of their base types) when setting up instance bindings.
// This must be a superset of `ignored_types` in bindings_generator.cpp.
const Vector<String> ignored_types = {};
@@ -40,6 +40,10 @@
#undef CRASH_HANDLER_ENABLED
#endif
#ifdef USE_BREAKPAD
#include "modules/breakpad/breakpad.h"
#endif
#ifdef CRASH_HANDLER_ENABLED
#include <cxxabi.h>
#include <dlfcn.h>
@@ -49,6 +53,10 @@
#include <stdlib.h>
static void handle_crash(int sig) {
#ifdef USE_BREAKPAD
breakpad_handle_signal(sig);
#endif
signal(SIGSEGV, SIG_DFL);
signal(SIGFPE, SIG_DFL);
signal(SIGILL, SIG_DFL);
@@ -165,6 +173,10 @@ void CrashHandler::disable() {
signal(SIGILL, SIG_DFL);
#endif
#ifdef USE_BREAKPAD
disable_breakpad();
#endif
disabled = true;
}
@@ -173,5 +185,12 @@ void CrashHandler::initialize() {
signal(SIGSEGV, handle_crash);
signal(SIGFPE, handle_crash);
signal(SIGILL, handle_crash);
#ifdef USE_BREAKPAD
initialize_breakpad(false);
#endif
#elif defined(USE_BREAKPAD)
initialize_breakpad(true);
#endif
}
+1 -4
View File
@@ -26,10 +26,7 @@ common_win = [
"rendering_context_driver_vulkan_windows.cpp",
]
if env.msvc:
common_win += ["crash_handler_windows_seh.cpp"]
else:
common_win += ["crash_handler_windows_signal.cpp"]
common_win += ["crash_handler_windows_seh.cpp"]
common_win_wrap = [
"console_wrapper_windows.cpp",
@@ -36,6 +36,10 @@
#include "core/version.h"
#include "main/main.h"
#ifdef USE_BREAKPAD
#include "modules/breakpad/breakpad.h"
#endif
#ifdef CRASH_HANDLER_EXCEPTION
// Backtrace code based on: https://stackoverflow.com/questions/6205981/windows-c-stack-trace-from-a-running-app
@@ -115,6 +119,10 @@ public:
};
DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
#ifdef USE_BREAKPAD
breakpad_handle_exception_pointers(static_cast<void *>(ep));
#endif
HANDLE process = GetCurrentProcess();
HANDLE hThread = GetCurrentThread();
DWORD offset_from_symbol = 0;
@@ -235,6 +243,7 @@ CrashHandler::CrashHandler() {
}
CrashHandler::~CrashHandler() {
disable();
}
void CrashHandler::disable() {
@@ -242,8 +251,21 @@ void CrashHandler::disable() {
return;
}
#ifdef USE_BREAKPAD
disable_breakpad();
#endif
disabled = true;
}
void CrashHandler::initialize() {
#ifdef CRASH_HANDLER_EXCEPTION
#ifdef USE_BREAKPAD
initialize_breakpad(false);
#endif
#elif defined(USE_BREAKPAD)
initialize_breakpad(true);
#endif
}
+20
View File
@@ -83,6 +83,26 @@ Files extracted from upstream source:
- `LICENSE.md`
## breakpad
- Upstream: https://chromium.googlesource.com/breakpad/breakpad/
- Version: git (527331a471207d28d015e210c12fb8bb8b6732fd, 2024)
- License: BSD-3-Clause (main), others
Files extracted from upstream source:
- `src/client` except `.gyp`, upload and test related files
- `src/common` except `.gyp`, upload and test related files
- `src/third_party/lss/LICENSE`
- `src/third_party/lss/linux_syscall_support.h`
- `src/google_breakpad/common`
- `LICENSE`
This only contains the crash report generating required files. No files
related to processing debug symbols, uploading, or receiving crash
reports are included.
## brotli
- Upstream: https://github.com/google/brotli
+132
View File
@@ -0,0 +1,132 @@
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 2001-2004 Unicode, Inc.
Disclaimer
This source code is provided as is by Unicode, Inc. No claims are
made as to fitness for any particular purpose. No warranties of any
kind are expressed or implied. The recipient agrees to determine
applicability of information provided. If this file has been
purchased on magnetic or optical media from Unicode, Inc., the
sole remedy for any claim will be exchange of defective media
within 90 days of receipt.
Limitations on Rights to Redistribute This Code
Unicode, Inc. hereby grants the right to freely use the information
supplied in this file in the creation of products supporting the
Unicode Standard, and to make copies of this file in any form
for internal or external distribution as long as this notice
remains attached.
--------------------------------------------------------------------
libunwind - a platform-independent unwind library
Copyright (C) 2008 Google, Inc
Contributed by Paul Pluzhnikov <ppluzhnikov@google.com>
Copyright (C) 2010 Konstantin Belousov <kib@freebsd.org>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
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. 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. */
--------------------------------------------------------------------
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 (c) 1989, 1993
The Regents of the University of California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. 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.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by the University of
California, Berkeley and its contributors.
4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
@@ -0,0 +1,72 @@
// Copyright 2011 Google LLC
//
// 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 LLC 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.
// Keys for configuration file
#define kReporterMinidumpDirectoryKey "MinidumpDir"
#define kReporterMinidumpIDKey "MinidumpID"
// Filename for recording uploaded IDs
#define kReporterLogFilename "uploads.log"
// The default subdirectory of the Library to put crash dumps in
// The subdirectory is
// ~/Library/<kDefaultLibrarySubdirectory>/<GoogleBreakpadProduct>
#define kDefaultLibrarySubdirectory "Breakpad"
// Specify some special keys to be used in the configuration file that is
// generated by Breakpad and consumed by the crash_sender.
#define BREAKPAD_PRODUCT "BreakpadProduct"
#define BREAKPAD_PRODUCT_DISPLAY "BreakpadProductDisplay"
#define BREAKPAD_VERSION "BreakpadVersion"
#define BREAKPAD_VENDOR "BreakpadVendor"
#define BREAKPAD_URL "BreakpadURL"
#define BREAKPAD_REPORT_INTERVAL "BreakpadReportInterval"
#define BREAKPAD_SKIP_CONFIRM "BreakpadSkipConfirm"
#define BREAKPAD_CONFIRM_TIMEOUT "BreakpadConfirmTimeout"
#define BREAKPAD_SEND_AND_EXIT "BreakpadSendAndExit"
#define BREAKPAD_DUMP_DIRECTORY "BreakpadMinidumpLocation"
#define BREAKPAD_INSPECTOR_LOCATION "BreakpadInspectorLocation"
#define BREAKPAD_REPORTER_EXE_LOCATION \
"BreakpadReporterExeLocation"
#define BREAKPAD_LOGFILES "BreakpadLogFiles"
#define BREAKPAD_LOGFILE_UPLOAD_SIZE "BreakpadLogFileTailSize"
#define BREAKPAD_REQUEST_COMMENTS "BreakpadRequestComments"
#define BREAKPAD_COMMENTS "BreakpadComments"
#define BREAKPAD_REQUEST_EMAIL "BreakpadRequestEmail"
#define BREAKPAD_EMAIL "BreakpadEmail"
#define BREAKPAD_SERVER_TYPE "BreakpadServerType"
#define BREAKPAD_SERVER_PARAMETER_DICT "BreakpadServerParameters"
#define BREAKPAD_IN_PROCESS "BreakpadInProcess"
// The keys below are NOT user supplied, and are used internally.
#define BREAKPAD_PROCESS_START_TIME "BreakpadProcStartTime"
#define BREAKPAD_PROCESS_UP_TIME "BreakpadProcessUpTime"
#define BREAKPAD_PROCESS_CRASH_TIME "BreakpadProcessCrashTime"
#define BREAKPAD_LOGFILE_KEY_PREFIX "BreakpadAppLogFile"
#define BREAKPAD_SERVER_PARAMETER_PREFIX "BreakpadServerParameterPrefix_"
#define BREAKPAD_ON_DEMAND "BreakpadOnDemand"
+259
View File
@@ -0,0 +1,259 @@
// Copyright 2011 Google LLC
//
// 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 LLC 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.
// Framework to provide a simple C API to crash reporting for
// applications. By default, if any machine-level exception (e.g.,
// EXC_BAD_ACCESS) occurs, it will be handled by the BreakpadRef
// object as follows:
//
// 1. Create a minidump file (see Breakpad for details)
// 2. Create a config file.
//
// These files can then be uploaded to a server.
typedef void* BreakpadRef;
#ifdef __cplusplus
extern "C" {
#endif
#include <Foundation/Foundation.h>
#include <client/apple/Framework/BreakpadDefines.h>
// The keys in the dictionary returned by |BreakpadGenerateReport|.
#define BREAKPAD_OUTPUT_DUMP_FILE "BreakpadDumpFile"
#define BREAKPAD_OUTPUT_CONFIG_FILE "BreakpadConfigFile"
// Optional user-defined function to decide if we should handle this crash or
// forward it along.
// Return true if you want Breakpad to handle it.
// Return false if you want Breakpad to skip it
// The exception handler always returns false, as if SEND_AND_EXIT were false
// (which means the next exception handler will take the exception)
typedef bool (*BreakpadFilterCallback)(int exception_type,
int exception_code,
mach_port_t crashing_thread,
void* context);
// Optional user-defined function that will be called after a network upload
// of a crash report.
// |report_id| will be the id returned by the server, or "ERR" if an error
// occurred.
// |error| will contain the error, or nil if no error occured.
typedef void (*BreakpadUploadCompletionCallback)(NSString* report_id,
NSError* error);
// Create a new BreakpadRef object and install it as an exception
// handler. The |parameters| will typically be the contents of your
// bundle's Info.plist.
//
// You can also specify these additional keys for customizable behavior:
// Key: Value:
// BREAKPAD_PRODUCT Product name (e.g., "MyAwesomeProduct")
// This one is used as the key to identify
// the product when uploading. Falls back to
// CFBundleName if not specified.
// REQUIRED
//
// BREAKPAD_PRODUCT_DISPLAY This is the display name, e.g. a pretty
// name for the product when the crash_sender
// pops up UI for the user. Falls back first to
// CFBundleDisplayName and then to
// BREAKPAD_PRODUCT if not specified.
//
// BREAKPAD_VERSION Product version (e.g., 1.2.3), used
// as metadata for crash report. Falls back to
// CFBundleVersion if not specified.
// REQUIRED
//
// BREAKPAD_VENDOR Vendor name, used in UI (e.g. "A report has
// been created that you can send to <vendor>")
//
// BREAKPAD_URL URL destination for reporting
// REQUIRED
//
// BREAKPAD_DUMP_DIRECTORY The directory to store crash-dumps
// in. By default, we use
// ~/Library/Cache/Breakpad/<BREAKPAD_PRODUCT>
// The path you specify here is tilde-expanded.
//
// BREAKPAD_SERVER_TYPE A parameter that tells Breakpad how to
// rewrite the upload parameters for a specific
// server type. The currently valid values are
// 'socorro' or 'google'. If you want to add
// other types, see the function in
// crash_report_sender.m that maps parameters to
// URL parameters. Defaults to 'google'.
//
// BREAKPAD_SERVER_PARAMETER_DICT A plist dictionary of static
// parameters that are uploaded to the
// server. The parameters are sent as
// is to the crash server. Their
// content isn't added to the minidump
// but pass as URL parameters when
// uploading theminidump to the crash
// server.
//=============================================================================
// The BREAKPAD_PRODUCT, BREAKPAD_VERSION and BREAKPAD_URL are
// required to have non-NULL values. By default, the BREAKPAD_PRODUCT
// will be the CFBundleName and the BREAKPAD_VERSION will be the
// CFBundleVersion when these keys are present in the bundle's
// Info.plist, which is usually passed in to BreakpadCreate() as an
// NSDictionary (you could also pass in another dictionary that had
// the same keys configured). If the BREAKPAD_PRODUCT or
// BREAKPAD_VERSION are ultimately undefined, BreakpadCreate() will
// fail. You have been warned.
//
// If you are running in a debugger, Breakpad will not install, unless the
// BREAKPAD_IGNORE_DEBUGGER envionment variable is set and/or non-zero.
//
//=============================================================================
// The following are NOT user-supplied but are documented here for
// completeness. They are calculated by Breakpad during initialization &
// crash-dump generation, or entered in by the user.
//
// BREAKPAD_PROCESS_START_TIME The time, in seconds since the Epoch, the
// process started
//
// BREAKPAD_PROCESS_CRASH_TIME The time, in seconds since the Epoch, the
// process crashed.
//
// BREAKPAD_PROCESS_UP_TIME The total time in milliseconds the process
// has been running. This parameter is not
// set until the crash-dump-generation phase.
//
// BREAKPAD_SERVER_PARAMETER_PREFIX This prefix is used by Breakpad
// internally, because Breakpad uses
// the same dictionary internally to
// track both its internal
// configuration parameters and
// parameters meant to be uploaded
// to the server. This string is
// used internally by Breakpad to
// prefix user-supplied parameter
// names so those can be sent to the
// server without leaking Breakpad's
// internal values.
// Returns a new BreakpadRef object on success, NULL otherwise.
BreakpadRef BreakpadCreate(NSDictionary* parameters);
// Uninstall and release the data associated with |ref|.
void BreakpadRelease(BreakpadRef ref);
// User defined key and value string storage. Generally this is used
// to configure Breakpad's internal operation, such as whether the
// crash_sender should prompt the user, or the filesystem location for
// the minidump file. See Breakpad.h for some parameters that can be
// set. Anything longer than 255 bytes will be truncated. Note that
// the string is converted to UTF8 before truncation, so any multibyte
// character that straddles the 255(256 - 1 for terminator) byte limit
// will be mangled.
//
// A maximum number of 64 key/value pairs are supported. An assert()
// will fire if more than this number are set. Unfortunately, right
// now, the same dictionary is used for both Breakpad's parameters AND
// the Upload parameters.
//
// TODO (nealsid): Investigate how necessary this is if we don't
// automatically upload parameters to the server anymore.
// TODO (nealsid): separate server parameter dictionary from the
// dictionary used to configure Breakpad, and document limits for each
// independently.
void BreakpadSetKeyValue(BreakpadRef ref, NSString* key, NSString* value);
NSString* BreakpadKeyValue(BreakpadRef ref, NSString* key);
void BreakpadRemoveKeyValue(BreakpadRef ref, NSString* key);
// You can use this method to specify parameters that will be uploaded
// to the crash server. They will be automatically encoded as
// necessary. Note that as mentioned above there are limits on both
// the number of keys and their length.
void BreakpadAddUploadParameter(BreakpadRef ref, NSString* key,
NSString* value);
// This method will remove a previously-added parameter from the
// upload parameter set.
void BreakpadRemoveUploadParameter(BreakpadRef ref, NSString* key);
// Method to handle uploading data to the server
// Returns the number of crash reports waiting to send to the server.
int BreakpadGetCrashReportCount(BreakpadRef ref);
// Returns the next upload configuration. The report file is deleted.
NSDictionary* BreakpadGetNextReportConfiguration(BreakpadRef ref);
// Returns the date of the most recent crash report.
NSDate* BreakpadGetDateOfMostRecentCrashReport(BreakpadRef ref);
// Upload next report to the server.
void BreakpadUploadNextReport(BreakpadRef ref);
// Upload next report to the server.
// |server_parameters| is additional server parameters to send.
void BreakpadUploadNextReportWithParameters(
BreakpadRef ref,
NSDictionary* server_parameters,
BreakpadUploadCompletionCallback callback);
// Upload a report to the server.
// |server_parameters| is additional server parameters to send.
// |configuration| is the configuration of the breakpad report to send.
void BreakpadUploadReportWithParametersAndConfiguration(
BreakpadRef ref,
NSDictionary* server_parameters,
NSDictionary* configuration,
BreakpadUploadCompletionCallback callback);
// Handles the network response of a breakpad upload. This function is needed if
// the actual upload is done by the Breakpad client.
// |configuration| is the configuration of the upload. It must contain the same
// fields as the configuration passed to
// BreakpadUploadReportWithParametersAndConfiguration.
// |data| and |error| contain the network response.
void BreakpadHandleNetworkResponse(BreakpadRef ref,
NSDictionary* configuration,
NSData* data,
NSError* error);
// Upload a file to the server. |data| is the content of the file to sent.
// |server_parameters| is additional server parameters to send.
void BreakpadUploadData(BreakpadRef ref, NSData* data, NSString* name,
NSDictionary* server_parameters);
// Generate a breakpad minidump and configuration file in the dump directory.
// The report will be available for uploading. The paths of the created files
// are returned in the dictionary. |server_parameters| is additional server
// parameters to add in the config file.
NSDictionary* BreakpadGenerateReport(BreakpadRef ref,
NSDictionary* server_parameters);
#ifdef __cplusplus
}
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+153
View File
@@ -0,0 +1,153 @@
// Copyright 2012 Google LLC
//
// 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 LLC 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 CLIENT_IOS_HANDLER_IOS_BREAKPAD_CONTROLLER_H_
#define CLIENT_IOS_HANDLER_IOS_BREAKPAD_CONTROLLER_H_
#import <Foundation/Foundation.h>
#import "client/ios/Breakpad.h"
// This class is used to offer a higher level API around BreakpadRef. It
// configures it, ensures thread-safety, and sends crash reports back to the
// collecting server. By default, no crash reports are sent, the user must call
// |setUploadingEnabled:YES| to start the uploading.
@interface BreakpadController : NSObject {
@private
// The dispatch queue that will own the breakpad reference.
dispatch_queue_t queue_;
// Instance of Breakpad crash reporter. This is owned by the queue, but can
// be created on the main thread at startup.
BreakpadRef breakpadRef_;
// The dictionary that contains configuration for breakpad. Modifying it
// should only happen when the controller is not started. The initial value
// is the infoDictionary of the bundle of the application.
NSMutableDictionary* configuration_;
// Whether or not crash reports should be uploaded.
BOOL enableUploads_;
// Whether the controller has been started on the main thread. This is only
// used to assert the initialization order is correct.
BOOL started_;
// The interval to wait between two uploads. Value is 0 if no upload must be
// done.
int uploadIntervalInSeconds_;
// The dictionary that contains additional server parameters to send when
// uploading crash reports.
NSDictionary* uploadTimeParameters_;
// The callback to call on report upload completion.
BreakpadUploadCompletionCallback uploadCompleteCallback_;
}
// Singleton.
+ (BreakpadController*)sharedInstance;
// Update the controller configuration. Merges its old configuration with the
// new one. Merge is done by replacing the old values by the new values.
- (void)updateConfiguration:(NSDictionary*)configuration;
// Reset the controller configuration to its initial value, which is the
// infoDictionary of the bundle of the application.
- (void)resetConfiguration;
// Configure the URL to upload the report to. This must be called at least once
// if the URL is not in the bundle information.
- (void)setUploadingURL:(NSString*)url;
// Set the minimal interval between two uploads in seconds. This must be called
// at least once if the interval is not in the bundle information. A value of 0
// will prevent uploads.
- (void)setUploadInterval:(int)intervalInSeconds;
// Set additional server parameters to send when uploading crash reports.
- (void)setParametersToAddAtUploadTime:(NSDictionary*)uploadTimeParameters;
// Specify an upload parameter that will be added to the crash report when a
// crash report is generated. See |BreakpadAddUploadParameter|.
- (void)addUploadParameter:(NSString*)value forKey:(NSString*)key;
// Sets the callback to be called after uploading a crash report to the server.
// Only the latest callback registered will be called.
- (void)setUploadCallback:(BreakpadUploadCompletionCallback)callback;
// Remove a previously-added parameter from the upload parameter set. See
// |BreakpadRemoveUploadParameter|.
- (void)removeUploadParameterForKey:(NSString*)key;
// Access the underlying BreakpadRef. This method is asynchronous, and will be
// executed on the thread owning the BreakpadRef variable. Moreover, if the
// controller is not started, the block will be called with a NULL parameter.
- (void)withBreakpadRef:(void(^)(BreakpadRef))callback;
// Starts the BreakpadController by registering crash handlers. If
// |onCurrentThread| is YES, all setup is done on the current thread, otherwise
// it is done on a private queue.
- (void)start:(BOOL)onCurrentThread;
// Unregisters the crash handlers.
- (void)stop;
// Returns whether or not the controller is started.
- (BOOL)isStarted;
// Enables or disables uploading of crash reports, but does not stop the
// BreakpadController.
- (void)setUploadingEnabled:(BOOL)enabled;
// Check if there is currently a crash report to upload.
- (void)hasReportToUpload:(void(^)(BOOL))callback;
// Get the number of crash reports waiting to upload.
- (void)getCrashReportCount:(void(^)(int))callback;
// Get the next report to upload.
// - If upload is disabled, callback will be called with (nil, -1).
// - If a delay is to be waited before sending, callback will be called with
// (nil, n), with n (> 0) being the number of seconds to wait.
// - if no delay is needed, callback will be called with (0, configuration),
// configuration being next report to upload, or nil if none is pending.
- (void)getNextReportConfigurationOrSendDelay:
(void(^)(NSDictionary*, int))callback;
// Get the date of the most recent crash report.
- (void)getDateOfMostRecentCrashReport:(void(^)(NSDate *))callback;
// Sends synchronously the report specified by |configuration|. This method is
// NOT thread safe and must be called from the breakpad thread.
- (void)threadUnsafeSendReportWithConfiguration:(NSDictionary*)configuration
withBreakpadRef:(BreakpadRef)ref;
@end
#endif // CLIENT_IOS_HANDLER_IOS_BREAKPAD_CONTROLLER_H_

Some files were not shown because too many files have changed in this diff Show More