godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.71k stars 20.12k forks source link

Using `get_stack()` after `yield()` results in a incomplete stack trace #45409

Open MikeSchulze opened 3 years ago

MikeSchulze commented 3 years ago

Godot version: Godot Engine v3.2.3.stable.mono.official - https://godotengine.org OpenGL ES 3.0 Renderer: GeForce GTX 980/PCIe/SSE2

OS/device including version: Windows 10

Issue description: Using get_stack() after yield results in a incomplete stack and makes get_stack() unusless.

Steps to reproduce:

--Before-- Frame 0 - res://addons/gdUnit/test/monitor/PushErrorMonitorTest.gd:45 in function 'test_get_stack_after_yield' Frame 1 - res://addons/gdUnit/src/core/GdUnitExecutor.gd:155 in function 'execute_yielded' --After-- Frame 0 - res://addons/gdUnit/test/monitor/PushErrorMonitorTest.gd:48 in function 'test_get_stack_after_yield'


The second print_stack`()' misses the frame 1

**Minimal reproduction project:**
see *Steps to reproduce:*
Calinou commented 3 years ago

This is unlikely to be fixed before 4.0 is released since it removes yield in favor of await.

dalexeev commented 3 years ago

I'm not sure if this can be fully considered a bug. The point is, the function call resumed after yield() is actually detached from the main stack. The control flow is split into two parallel ones. Yes, this is inconvenient for debugging, but it reflects the reality.

MikeSchulze commented 3 years ago

@dalexeev sure yield is splitup, but for debugging reason it is very bad to miss the full stack trace ;)