How to set breakpoints in tool scripts when running editor with command line debugger?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By goshot

Per this discussion between reduz and Zylann:

It should be possible to debug tool scripts running in the editor.

This provides an example of debugging a scene running outside the editor with the -d flag:

However, it doesn’t stop to allow the addition of breakpoints before the scene starts executing.

We can start the editor editing the scene like this:

godot -d -e my.tscn

However, that also loads the editor immediately without stopping to allow breakpoint entry and does not recognize any breakpoints set on scripts in the editor visually, which are lost when the editor closes.

I’m curious myself how to even do this. I guess it exists buried in the source code but having it documented would be nice.

Zylann | 2019-09-16 21:36

I have found that if you put an assert(false) in the code, the command line debugger will stop there and you can continue from there. However, it seems buggy as the debugger than starts stopping at breakpoints that you have not created either with the command line debugger or in the editor itself.

goshot | 2019-09-18 17:54