Viewing the Value of a Variable or Contents of a Register
Home Page (Debugger) | Overview | How Do I... Topics
What do you want to do?
View the value of a variable or expression or the contents of a register
View the value of a variable using QuickWatch
View a the value of a variable or expression or the contents of a register in the Watch window
View type information for a variable in the Watch window
View a variable in the Variables window
View type information for a variable in the Variables window
Display meaningful values for your custom data type?
To view the value of a variable or expression or contents of a register
Wait for the debugger to stop at a breakpoint.
– or –
Click Break on the Debug menu to halt the debugger.
On the Debug menu, click QuickWatch.
Type or paste the variable or register name or an expression into the Expression text box, and click Recalculate.
Click Close.
Tip The Expression drop-down list box contains the most recently used QuickWatch expressions.
To view the value of a variable using QuickWatch
When the debugger is stopped at a breakpoint, switch to a source window, and click the right mouse button on a variable (Var, for example).
On the shortcut menu, click QuickWatchVar.
Click Close.
To view the value of a variable or expression or the contents of a register in the Watch window
Start debugging, and pause the debugger in break mode (program is waiting for user input after completing a debugging command).
On the View menu, click Debug Windows, then click Watch.
Select a tab for the variable or expression.
Type, paste, or drag the variable or register name or an expression into the Name column on the tab.
Press ENTER (if typing).
The Watch window evaluates the variable or expression immediately and displays the value or an error message.
If you add an array or object variable to the Watch window, plus sign (+) or minus sign (–) boxes appear in the Name column. Use these boxes to expand or collapse your view of the variable described in Spreadsheet Fields.
Change the Watch window display format (to display Unicode characters, for example) using formatting symbols, described in Symbols for Watch Variables.
To view type information for a variable in the Watch window
In the Watch window, select the line containing the variable whose type you want to see.
On the View menu, click Properties.
To view a variable in the Variables window
Start debugging, and pause the debugger in break mode (program is waiting for user input after completing a debugging command).
On the View menu, click Debug Windows, then click Variables.
Click the Auto tab, Locals tab, or This tab, according to the type of variables you want to see.
To view type information for a variable in the Variables window
In the Variables window, click the Auto tab, Locals tab, or This tab.
Select the line containing the variable whose type you want to see.
On the View menu, click Properties.
To display meaningful values for a custom datatype
The file autoexp.dat controls how the debugger displays data types in windows, Quickwatch, and DataTips. You can modify this file to add meaningful displays for your own datatypes. For details, see the autoexp.dat file itself (located in the /bin directory).