-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
c2eaaef
commit 8131d5b
Showing
273 changed files
with
71,831 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
#!/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/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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/*************************************************************************/ | ||
/* breakpad.h */ | ||
/*************************************************************************/ | ||
/* This file is part of: */ | ||
/* GODOT ENGINE */ | ||
/* https://godotengine.org */ | ||
/*************************************************************************/ | ||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ | ||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ | ||
/* */ | ||
/* 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 |
Oops, something went wrong.