Conditional Breakpoint

Non-VS2015 Logos
This version of the documentation page applies to Visual Studio prior to VS2015 and to all versions of Atmel Studio.
Read documentation page for Visual Studio 2015 here.

What Conditional Breakpoints Can be Used For

You can specify, which information from your program (values of variables etc.) shall be transmitted to Visual Micro when the breakpoint is hit. This can be a fixed text as well as values of variables. You can also change the variable's values on your PC and then can instruct the board to continue executing while using the new variable value.

Note Icon Note

After making changes to your breakpoint as shown here, you must recompile and upload your sketch in order for the changes to go into effect.

How to Create a Conditional Breakpoint

Read on the general Breakpoints documentation page on how to set breakpoints.

To make a breakpoint conditional, right click the Breakpoint Indicator marker of an existing breakpoint at the left of your code and choose "Condition...":

Hit Count Breakpoint Context Menu

 

The following window appears:

Breakpoint Condition Window

Check the Condition Checkbox checkbox. In the text field below, enter a condition. This can be a variable like "i" or an expression like "i > 30". You can use all variables that are available at that location in your code.

Choose either "Is true" or "Has changed".

  • With "Is true", the breakpoint will become effective if the condition is true, in this case, if 'i' is greater than 30.
  • With "Has changed", the breakpoint will become effective if the given expression's result has changed since the last time the breakpoint was passed.

A condition can as well be quite complex like "(i > 30 || rectangle.width > 100) && k+l < m". You can even make function calls in the condition: "i > getRectangleWidth()"

 Warning 16 Note

The condition remains effective even if you uncheck the condition checkbox Condition Checkbox. This is due to a limitation in the underlying Microsoft Visual Studio IDE. To remove the condition, simply enter a condition that is always true like "1", or delete the breakpoint and set a new one at the same location.

Other Pages