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

Add a project setting to display a full stack trace for errors and warnings #963

Open
4 of 8 tasks
pouleyKetchoupp opened this issue May 29, 2020 · 1 comment
Open
4 of 8 tasks
Labels
implementer wanted This proposal can probably be implemented, if there was a hero to do it topic:core

Comments

@pouleyKetchoupp
Copy link

pouleyKetchoupp commented May 29, 2020

Describe the project you are working on:
Not a project specific feature.

Describe the problem or limitation you are having in your project:
In case of errors, only the specific function and line are displayed in the log. It would be useful to be able to get a stack trace so you can track down the cause of errors in some situations.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
New project setting to show call stacks for errors:
debug/settings/error_handler/max_call_stack

It would allow to show a certain number of levels in the call stack, including gdscript if the error comes from scripts.

By default, it should be disabled because it can slow things down very badly when getting stack trace information.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
Work in progress version:
godotengine/godot@master...nekomatata:error-handler-windows

This is a version I've implemented for my custom branch. It's Windows only and it should be compatible at least with Godot 3.2.

Here are the remaining steps to finalize it:

  • Rebase on 4.0 and make sure the code is compatible

  • Windows implementation: refactor the crash handler code to be able to share the access to stack trace information between crash handler and error handler

  • Make a cross-platform error handler class to manage some common logic/utils, like accessing scripts stack trace information and formatting the messages

  • Add Linux implementation

  • Add macOS implementation

  • Add iOS implementation

  • Add Android implementation

  • Add HTML5 implementation

I wouldn't mind working on at least the first 3 points if there's an interest in this feature.

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

Is there a reason why this should be core and not an add-on in the asset library?:
It has to be part of the engine to work.

@akien-mga
Copy link
Member

If this can be done without too much complexity I think it would be quite useful. I can foresee it being quite slow when enabled, especially if you get lots of errors. Depending on how slow it gets we could devise a system to e.g. mark what error you want to produce a stacktrace.

The implementation should work on all desktop platforms at least. We should evaluate whether repurposing our crash handlers is the best way to do this, or if we should look into thirdparty libraries that do the same.

Then there's the question of debug symbols, as currently we strip official binaries so they couldn't provide any useful information. That's also a matter for a separate proposal but we probably need some kind of debug symbols server that users could download symbols from for their current Godot stable release whenever they need it.

It would be really useful to have a GDScript stacktrace too but that's a topic for a separate proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
implementer wanted This proposal can probably be implemented, if there was a hero to do it topic:core
Projects
Status: Ready for Implementation
Development

No branches or pull requests

4 participants