godotengine / godotengine/godot

Breakpoints work unexpectedly when the script is modified at runtime without hotpatching it.

Open
#99,944 1 comment 0 reactions 0 assignees View on GitHub
discussion topic:editor topic:gdscript
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Reproduced in master (893bbdf)

### System information

Godot v4.4.dev (893bbdfde) - Windows 10.0.22631 - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 (NVIDIA; 32.0.15.6094) - AMD Ryzen 5 3600 6-Core Processor (12 threads)

### Issue description

When I modify the script at runtime, and I don't save it, then breakpoints behave unexpectedly. It appears the compiled script's line numbers and the editor's lines numbers are out of sync. Stepping through the code is also janky.

Restarting the game, or hot patching the script, fixes the issue.

### Steps to reproduce

1. Start the game
2. Set a breakpoint in your script
![Image](https://github.com/user-attachments/assets/628838d0-b282-4357-9e6b-ee91bac96eff)
3. Remove a line BEFORE the breakpoint, so the breakpoint now exists on a different absolute line. (e.g. moved from Line 115 -> Line 114)
4. Do not save the script nor hot reload the game!
* The inconsistency comes from the editor and the compiled script being out of sync
6. Notice that the breakpoint is triggered even though this code is unreachable!
![Image](https://github.com/user-attachments/assets/579d5ecc-a7eb-4e5d-a316-4773ab3b72b1)

### Minimal reproduction project (MRP)

N / A

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in Godot 4.4.dev by setting a breakpoint, removing a line before it without saving or hot reloading, and stepping through the script. Compare the editor's line positions with the compiled script's breakpoint behavior; done means breakpoints and stepping remain aligned after the runtime edit, or the behavior is clearly reported as unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.