Merge pull request #91006 from reduz/live-backtrace

Ability to print and log script backtraces
This commit is contained in:
Thaddeus Crews
2025-04-24 17:18:52 -05:00
32 changed files with 813 additions and 95 deletions

View File

@@ -36,7 +36,7 @@
class IOSTerminalLogger : public StdLogger {
public:
virtual void log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, bool p_editor_notify = false, ErrorType p_type = ERR_ERROR) override;
virtual void log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, bool p_editor_notify = false, ErrorType p_type = ERR_ERROR, const Vector<Ref<ScriptBacktrace>> &p_script_backtraces = {}) override;
};
#endif // IOS_ENABLED

View File

@@ -34,7 +34,7 @@
#import <os/log.h>
void IOSTerminalLogger::log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, bool p_editor_notify, ErrorType p_type) {
void IOSTerminalLogger::log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, bool p_editor_notify, ErrorType p_type, const Vector<Ref<ScriptBacktrace>> &p_script_backtraces) {
if (!should_log(true)) {
return;
}
@@ -48,7 +48,7 @@ void IOSTerminalLogger::log_error(const char *p_function, const char *p_file, in
switch (p_type) {
case ERR_WARNING:
os_log_info(OS_LOG_DEFAULT,
os_log_error(OS_LOG_DEFAULT,
"WARNING: %{public}s\nat: %{public}s (%{public}s:%i)",
err_details, p_function, p_file, p_line);
break;
@@ -69,6 +69,10 @@ void IOSTerminalLogger::log_error(const char *p_function, const char *p_file, in
err_details, p_function, p_file, p_line);
break;
}
for (const Ref<ScriptBacktrace> &backtrace : p_script_backtraces) {
os_log_error(OS_LOG_DEFAULT, "%{public}s", backtrace->format().utf8().get_data());
}
}
#endif // IOS_ENABLED