Skip to content
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

Keep showing the last error(s) and Debugger Stack Trace after stopping game to allow post-Play debugging #10063

Open
hsandt opened this issue Jun 28, 2024 · 1 comment

Comments

@hsandt
Copy link

hsandt commented Jun 28, 2024

Describe the project you are working on

A platformer

Describe the problem or limitation you are having in your project

When I see an error with Stack Trace, I generally inspect it to know what to fix. Often, the game music is running all that time. So once I found my answer I just stop the game and start fixing the issue. At this moment, the Stack Trace is cleared with the message "Debug session closed."

image

But I may have forgotten a few details like the path to the node with the issue, so it would be nice to be able to still see the last error (and Stack Trace) after stopping the game.

I understand if developer starts modifying code and the Stack Trace line numbers become invalid, but it's already an issue if developer modifies code while game is running anyway.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add an option to display the Stack Trace even after game stop.

The most important is the last error message, then a static view of the stack trace.

There is no need to keep the whole game state and Stack Variables for debug, as it may be complicated to when the game is not running, and the most important is just to have a reminder of the error message and the main code lines involved in the bug before developer starts fixing the code or scene.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

This could work like Unity's Console log that stays after Play:

image

except with Godot Stack Trace:

Godot 4 Stack Trace

and we could add an option in the Editor Settings (e.g. debugger/clear_stack_trace_on_stop) to disable this for devs who don't like it.

Bonus: To avoid confusion with the Stack Trace shown when game is actually running, we could add a small text similar to currently "Debug session closed: showing last error & stack trace" before the error message, if any.

The Filter Stack Variables window can stay empty since without the game running we cannot access game state (or it would be more complicated to save a copy of the game state).

image

If this enhancement will not be used often, can it be worked around with a few lines of script?

No, it's a native panel.

Is there a reason why this should be core and not an add-on in the asset library?

While an add-on could be written to capture the last stack trace and reprint it, it seems better to integrate this in the existing Debugger panel.

@Calinou
Copy link
Member

Calinou commented Jun 28, 2024

I wouldn't add an editor setting for this, as the current behavior would become quite niche. Just make this proposed behavior always effective, but add an icon or label somewhere to indicate that the project has been stopped and no further inspection is possible.

It could be something like a "disconnected Ethernet cable" icon to indicate that the debugger connection has been lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants