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 option to display stack trace for errors and warnings #43826

Closed

Conversation

pouleyKetchoupp
Copy link
Contributor

@pouleyKetchoupp pouleyKetchoupp commented Nov 24, 2020

Support for optional stack traces in log on errors and warnings, based on a project setting option to set the call stack size, from godotengine/godot-proposals#963.

Windows, Linux:
Implemented stack trace code in specific OS utility, used in common with the crash handler.

Note: On Windows, stack traces work only with MSVC, not with MingW (see #42540).

Other platforms:
Not supported yet.


Example script:

extends Node

func _ready():
	_test_error()

func _test_error():
	push_error("Test error")
	get_node("abc")

Example output:

ERROR: Test error
   at: GDScriptFunctions::call (modules\gdscript\gdscript_functions.cpp:749)
Callstack:
  - godot.windows.tools.64.exe:GDScriptFunctions::call
    At C:\dev\source\godot\modules\gdscript\gdscript_functions.cpp, line 750
  - GDScript:_test_error
    At res://Node.gd, line 7
  - GDScript:_ready
    At res://Node.gd, line 4
ERROR: Node not found: abc.
   at: (scene\main\node.cpp:1413)
Callstack:
  - godot.windows.tools.64.exe:Node::get_node
    At C:\dev\source\godot\scene\main\node.cpp, line 1413
  - godot.windows.tools.64.exe:call_with_variant_args_retc_helper<Node,Node *,NodePath const &,0>
    At C:\dev\source\godot\core\variant\binder_common.h, line 615
  - godot.windows.tools.64.exe:call_with_variant_args_retc_dv<Node,Node *,NodePath const &>
    At C:\dev\source\godot\core\variant\binder_common.h, line 451
  - godot.windows.tools.64.exe:MethodBindTRC<Node,Node *,NodePath const &>::call
    At C:\dev\source\godot\core\object\method_bind.h, line 555
  - godot.windows.tools.64.exe:GDScriptFunction::call
    At C:\dev\source\godot\modules\gdscript\gdscript_vm.cpp, line 1479
  - GDScript:_test_error
    At res://Node.gd, line 8
  - GDScript:_ready
    At res://Node.gd, line 4

Support for optional stack traces in log on errors and warnings, based
on a project setting option to set the call stack size.

Windows:
Moved stack trace code in specific OS utility used in common with the
crash handler.

Other platforms:
Not supported yet.
@reduz
Copy link
Member

reduz commented Mar 20, 2021

This is interesting, and I guess as long as not too confusing to users it would work also great for telemetry and other stuff if also other platforms are supported.

@Calinou
Copy link
Member

Calinou commented Jul 28, 2023

I've tried to rebase this PR, but it doesn't appear to work on Linux: https://github.com/Calinou/godot/tree/error-handler-windows

@aaronfranke
Copy link
Member

Closing because this PR has conflicts and the original author is no longer interested in working on it. However, if anyone wants this feature, you are welcome to salvage it and work on it further.

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

Successfully merging this pull request may close these issues.

6 participants