How to use watchpoints in DVT IDE for VS Code
Overview
This video demonstrates how watchpoints enable you to use advanced debugging techniques in DVT IDE, by suspending execution whenever a variable is about to be accessed or modified.
This video was made using DVT IDE version 25.3.21 and VS Code 1.97.2
Details
Introduction
DVT watchpoints tell you exactly which line of code is accessing or modifying a variable.
You can quickly set a watchpoint by double clicking on the editor vertical bar next to the declaration of a class field, a module signal or a method variable. Execution will suspend whenever of the variable is accessed or modified.
Using watchpoints
A typical use case for watchpoints is debugging unexpected values of a variable.
Of course you could use the show writers functionality and review the matches to find out where it might have taken the unexpected value, but to find out exactly how a particular change occurred, let's set up a modification watchpoint.
Right-click on the watchpoint, select Breakpoint Properties and uncheck the access box.
Moving forward, notice that now execution is stopped only when the watched variable is about to be modified, on the line that will cause the change.
Unexpected randomization can be hard to debug with conventional methods, but watchpoints provide a clever way to catch it. Just set up a modification watchpoint on a rand configuration attribute and run again. Notice how execution stops precisely when the rand variable is generated, allowing you to perform further interactive debugging.