Software

QuickWatch and Watches

While debugging, you might want to track the value of a variable or an expression. To do so, you can right click on the expression under the cursor and select Add a Watch or Quickwatch.

The QuickWatch dialog box lets you examine and evaluate variables and expressions. Because QuickWatch is a modal dialog box, you have to close it before continuing debugging. You can also edit the value of a variable in QuickWatch. For more information on how to watch a variable, see Watch Window.

Some users might wonder why QuickWatch is useful. Why not add the variable or expression to the Watch window? That is possible, but if you want to do a quick scratch calculation that involves one or more variables, you do not want to clutter the Watch window with such calculations. That is when the QuickWatch dialog box is especially useful.

Another feature of the QuickWatch dialog box is that it is resizeable. If you want to examine the members of a large object, it is frequently easier to expand and investigate the tree QuickWatch than it is in the Watch, Locals, or Autos window.

The QuickWatch dialog box does not allow you to view more than one variable or expression at a time. Also, because QuickWatch is a modal dialog box, you cannot perform operations such as stepping through your code while QuickWatch is open. If you want to do these things, use the Watch window instead.

Some expressions have side effects that change the value of a variable or otherwise change the state of your program when executed. Evaluating an expression in the QuickWatch dialog box will have the same effect as executing the expression in your code, which can produce unexpected results if you do not consider the side effects of the expression.

Note: In Microchip Studio, you can view a variable's value by placing the cursor over the variable. A small box called a DataTip appears and shows the value.

To Open the QuickWatch Dialog Box

While in break mode, choose QuickWatch on the Debug menu.

To Open the QuickWatch Dialog Box With a Variable Added

While in break mode, right click a variable name in the source window name and choose QuickWatch, which automatically places the variable into the QuickWatch dialog box.

To Add a QuickWatch Expression to the Watch Window

In the QuickWatch dialog box, click Add Watch.

Any displayed expression in the QuickWatch dialog box adds to the list of expressions in the Watch window, usually added to the Watch1 window.