You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Print script backtrace in the crash handler.
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#include "crash_handler_linuxbsd.h"
|
#include "crash_handler_linuxbsd.h"
|
||||||
|
|
||||||
#include "core/config/project_settings.h"
|
#include "core/config/project_settings.h"
|
||||||
|
#include "core/object/script_language.h"
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
#include "core/string/print_string.h"
|
#include "core/string/print_string.h"
|
||||||
#include "core/version.h"
|
#include "core/version.h"
|
||||||
@@ -146,6 +147,18 @@ static void handle_crash(int sig) {
|
|||||||
print_error("-- END OF BACKTRACE --");
|
print_error("-- END OF BACKTRACE --");
|
||||||
print_error("================================================================");
|
print_error("================================================================");
|
||||||
|
|
||||||
|
Vector<Ref<ScriptBacktrace>> script_backtraces;
|
||||||
|
if (ScriptServer::are_languages_initialized()) {
|
||||||
|
script_backtraces = ScriptServer::capture_script_backtraces(false);
|
||||||
|
}
|
||||||
|
if (!script_backtraces.is_empty()) {
|
||||||
|
for (const Ref<ScriptBacktrace> &backtrace : script_backtraces) {
|
||||||
|
print_error(backtrace->format());
|
||||||
|
}
|
||||||
|
print_error("-- END OF SCRIPT BACKTRACE --");
|
||||||
|
print_error("================================================================");
|
||||||
|
}
|
||||||
|
|
||||||
// Abort to pass the error to the OS
|
// Abort to pass the error to the OS
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#import "crash_handler_macos.h"
|
#import "crash_handler_macos.h"
|
||||||
|
|
||||||
#include "core/config/project_settings.h"
|
#include "core/config/project_settings.h"
|
||||||
|
#include "core/object/script_language.h"
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
#include "core/string/print_string.h"
|
#include "core/string/print_string.h"
|
||||||
#include "core/version.h"
|
#include "core/version.h"
|
||||||
@@ -177,6 +178,18 @@ static void handle_crash(int sig) {
|
|||||||
print_error("-- END OF BACKTRACE --");
|
print_error("-- END OF BACKTRACE --");
|
||||||
print_error("================================================================");
|
print_error("================================================================");
|
||||||
|
|
||||||
|
Vector<Ref<ScriptBacktrace>> script_backtraces;
|
||||||
|
if (ScriptServer::are_languages_initialized()) {
|
||||||
|
script_backtraces = ScriptServer::capture_script_backtraces(false);
|
||||||
|
}
|
||||||
|
if (!script_backtraces.is_empty()) {
|
||||||
|
for (const Ref<ScriptBacktrace> &backtrace : script_backtraces) {
|
||||||
|
print_error(backtrace->format());
|
||||||
|
}
|
||||||
|
print_error("-- END OF SCRIPT BACKTRACE --");
|
||||||
|
print_error("================================================================");
|
||||||
|
}
|
||||||
|
|
||||||
// Abort to pass the error to the OS
|
// Abort to pass the error to the OS
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "crash_handler_windows.h"
|
#include "crash_handler_windows.h"
|
||||||
|
|
||||||
#include "core/config/project_settings.h"
|
#include "core/config/project_settings.h"
|
||||||
|
#include "core/object/script_language.h"
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
#include "core/string/print_string.h"
|
#include "core/string/print_string.h"
|
||||||
#include "core/version.h"
|
#include "core/version.h"
|
||||||
@@ -230,6 +231,18 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
|
|||||||
|
|
||||||
SymCleanup(process);
|
SymCleanup(process);
|
||||||
|
|
||||||
|
Vector<Ref<ScriptBacktrace>> script_backtraces;
|
||||||
|
if (ScriptServer::are_languages_initialized()) {
|
||||||
|
script_backtraces = ScriptServer::capture_script_backtraces(false);
|
||||||
|
}
|
||||||
|
if (!script_backtraces.is_empty()) {
|
||||||
|
for (const Ref<ScriptBacktrace> &backtrace : script_backtraces) {
|
||||||
|
print_error(backtrace->format());
|
||||||
|
}
|
||||||
|
print_error("-- END OF SCRIPT BACKTRACE --");
|
||||||
|
print_error("================================================================");
|
||||||
|
}
|
||||||
|
|
||||||
// Pass the exception to the OS
|
// Pass the exception to the OS
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "crash_handler_windows.h"
|
#include "crash_handler_windows.h"
|
||||||
|
|
||||||
#include "core/config/project_settings.h"
|
#include "core/config/project_settings.h"
|
||||||
|
#include "core/object/script_language.h"
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
#include "core/string/print_string.h"
|
#include "core/string/print_string.h"
|
||||||
#include "core/version.h"
|
#include "core/version.h"
|
||||||
@@ -183,6 +184,18 @@ extern void CrashHandlerException(int signal) {
|
|||||||
|
|
||||||
print_error("-- END OF BACKTRACE --");
|
print_error("-- END OF BACKTRACE --");
|
||||||
print_error("================================================================");
|
print_error("================================================================");
|
||||||
|
|
||||||
|
Vector<Ref<ScriptBacktrace>> script_backtraces;
|
||||||
|
if (ScriptServer::are_languages_initialized()) {
|
||||||
|
script_backtraces = ScriptServer::capture_script_backtraces(false);
|
||||||
|
}
|
||||||
|
if (!script_backtraces.is_empty()) {
|
||||||
|
for (const Ref<ScriptBacktrace> &backtrace : script_backtraces) {
|
||||||
|
print_error(backtrace->format());
|
||||||
|
}
|
||||||
|
print_error("-- END OF SCRIPT BACKTRACE --");
|
||||||
|
print_error("================================================================");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user