summaryrefslogtreecommitdiffstats
path: root/external/breakpad
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /external/breakpad
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'external/breakpad')
-rw-r--r--external/breakpad/0001-Handle-race-between-ExceptionHandler-SignalHandler-a.patch.133
-rw-r--r--external/breakpad/ExternalProject_breakpad.mk39
-rw-r--r--external/breakpad/Makefile14
-rw-r--r--external/breakpad/Module_breakpad.mk25
-rw-r--r--external/breakpad/README21
-rw-r--r--external/breakpad/SIGSTKSZ.patch11
-rw-r--r--external/breakpad/StaticLibrary_breakpad.mk37
-rw-r--r--external/breakpad/UnpackedTarball_breakpad.mk48
-rw-r--r--external/breakpad/breakpad-dump_syms.patch.134
-rw-r--r--external/breakpad/breakpad-no-env.patch.113
-rw-r--r--external/breakpad/breakpad-stackwalk.patch.132
-rw-r--r--external/breakpad/breakpad-use-correct-http-header.patch.114
-rw-r--r--external/breakpad/breakpad-wshadow.patch.165
-rw-r--r--external/breakpad/c++20-allocator.patch12
-rw-r--r--external/breakpad/dump_syms.sln25
-rw-r--r--external/breakpad/dump_syms.vcxproj108
-rw-r--r--external/breakpad/include.patch10
-rw-r--r--external/breakpad/sanitizer.patch29
-rw-r--r--external/breakpad/ubsan.patch21
19 files changed, 591 insertions, 0 deletions
diff --git a/external/breakpad/0001-Handle-race-between-ExceptionHandler-SignalHandler-a.patch.1 b/external/breakpad/0001-Handle-race-between-ExceptionHandler-SignalHandler-a.patch.1
new file mode 100644
index 000000000..00762650f
--- /dev/null
+++ b/external/breakpad/0001-Handle-race-between-ExceptionHandler-SignalHandler-a.patch.1
@@ -0,0 +1,33 @@
+From caa6f1ea462d0f0c612b871106e3e309fe0290f5 Mon Sep 17 00:00:00 2001
+From: Stephan Bergmann <sbergman@redhat.com>
+Date: Thu, 16 Aug 2018 09:04:35 +0200
+Subject: [PATCH] Handle race between ExceptionHandler::SignalHandler and
+ ~ExceptionHandler
+
+...where thread A is blocked locking g_handler_stack_mutex_ in SignalHandler
+while thread B executes ~ExceptionHandler and sets g_handler_stack to null, but
+which thread A didn't expect to be null once it acquired the lock.
+---
+ src/client/linux/handler/exception_handler.cc | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc
+index b895f6d7..4d58e510 100644
+--- a/src/client/linux/handler/exception_handler.cc
++++ b/src/client/linux/handler/exception_handler.cc
+@@ -372,8 +372,10 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
+ }
+
+ bool handled = false;
+- for (int i = g_handler_stack_->size() - 1; !handled && i >= 0; --i) {
+- handled = (*g_handler_stack_)[i]->HandleSignal(sig, info, uc);
++ if (g_handler_stack_ != NULL) {
++ for (int i = g_handler_stack_->size() - 1; !handled && i >= 0; --i) {
++ handled = (*g_handler_stack_)[i]->HandleSignal(sig, info, uc);
++ }
+ }
+
+ // Upon returning from this signal handler, sig will become unmasked and then
+--
+2.17.1
+
diff --git a/external/breakpad/ExternalProject_breakpad.mk b/external/breakpad/ExternalProject_breakpad.mk
new file mode 100644
index 000000000..a4f124a49
--- /dev/null
+++ b/external/breakpad/ExternalProject_breakpad.mk
@@ -0,0 +1,39 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,breakpad))
+
+$(eval $(call gb_ExternalProject_register_targets,breakpad,\
+ build \
+))
+
+
+ifeq ($(COM),MSC)
+
+$(call gb_ExternalProject_get_state_target,breakpad,build) :
+ $(call gb_Trace_StartRange,breakpad,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ MSBuild.exe src/tools/windows/dump_syms/dump_syms.sln -p:Configuration=Release \
+ /p:PlatformToolset=$(VCTOOLSET) /p:VisualStudioVersion=$(VCVER) /ToolsVersion:Current \
+ )
+ $(call gb_Trace_EndRange,breakpad,EXTERNAL)
+
+else # !ifeq($(COM),MSC)
+
+$(call gb_ExternalProject_get_state_target,breakpad,build) :
+ $(call gb_Trace_StartRange,breakpad,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ $(gb_RUN_CONFIGURE) ./configure CXXFLAGS="-O2 $(gb_VISIBILITY_FLAGS)" \
+ && $(MAKE) \
+ )
+ $(call gb_Trace_EndRange,breakpad,EXTERNAL)
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/breakpad/Makefile b/external/breakpad/Makefile
new file mode 100644
index 000000000..569ad8a0b
--- /dev/null
+++ b/external/breakpad/Makefile
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/breakpad/Module_breakpad.mk b/external/breakpad/Module_breakpad.mk
new file mode 100644
index 000000000..f68385ffb
--- /dev/null
+++ b/external/breakpad/Module_breakpad.mk
@@ -0,0 +1,25 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,breakpad))
+
+$(eval $(call gb_Module_add_targets,breakpad,\
+ UnpackedTarball_breakpad \
+))
+
+$(eval $(call gb_Module_add_targets,breakpad,\
+ ExternalProject_breakpad \
+))
+ifeq ($(OS),WNT)
+$(eval $(call gb_Module_add_targets,breakpad,\
+ StaticLibrary_breakpad \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/breakpad/README b/external/breakpad/README
new file mode 100644
index 000000000..dfd2bf91c
--- /dev/null
+++ b/external/breakpad/README
@@ -0,0 +1,21 @@
+Google breakpad crash-reporting library
+
+https://chromium.googlesource.com/breakpad/breakpad
+
+When this is enabled and soffice.bin crashes, a "mini-dump" file is written
+as "instdir/crash/*.dmp".
+
+There is an UI to upload the mini-dump to a TDF server but of course
+that only makes sense if the server has symbols available that match
+the build, which is not the case if you have built LO yourself.
+
+If you want to get the backtrace from local mini-dump files:
+
+* with Visual Studio:
+ 1. open the *.dmp file from the Visual Studio IDE File->Open->File
+ 2. then click "Debug Native Only"
+
+* otherwise:
+ 1. run "make symbols" to extract the debuginfo from the binaries
+ 2. run "workdir/UnpackedTarball/breakpad/src/processor/minidump_stackwalk foo.dmp workdir/symbols"
+
diff --git a/external/breakpad/SIGSTKSZ.patch b/external/breakpad/SIGSTKSZ.patch
new file mode 100644
index 000000000..d37c58a2f
--- /dev/null
+++ b/external/breakpad/SIGSTKSZ.patch
@@ -0,0 +1,11 @@
+--- src/client/linux/handler/exception_handler.cc
++++ src/client/linux/handler/exception_handler.cc
+@@ -138,7 +138,7 @@
+ // SIGSTKSZ may be too small to prevent the signal handlers from overrunning
+ // the alternative stack. Ensure that the size of the alternative stack is
+ // large enough.
+- static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ);
++ static const unsigned kSigStackSize = std::max<decltype(SIGSTKSZ)>(16384, SIGSTKSZ);
+
+ // Only set an alternative stack if there isn't already one, or if the current
+ // one is too small.
diff --git a/external/breakpad/StaticLibrary_breakpad.mk b/external/breakpad/StaticLibrary_breakpad.mk
new file mode 100644
index 000000000..fc5d3251f
--- /dev/null
+++ b/external/breakpad/StaticLibrary_breakpad.mk
@@ -0,0 +1,37 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_StaticLibrary_StaticLibrary,breakpad))
+
+$(eval $(call gb_StaticLibrary_set_warnings_disabled,breakpad))
+
+$(eval $(call gb_StaticLibrary_use_unpacked,breakpad,breakpad))
+
+$(eval $(call gb_StaticLibrary_set_include,breakpad,\
+ -I$(call gb_UnpackedTarball_get_dir,breakpad)/src \
+ -I$(call gb_UnpackedTarball_get_dir,breakpad)/src/client/windows \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_StaticLibrary_add_defs,breakpad,\
+ -DUNICODE \
+))
+
+$(eval $(call gb_StaticLibrary_set_generated_cxx_suffix,breakpad,cc))
+
+$(eval $(call gb_StaticLibrary_add_generated_exception_objects,breakpad,\
+ UnpackedTarball/breakpad/src/common/windows/guid_string \
+ UnpackedTarball/breakpad/src/client/windows/handler/exception_handler \
+ UnpackedTarball/breakpad/src/client/windows/crash_generation/client_info \
+ UnpackedTarball/breakpad/src/client/windows/crash_generation/crash_generation_client \
+ UnpackedTarball/breakpad/src/client/windows/crash_generation/crash_generation_server \
+ UnpackedTarball/breakpad/src/client/windows/crash_generation/minidump_generator \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/breakpad/UnpackedTarball_breakpad.mk b/external/breakpad/UnpackedTarball_breakpad.mk
new file mode 100644
index 000000000..eca3d550d
--- /dev/null
+++ b/external/breakpad/UnpackedTarball_breakpad.mk
@@ -0,0 +1,48 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,breakpad))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,breakpad,0))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,breakpad,$(BREAKPAD_TARBALL)))
+
+# external/breakpad/0001-Handle-race-between-ExceptionHandler-SignalHandler-a.patch upstreamed at
+# <https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1176811> "Handle race between
+# ExceptionHandler::SignalHandler and ~ExceptionHandler";
+# external/breakpad/SIGSTKSZ.patch upstreamed at
+# <https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3226470> "Adpat to SIGSTKSZ type
+# in glibc 2.34":
+$(eval $(call gb_UnpackedTarball_add_patches,breakpad,\
+ external/breakpad/breakpad-use-correct-http-header.patch.1 \
+ external/breakpad/breakpad-wshadow.patch.1 \
+ external/breakpad/breakpad-stackwalk.patch.1 \
+ external/breakpad/0001-Handle-race-between-ExceptionHandler-SignalHandler-a.patch.1 \
+ external/breakpad/c++20-allocator.patch \
+ external/breakpad/breakpad-dump_syms.patch.1 \
+ external/breakpad/breakpad-no-env.patch.1 \
+ external/breakpad/SIGSTKSZ.patch \
+ external/breakpad/sanitizer.patch \
+ external/breakpad/include.patch \
+))
+
+$(eval $(call gb_UnpackedTarball_add_files,breakpad,src/tools/windows/dump_syms,\
+ external/breakpad/dump_syms.vcxproj \
+ external/breakpad/dump_syms.sln \
+))
+
+ifeq ($(COM_IS_CLANG),TRUE)
+ifneq ($(filter -fsanitize=%,$(CC)),)
+$(eval $(call gb_UnpackedTarball_add_patches,breakpad, \
+ external/breakpad/ubsan.patch \
+))
+endif
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/breakpad/breakpad-dump_syms.patch.1 b/external/breakpad/breakpad-dump_syms.patch.1
new file mode 100644
index 000000000..d895be7ef
--- /dev/null
+++ b/external/breakpad/breakpad-dump_syms.patch.1
@@ -0,0 +1,34 @@
+diff -ur breakpad.org/src/common/windows/pdb_source_line_writer.cc breakpad/src/common/windows/pdb_source_line_writer.cc
+--- breakpad.org/src/common/windows/pdb_source_line_writer.cc 2021-06-11 12:37:22.682324700 +0200
++++ breakpad/src/common/windows/pdb_source_line_writer.cc 2021-06-11 12:44:24.480184800 +0200
+@@ -34,7 +34,7 @@
+ #include <atlbase.h>
+ #include <dia2.h>
+ #include <diacreate.h>
+-#include <ImageHlp.h>
++#include <dbghelp.h>
+ #include <stdio.h>
+
+ #include <algorithm>
+diff -ur breakpad.org/src/common/windows/pe_util.cc breakpad/src/common/windows/pe_util.cc
+--- breakpad.org/src/common/windows/pe_util.cc 2021-06-11 12:37:22.682324700 +0200
++++ breakpad/src/common/windows/pe_util.cc 2021-06-11 12:52:34.542708600 +0200
+@@ -35,6 +35,7 @@
+ #include <ImageHlp.h>
+
+ #include <functional>
++#include <memory>
+
+ #include "common/windows/string_utils-inl.h"
+ #include "common/windows/guid_string.h"
+diff -ur breakpad.org/src/tools/windows/dump_syms/dump_syms.cc breakpad/src/tools/windows/dump_syms/dump_syms.cc
+--- breakpad.org/src/tools/windows/dump_syms/dump_syms.cc 2021-06-11 12:37:20.697959400 +0200
++++ breakpad/src/tools/windows/dump_syms/dump_syms.cc 2021-06-11 12:41:16.922559700 +0200
+@@ -33,6 +33,7 @@
+ #include <stdio.h>
+ #include <wchar.h>
+
++#include <memory>
+ #include <string>
+
+ #include "common/windows/pdb_source_line_writer.h"
diff --git a/external/breakpad/breakpad-no-env.patch.1 b/external/breakpad/breakpad-no-env.patch.1
new file mode 100644
index 000000000..d1b37bd21
--- /dev/null
+++ b/external/breakpad/breakpad-no-env.patch.1
@@ -0,0 +1,13 @@
+diff -ur breakpad.org/src/client/linux/minidump_writer/minidump_writer.cc breakpad/src/client/linux/minidump_writer/minidump_writer.cc
+--- breakpad.org/src/client/linux/minidump_writer/minidump_writer.cc 2021-06-19 15:32:57.258078847 +0200
++++ breakpad/src/client/linux/minidump_writer/minidump_writer.cc 2021-06-19 15:35:07.014082452 +0200
+@@ -289,7 +289,8 @@
+ dir.CopyIndex(dir_index++, &dirent);
+
+ dirent.stream_type = MD_LINUX_ENVIRON;
+- if (!WriteProcFile(&dirent.location, GetCrashThread(), "environ"))
++ // don't include the user's env
++ if (true || !WriteProcFile(&dirent.location, GetCrashThread(), "environ"))
+ NullifyDirectoryEntry(&dirent);
+ dir.CopyIndex(dir_index++, &dirent);
+
diff --git a/external/breakpad/breakpad-stackwalk.patch.1 b/external/breakpad/breakpad-stackwalk.patch.1
new file mode 100644
index 000000000..85362b8fb
--- /dev/null
+++ b/external/breakpad/breakpad-stackwalk.patch.1
@@ -0,0 +1,32 @@
+diff -u -p -d -N -r breakpad.sav/src/processor/stackwalk_common.cc breakpad/src/processor/stackwalk_common.cc
+--- breakpad.sav/src/processor/stackwalk_common.cc 2021-04-07 19:16:35.771272332 +0200
++++ breakpad/src/processor/stackwalk_common.cc 2021-04-07 19:40:46.039940981 +0200
+@@ -750,7 +750,7 @@ static void PrintModules(
+ // one per line, in the following machine-readable pipe-delimited
+ // text format:
+ // Module|{Module Filename}|{Version}|{Debug Filename}|{Debug Identifier}|
+-// {Base Address}|{Max Address}|{Main}
++// {Base Address}|{Max Address}|{Main}|{Code Identifier}
+ static void PrintModulesMachineReadable(const CodeModules* modules) {
+ if (!modules)
+ return;
+@@ -767,7 +767,7 @@ static void PrintModulesMachineReadable(
+ ++module_sequence) {
+ const CodeModule* module = modules->GetModuleAtSequence(module_sequence);
+ uint64_t base_address = module->base_address();
+- printf("Module%c%s%c%s%c%s%c%s%c0x%08" PRIx64 "%c0x%08" PRIx64 "%c%d\n",
++ printf("Module%c%s%c%s%c%s%c%s%c0x%08" PRIx64 "%c0x%08" PRIx64 "%c%d%c%s\n",
+ kOutputSeparator,
+ StripSeparator(PathnameStripper::File(module->code_file())).c_str(),
+ kOutputSeparator, StripSeparator(module->version()).c_str(),
+@@ -778,7 +778,9 @@ static void PrintModulesMachineReadable(
+ kOutputSeparator, base_address,
+ kOutputSeparator, base_address + module->size() - 1,
+ kOutputSeparator,
+- main_module != NULL && base_address == main_address ? 1 : 0);
++ main_module != NULL && base_address == main_address ? 1 : 0,
++ kOutputSeparator,
++ StripSeparator(PathnameStripper::File(module->code_identifier())).c_str());
+ }
+ }
+
diff --git a/external/breakpad/breakpad-use-correct-http-header.patch.1 b/external/breakpad/breakpad-use-correct-http-header.patch.1
new file mode 100644
index 000000000..257d5465b
--- /dev/null
+++ b/external/breakpad/breakpad-use-correct-http-header.patch.1
@@ -0,0 +1,14 @@
+diff -ur breakpad.org/src/tools/linux/symupload/minidump_upload.cc breakpad/src/tools/linux/symupload/minidump_upload.cc
+--- breakpad.org/src/tools/linux/symupload/minidump_upload.cc 2015-11-23 17:37:53.830558138 +0100
++++ breakpad/src/tools/linux/symupload/minidump_upload.cc 2015-11-23 17:38:59.559051874 +0100
+@@ -59,8 +59,8 @@
+ static void Start(Options *options) {
+ std::map<string, string> parameters;
+ // Add parameters
+- parameters["prod"] = options->product;
+- parameters["ver"] = options->version;
++ parameters["ProductName"] = options->product;
++ parameters["Version"] = options->version;
+
+ std::map<string, string> files;
+ files["upload_file_minidump"] = options->minidumpPath;
diff --git a/external/breakpad/breakpad-wshadow.patch.1 b/external/breakpad/breakpad-wshadow.patch.1
new file mode 100644
index 000000000..87010f851
--- /dev/null
+++ b/external/breakpad/breakpad-wshadow.patch.1
@@ -0,0 +1,65 @@
+diff -u -p -d -N -r breakpad.sav/src/client/linux/handler/minidump_descriptor.h breakpad/src/client/linux/handler/minidump_descriptor.h
+--- breakpad.sav/src/client/linux/handler/minidump_descriptor.h 2021-04-07 19:12:50.329462509 +0200
++++ breakpad/src/client/linux/handler/minidump_descriptor.h 2021-04-07 19:29:58.526084027 +0200
+@@ -57,27 +57,27 @@ class MinidumpDescriptor {
+ address_within_principal_mapping_(0),
+ skip_dump_if_principal_mapping_not_referenced_(false) {}
+
+- explicit MinidumpDescriptor(const string& directory)
++ explicit MinidumpDescriptor(const string& dir)
+ : mode_(kWriteMinidumpToFile),
+ fd_(-1),
+- directory_(directory),
++ directory_(dir),
+ c_path_(NULL),
+ size_limit_(-1),
+ address_within_principal_mapping_(0),
+ skip_dump_if_principal_mapping_not_referenced_(false),
+ sanitize_stacks_(false) {
+- assert(!directory.empty());
++ assert(!dir.empty());
+ }
+
+- explicit MinidumpDescriptor(int fd)
++ explicit MinidumpDescriptor(int file_descriptor)
+ : mode_(kWriteMinidumpToFd),
+- fd_(fd),
++ fd_(file_descriptor),
+ c_path_(NULL),
+ size_limit_(-1),
+ address_within_principal_mapping_(0),
+ skip_dump_if_principal_mapping_not_referenced_(false),
+ sanitize_stacks_(false) {
+- assert(fd != -1);
++ assert(file_descriptor != -1);
+ }
+
+ explicit MinidumpDescriptor(const MicrodumpOnConsole&)
+diff -u -p -d -N -r breakpad.sav/src/client/linux/minidump_writer/linux_dumper.h breakpad/src/client/linux/minidump_writer/linux_dumper.h
+--- breakpad.sav/src/client/linux/minidump_writer/linux_dumper.h 2021-04-07 19:12:50.329462509 +0200
++++ breakpad/src/client/linux/minidump_writer/linux_dumper.h 2021-04-07 19:27:50.808928572 +0200
+@@ -176,12 +176,12 @@ class LinuxDumper {
+ void SetCrashInfoFromSigInfo(const siginfo_t& siginfo);
+
+ uintptr_t crash_address() const { return crash_address_; }
+- void set_crash_address(uintptr_t crash_address) {
+- crash_address_ = crash_address;
++ void set_crash_address(uintptr_t crash_addr) {
++ crash_address_ = crash_addr;
+ }
+
+ int crash_signal() const { return crash_signal_; }
+- void set_crash_signal(int crash_signal) { crash_signal_ = crash_signal; }
++ void set_crash_signal(int crash_sig) { crash_signal_ = crash_sig; }
+ const char* GetCrashSignalString() const;
+
+ void set_crash_signal_code(int code) { crash_signal_code_ = code; }
+@@ -196,7 +196,7 @@ class LinuxDumper {
+ }
+
+ pid_t crash_thread() const { return crash_thread_; }
+- void set_crash_thread(pid_t crash_thread) { crash_thread_ = crash_thread; }
++ void set_crash_thread(pid_t thread) { crash_thread_ = thread; }
+
+ // Concatenates the |root_prefix_| and |mapping| path. Writes into |path| and
+ // returns true unless the string is too long.
diff --git a/external/breakpad/c++20-allocator.patch b/external/breakpad/c++20-allocator.patch
new file mode 100644
index 000000000..245fac9e2
--- /dev/null
+++ b/external/breakpad/c++20-allocator.patch
@@ -0,0 +1,12 @@
+diff -u -p -d -N -r breakpad.sav/src/common/memory_allocator.h breakpad/src/common/memory_allocator.h
+--- src/common/memory_allocator.h 2021-04-07 19:12:50.357462734 +0200
++++ src/common/memory_allocator.h 2021-04-07 19:45:05.490291766 +0200
+@@ -161,7 +161,7 @@ class PageAllocator {
+ // Wrapper to use with STL containers
+ template <typename T>
+ struct PageStdAllocator : public std::allocator<T> {
+- typedef typename std::allocator<T>::pointer pointer;
++ typedef T* pointer;
+ typedef typename std::allocator<T>::size_type size_type;
+
+ explicit PageStdAllocator(PageAllocator& allocator) : allocator_(allocator),
diff --git a/external/breakpad/dump_syms.sln b/external/breakpad/dump_syms.sln
new file mode 100644
index 000000000..354b1783c
--- /dev/null
+++ b/external/breakpad/dump_syms.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31229.75
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dump_syms", "dump_syms.vcxproj", "{792E1530-E2C5-4289-992E-317BA30E9D9F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {792E1530-E2C5-4289-992E-317BA30E9D9F}.Debug|x86.ActiveCfg = Debug|Win32
+ {792E1530-E2C5-4289-992E-317BA30E9D9F}.Debug|x86.Build.0 = Debug|Win32
+ {792E1530-E2C5-4289-992E-317BA30E9D9F}.Release|x86.ActiveCfg = Release|Win32
+ {792E1530-E2C5-4289-992E-317BA30E9D9F}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {86FBC9CF-7AF1-4996-BB80-EB24CCFC561A}
+ EndGlobalSection
+EndGlobal
diff --git a/external/breakpad/dump_syms.vcxproj b/external/breakpad/dump_syms.vcxproj
new file mode 100644
index 000000000..9f0fcda9e
--- /dev/null
+++ b/external/breakpad/dump_syms.vcxproj
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{792E1530-E2C5-4289-992E-317BA30E9D9F}</ProjectGuid>
+ <RootNamespace>dumpsyms</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v142</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v142</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>16.0.31227.257</_ProjectFileVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>Debug\</OutDir>
+ <IntDir>Debug\</IntDir>
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>Release\</OutDir>
+ <IntDir>Release\</IntDir>
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(VSInstallDir)\DIA SDK\include;..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader />
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(VSInstallDir)\DIA SDK\lib\diaguids.lib;Dbghelp.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>$(VSInstallDir)\DIA SDK\include;..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <PrecompiledHeader />
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>$(VSInstallDir)\DIA SDK\lib\diaguids.lib;Dbghelp.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\common\windows\dia_util.h" />
+ <ClInclude Include="..\..\..\common\windows\guid_string.h" />
+ <ClInclude Include="..\..\..\common\windows\omap.h" />
+ <ClInclude Include="..\..\..\common\windows\omap_internal.h" />
+ <ClInclude Include="..\..\..\common\windows\pdb_source_line_writer.h" />
+ <ClInclude Include="..\..\..\common\windows\string_utils-inl.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\common\windows\dia_util.cc" />
+ <ClCompile Include="..\..\..\common\windows\guid_string.cc" />
+ <ClCompile Include="..\..\..\common\windows\omap.cc" />
+ <ClCompile Include="..\..\..\common\windows\pdb_source_line_writer.cc" />
+ <ClCompile Include="..\..\..\common\windows\pe_source_line_writer.cc" />
+ <ClCompile Include="..\..\..\common\windows\pe_util.cc" />
+ <ClCompile Include="..\..\..\common\windows\string_utils.cc" />
+ <ClCompile Include="dump_syms.cc" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
diff --git a/external/breakpad/include.patch b/external/breakpad/include.patch
new file mode 100644
index 000000000..e90ae9c11
--- /dev/null
+++ b/external/breakpad/include.patch
@@ -0,0 +1,10 @@
+--- src/client/linux/handler/minidump_descriptor.h
++++ src/client/linux/handler/minidump_descriptor.h
+@@ -31,6 +31,7 @@
+ #define CLIENT_LINUX_HANDLER_MINIDUMP_DESCRIPTOR_H_
+
+ #include <assert.h>
++#include <stdint.h>
+ #include <sys/types.h>
+
+ #include <string>
diff --git a/external/breakpad/sanitizer.patch b/external/breakpad/sanitizer.patch
new file mode 100644
index 000000000..5d673103d
--- /dev/null
+++ b/external/breakpad/sanitizer.patch
@@ -0,0 +1,29 @@
+--- src/client/linux/minidump_writer/minidump_writer.cc
++++ src/client/linux/minidump_writer/minidump_writer.cc
+@@ -717,7 +717,7 @@
+ const std::vector<uint64_t> crash_exception_info =
+ dumper_->crash_exception_info();
+ stream->exception_record.number_parameters = crash_exception_info.size();
+- memcpy(stream->exception_record.exception_information,
++ if (!crash_exception_info.empty()) memcpy(stream->exception_record.exception_information,
+ crash_exception_info.data(),
+ sizeof(uint64_t) * crash_exception_info.size());
+ stream->thread_context = crashing_thread_context_;
+@@ -760,7 +760,7 @@
+ // Adjust base address with the virtual address of the PT_LOAD segment
+ // corresponding to offset 0
+ if (ph.p_type == PT_LOAD && ph.p_offset == 0) {
+- base -= ph.p_vaddr;
++ base = reinterpret_cast<char*>(reinterpret_cast<uintptr_t>(base) - ph.p_vaddr);
+ }
+ if (ph.p_type == PT_DYNAMIC) {
+ dyn_addr = ph.p_vaddr;
+@@ -769,7 +769,7 @@
+ if (!dyn_addr)
+ return false;
+
+- ElfW(Dyn)* dynamic = reinterpret_cast<ElfW(Dyn)*>(dyn_addr + base);
++ ElfW(Dyn)* dynamic = reinterpret_cast<ElfW(Dyn)*>(dyn_addr + reinterpret_cast<uintptr_t>(base));
+
+ // The dynamic linker makes information available that helps gdb find all
+ // DSOs loaded into the program. If this information is indeed available,
diff --git a/external/breakpad/ubsan.patch b/external/breakpad/ubsan.patch
new file mode 100644
index 000000000..29790b4c0
--- /dev/null
+++ b/external/breakpad/ubsan.patch
@@ -0,0 +1,21 @@
+--- src/client/linux/minidump_writer/directory_reader.h
++++ src/client/linux/minidump_writer/directory_reader.h
+@@ -96,7 +96,7 @@
+ const int fd_;
+ bool hit_eof_;
+ unsigned buf_used_;
+- uint8_t buf_[sizeof(struct kernel_dirent) + NAME_MAX + 1];
++ uint8_t buf_[sizeof(struct kernel_dirent) + NAME_MAX + 1] __attribute__ ((aligned (__BIGGEST_ALIGNMENT__)));
+ };
+
+ } // namespace google_breakpad
+--- src/common/memory_allocator.h
++++ src/common/memory_allocator.h
+@@ -75,6 +75,7 @@
+ if (!bytes)
+ return NULL;
+
++ bytes = (bytes + (__BIGGEST_ALIGNMENT__ - 1)) & ~(__BIGGEST_ALIGNMENT__ - 1);
+ if (current_page_ && page_size_ - page_offset_ >= bytes) {
+ uint8_t* const ret = current_page_ + page_offset_;
+ page_offset_ += bytes;