The Atmel Studio debugger provides several windows, collectively knows as variable windows, for displaying variable information while you are debugging.
Each variable window has a grid with three columns: Name, Value, and Type. The Name column shows the names of variables added automatically in the Auto and Locals windows.
In the Watch window, the Name column is where you can add your own variables or expressions. See how to watch an expression in the Debugger.
The Value and Type columns display the value and data type of the corresponding variable or expression result.
You can edit the value of a variable in the Value column.
The variable windows, Autos, Locals, and Watch, display the values of certain variables during a debugging session. The QuickWatch dialog box can also display variables. When the debugger is in break mode, you can use the variable windows to edit the values of most variables that appear in these locations.
Editing floating-point values can result in minor inaccuracies because of decimal-to-binary conversion of fractional components. Even a seemingly harmless edit can result in changes to some of the least significant bits in the floating-point variable.
When an expression is evaluated in the Watch window, you might see a refresh icon. This indicates an error or out-of-date value. For more information, see How to: Refresh Watch Values.
If you want to, you can enter an expression for a value. The debugger will evaluate the expression and replace it with the resulting value. The debugger accepts most valid language expressions in a Watch window. For more information, see the section called “Expression formatting”.
If you are programming in native code, you might sometimes have to qualify the context of a variable name or an expression that contains a variable name. The context means the function, source file, and module where a variable is located. If you have to do this, you can use the context operator syntax. For more information, see Context Operator (C/C++ Language Expressions).
Evaluating some expressions can change the value of a variable or otherwise affect the
state of your program. For example, evaluating the following expression changes the value of
var1 = var2++ var1 = var2++
Expressions that change data are said to have side effects, which can produce unexpected results if you are not aware of them. Therefore, make sure you understand the effect of an expression before you execute it.
The debugger must be in break mode.
If the variable is an array or an object, a tree control appears next to the name in the Name box. In the Name column, expand the variable, if necessary, to find the element whose value you want to edit.
In the row you want to change, double-click the Value column.
Type the new value.
On the Debug menu, choose Windows, then choose the name of the variable window you want to display (Autos, Locals, Watch, or Watch1 through Watch4).
You cannot access these menu items or display these windows in design mode. To display these menu items, the debugger must be running or in break mode.