Improve script backtrace print in crash handlers

Also fix the editor crash handler message for bug reports not properly
using the `.editor` override.
This commit is contained in:
Rémi Verschelde 2025-05-07 09:52:46 +02:00
parent 6a6a1168a5
commit a6398d71a3
No known key found for this signature in database
GPG key ID: C3336907360768E1
4 changed files with 24 additions and 40 deletions

View file

@ -67,9 +67,8 @@ static void handle_crash(int sig) {
String _execpath = OS::get_singleton()->get_executable_path();
String msg;
const ProjectSettings *proj_settings = ProjectSettings::get_singleton();
if (proj_settings) {
msg = proj_settings->get("debug/settings/crash_handler/message");
if (ProjectSettings::get_singleton()) {
msg = GLOBAL_GET("debug/settings/crash_handler/message");
}
// Tell MainLoop about the crash. This can be handled by users too in Node.
@ -144,21 +143,18 @@ static void handle_crash(int sig) {
free(strings);
}
print_error("-- END OF BACKTRACE --");
print_error("-- END OF C++ 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()) {
Vector<Ref<ScriptBacktrace>> script_backtraces = ScriptServer::capture_script_backtraces(false);
for (const Ref<ScriptBacktrace> &backtrace : script_backtraces) {
if (!backtrace->is_empty()) {
print_error(backtrace->format());
print_error(vformat("-- END OF %s BACKTRACE --", backtrace->get_language_name().to_upper()));
print_error("================================================================");
}
}
print_error("-- END OF SCRIPT BACKTRACE --");
print_error("================================================================");
}
// Abort to pass the error to the OS