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

Breakpoint in getter func crashes debugger and game in editor #64452

Open
Reneator opened this issue Aug 15, 2022 · 6 comments
Open

Breakpoint in getter func crashes debugger and game in editor #64452

Reneator opened this issue Aug 15, 2022 · 6 comments

Comments

@Reneator
Copy link

Reneator commented Aug 15, 2022

Godot version

v3.5.stable.official [991bb6a]

System information

Windows 10

Issue description

Its currently not possible to debug a defined getter function.

The debugger will not show any variables in any of the points in the stack-trace.

Additionally when you continue to run it, the game just keeps hanging/paused and doesnt continue.

Additionally the editor prints a message depending on the assumed type of the var after resuming from the breakpoint, like:

editor/script_editor_debugger.cpp:1498 - Condition "cmd.get_type() != Variant::STRING" is true.

The following is demonstrating the different scenarios:

2022-08-15.18-34-41.mp4

Just ideas as an outsider:
From what i see it might be coming from the getter being used by the debugger to display the information of the var but its currently paused in there. So maybe the breakpoint is also affecting the debugger var evaluator or it gets caught in some kind of loop due to being inside the getter its trying to call. (i think it could be the former)

The expected behaviour would be for the debugger to work properly, show the vars and let me resume the game when telling the debugger to resume.
If this is not possible per se, it would be preferrable to have an error-message like "You cant debug getters for variables" so i understand where the error is coming from to save me time.

Steps to reproduce

  • Create a script
  • Add a var or export var (type shouldnt matter)
  • Define a getter for the var
  • Set a breakpoint inside the getter
  • Call the function and it should stop functioning (the game cannot continue and the debugger doesnt show any values/vars)

As counter-point you can start without debugger and it works properly.

You can try it in the minimal reproduction project below.

Minimal reproduction project

Debugger_Problem_reproduction.zip

@ChainedLupine
Copy link
Contributor

I don't have much to add except this one has bit me pretty hard, too. I didn't notice it until after 3.5 left RC because at the time I wasn't very aggressively using getter/setters, but now I've devised a whole subset of GDscripting that extensively uses this. Oops. 💯

The GDscript debugger just becomes unusable if anywhere in the section being executed there is a getter or setter access.

I also see editor/script_editor_debugger.cpp:1510 - Condition "cmd.get_type() != Variant::INT" is true.

@akien-mga
Copy link
Member

akien-mga commented Aug 29, 2022

I can't seem to reproduce the issue on 3.5.stable on Linux, for me it behaves the same as 3.4.5.stable and a local build of 3.x, the breakpoint in the getter works fine.

Edit: Nevermind, I now watched the video and understood how to trigger the problem. I can reproduce it.
Reading @ChainedLupine's comment I thought this would be a regression, but I tested 3.4.5.stable and 3.4.stable and the behavior is the same.

@Zylann
Copy link
Contributor

Zylann commented Aug 31, 2022

I got a similar issue by mistakenly adding an array to itself. When running the game, the error was originally by trying to use an element of the array as something else, but rather than reporting that, the debugger chokes on the fact the array contains itself.

@Reneator
Copy link
Author

Still happening on v3.5.1.stable.official [6fed1ff]

@iiiCpu
Copy link

iiiCpu commented Jan 6, 2023

Same if _get_property_list is overloaded.
Or, rather, in one project debugger detaches from paused process with said error.
And in minimized test project editor just leaves with standard windows crash dialog.

@ChainedLupine
Copy link
Contributor

ChainedLupine commented Mar 8, 2023

Just checked 3.5.2 stable, still in there, too.

I also ported the code in my project to Godot 4. There was a lot of changes I had to make, but the core _get/_set code was unaltered. And breakpoints worked fine. No editor/script_editor_debugger.cpp:1510 - Condition "cmd.get_type() != Variant::INT" is true. errors. Stack trace worked, and I was able to see properties on the GDscript classes.

I haven't looked through the entire 4.x changelogs over the entire beta/RC series but I was told by someone else that they thought they saw debugger changes. It seems this is a regression between 3.3 (last time I saw this working) that was fixed in 4.

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

6 participants