mirror of
https://github.com/godotengine/godot.git
synced 2025-10-22 09:23:40 +00:00
Print script backtrace in the crash handler.
This commit is contained in:
parent
28089c40c1
commit
e61edcadb8
4 changed files with 52 additions and 0 deletions
|
@ -31,6 +31,7 @@
|
|||
#include "crash_handler_linuxbsd.h"
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/object/script_language.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/string/print_string.h"
|
||||
#include "core/version.h"
|
||||
|
@ -146,6 +147,18 @@ static void handle_crash(int sig) {
|
|||
print_error("-- END OF BACKTRACE --");
|
||||
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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue