Breakpoint Conditional Expressions

× Not what you are looking for? Did you want hardware debugging with gdb or gdbstub?"

What Breakpoints Conditional Expressions 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 Breakpoint With a Conditional Expression

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 "Conditions...":

Hit Count Breakpoint Context Menu

or click on the Settings icon icon, that appears when you mouse cursor hovers over the red Breakpoint Indicator breakpoint marker.

 

An new window appears, showing these text fields::

Breakpoint Condition Controls

 

First you choose what mode of conditional expression you want to use.

Breakpoint Vs15 Settings Popup Conditions Mode Combo A

A Conditional expressions

 

Breakpoint Condition Controls showing Comboblox Lists


"Conditional expression" lets you check an expression. Enter the expression in field  exp . You can use variables from your sketch in the expression, e.g. "inputVoltage > 100" assuming "inputVoltage" is one of your variables. Any expression that is valid at the code location of your breakpoint can be used, including function calls, for example: "myFunction(analogRead(SIGNAL_PIN)) > limit[i]"


1 and 2:

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

  • With "Is true", the breakpoint will become effective if the condition is true, e.g. if "inputVoltage" is greater than 100.
  • With "When changed", the breakpoint will become effective if the given expression's result has changed since the last time the breakpoint was passed. "Has Changed" also makes sense without a comparison (>,<,==, etc.), for example, if your expression is "inputVoltage", then the breakpoint halts, if the inputVoltage has changed since the last time the breakpoint was passed.

B Hit Counters


Breakpoint Vs15 Settings Popup Conditions Mode Combo B


Read on this page dedicated to Hit Counters.

C Filters


Breakpoint Vs15 Settings Popup Conditions Mode Combo C

Filters cannot be used with Visual Micro, they are reserved for development using Visual Studio alone.