Handmade Hero»Forums»Code
MICHAL VALOVCIK
1 posts
Visual Studio Debugging - Conditional Break Points
Hello Casey, just watched the 50th episode and saw you debugging a loop and wanted to point out that there are conditional break points in Visual Studio.

You can set it to break when a specific variable is set to a specific value.

Right click on the breakpoint and select "Condition..."

Mārtiņš Možeiko
2562 posts / 2 projects
Visual Studio Debugging - Conditional Break Points
Edited by Mārtiņš Možeiko on
Here's one more trick I often use when debugging with Visual Studio.

If you missed execution of some part of code, you can easily retry it without restart program, by simply moving instruction pointer back to beginning of calculation. Often you can repeat calculation without breaking anything, and this can help to speed up debugging.

To do that drag&drop that yellow arrow on left side of code window.


Or choose "Set Next Statement" (Ctrl+Shift+F10) in popup menu on right mouse button.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Visual Studio Debugging - Conditional Break Points
Yes, I know about these two options but I do not prefer them. It's very simple to just insert code into the program, and it does not have the limitations of the conditional breakpoints nor the unreliability of Set Next Statement.

- Casey