-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Breakpad for crash dump generation #56014
Open
hhyyrylainen
wants to merge
9
commits into
godotengine:master
Choose a base branch
from
Revolutionary-Games:crash_dumper
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+75,909
−0
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b384d6e
Added Breakpad crash dump generation
76f3ad2
Fixups
a2f568f
Remove mono re-registration, replace accidentally removed line
1c1a951
Update breakpad
4018d18
Delete unused files
cb4873e
Added missing breakpad source file compile for Linux
hhyyrylainen 8ebf879
Try to fix .gitignore matching Breakpad source files
hhyyrylainen 64d4b92
Update the version hash breakpad is said to be used from
hhyyrylainen e8e8f4c
Made copyright header changes that the checks wanted
hhyyrylainen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,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: | ||
hhyyrylainen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# 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) 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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like there are some leftover mono bits of the code. I can remove these bits when someone would be able to do a PR review / there's a chance that this PR could be betting any closer to being merged. |
||
|
||
// 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did anyone find that these were needed in the end? If not, I'd remove the relevant code (and perhaps keep a second branch on your fork with this code present).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember right, no one has tried this out on mac yet. So there is a chance that these would be required on mac.
If it is determined necessary to get this PR merged, I now have a mac I can use for development so I can check things there to make sure the mac version compiles and can create crash dumps.