Repository: godot
Issue: Project crashes after starting because breakpoint
Labels: discussion,topic:gdscript,topic:editor,needs testing,crash

### Tested versions

v4.3.beta.custom_build [60844997b]

### System information

Windows 11

### Issue description

Breakpoints make my project crash a few seconds after running from the editor. It works if I remove them all or set it after the project is already running. The number and place of the breakpoints don't seem to matter.

The project starts and runs for about two seconds. The "Saving Scene" dialogue is 100% but still open in the editor. After this popup closes, the project keeps running for a few seconds but then silently crashes, probably when it tries to attach the debugger.

Log:
```
Godot Engine v4.3.beta.custom_build.60844997b (2024-05-30 09:48:18 UTC) - https://godotengine.org
WARNING: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message
        windows_read_data_files_in_registry: Registry lookup failed to get layer manifest files.
        Objects - 1
                Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 2792596287088
     at: RenderingContextDriverVulkan::_debug_messenger_callback (drivers\vulkan\rendering_context_driver_vulkan.cpp:30)
Vulkan 1.3.260 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 3070

================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.3.beta.custom_build (60844997bb2981c44e3b4396ab2918df90f13c97)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] <couldn't map PC to fn name>
[1] _CxxThrowException (D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\throw.cpp:75)
[2] __RTDynamicCast (D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\rtti.cpp:291)
[3] Object::cast_to<GDScriptNativeClass> (C:\godot\godot\core\object\object.h:805)
[4] GDScriptLanguage::debug_get_globals (C:\godot\godot\modules\gdscript\gdscript_editor.cpp:406)
[5] RemoteDebugger::debug (C:\godot\godot\core\debugger\remote_debugger.cpp:506)
[6] ScriptDebugger::debug (C:\godot\godot\core\debugger\script_debugger.cpp:86)
[7] GDScriptLanguage::debug_break (C:\godot\godot\modules\gdscript\gdscript_editor.cpp:272)
[8] GDScriptFunction::call (C:\godot\godot\modules\gdscript\gdscript_vm.cpp:3599)
[9] GDScriptInstance::callp (C:\godot\godot\modules\gdscript\gdscript.cpp:2050)
[10] Object::callp (C:\godot\godot\core\object\object.cpp:819)
[11] Variant::callp (C:\godot\godot\core\variant\variant_call.cpp:1211)
[12] GDScriptFunction::call (C:\godot\godot\modules\gdscript\gdscript_vm.cpp:1739)
[13] GDScriptInstance::callp (C:\godot\godot\modules\gdscript\gdscript.cpp:2050)
[14] Object::callp (C:\godot\godot\core\object\object.cpp:819)
[15] Variant::callp (C:\godot\godot\core\variant\variant_call.cpp:1211)
[16] GDScriptFunction::call (C:\godot\godot\modules\gdscript\gdscript_vm.cpp:1768)
[17] GDScriptInstance::callp (C:\godot\godot\modules\gdscript\gdscript.cpp:2050)
[18] Node::_gdvirtual__physics_process_call<0> (C:\godot\godot\scene\main\node.h:352)
[19] Node::_notification (C:\godot\godot\scene\main\node.cpp:60)
[20] Node::_notificationv (C:\godot\godot\scene\main\node.h:50)
[21] Object::notification (C:\godot\godot\core\object\object.cpp:906)
[22] SceneTree::_process_group (C:\godot\godot\scene\main\scene_tree.cpp:957)
[23] SceneTree::_process (C:\godot\godot\scene\main\scene_tree.cpp:1042)
[24] SceneTree::physics_process (C:\godot\godot\scene\main\scene_tree.cpp:491)
[25] Main::iteration (C:\godot\godot\main\main.cpp:4016)
[26] OS_Windows::run (C:\godot\godot\platform\windows\os_windows.cpp:1686)
[27] widechar_main (C:\godot\godot\platform\windows\godot_windows.cpp:181)
[28] _main (C:\godot\godot\platform\windows\godot_windows.cpp:206)
[29] main (C:\godot\godot\platform\windows\godot_windows.cpp:220)
[30] WinMain (C:\godot\godot\platform\windows\godot_windows.cpp:234)
[31] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[32] <couldn't map PC to fn name>
-- END OF BACKTRACE --
================================================================
```

### Steps to reproduce

Not sure. Anywhere I put a breakpoint makes it crash.

### Minimal reproduction project (MRP)

I can reproduce it every time in my project but I was unable to get a minimal example to do the same.