Share via


Watching Variables and Expressions (Windows Embedded CE 6.0)

1/5/2010

The Watch Window contains four tabs: Watch1, Watch2, Watch3, and Watch4. Each tab displays a user-specified list of variables and expressions in a spreadsheet field.

Use the Watch window to do the following:

  • Specify variables and expressions you want to watch while debugging your application. For more information, see Viewing a Value in the Watch Window or Viewing a Value Using QuickWatch.

  • Modify the value of a variable in the Watch window.

  • Group variables you want to watch onto the same tab.
    For example, you could put variables related to a specific window on one tab and variables related to a dialog box on another tab. You could watch the first tab when debugging the window and the second tab when debugging the dialog box.

  • Add an array, an object, or a structure variable to the Watch window. You can use the plus (+) or minus (–) boxes in the Name column to expand or collapse your view of the variable.

  • Use formatting characters to change the default display format. For more information, see Character Formatting of Watch Variables.
    For example, the following command specifies a hexadecimal value x as a Unicode character.

    x,su
    
  • Review global variables of any module that is loaded by qualifying the variable name with the context operator.
    For example, no matter what the current process is, you can examine the ProcArray structure in the kernel by typing a command in a Watch window. The following command shows how to do this:

    {,,nk.exe}ProcArray
    
  • Review a module by casting a thread address. If you want to look at the thread structure for the Shell.exe process from the Processes command output, you can type a command in the Watch window.
    The following command shows how to look at the thread structure for a process with address 0:0x08cbe0a5.

    (PTHREAD)0:0x08cbe0a5c
    
  • Change the default color of highlighted variables
    If the value of a variable appears in red, it indicates that the value has recently changed. To change the color of this highlighted value:

    • From the Tools menu, choose Options.
    • Choose the Format tab.
    • In the Colors box, select a highlight item; for example, Value Highlight.
    • In the Foreground box, choose a new color and then choose OK.

Objects, References, and Pointers in the Watch Window

If the variable is an object, a reference, or a C++ pointer to an object, the Watch window expands the variable to show the most important data at the top level.

For example, suppose you had the following C++ object:

CString String  =   {...}
char *   m_pchData =0x7ffdf000 "abc"
   int          m_nDataLength=4
   int          m_nAllocLength=1244628

The Watch window displays the following:

String  =   {"abc"}

If the variable is a reference or a C++ pointer to an object, the Watch window downcasts the reference or pointer.

To help you access the members of a derived class, the Watch window adds an extra member to the expanded object. This extra member looks like another base class and indicates the derived subclass. For example, if a variable that is declared as a C++ pointer to CObject really points to a CComboBox, the Watch window recognizes this and adds an extra member so you can access the CComboBox members.

The Watch Windowdoes not display variable type information. You can view information for a variable type by using the window's property page.

See Also

Tasks

Viewing a Value in the Watch Window
Viewing a Value Using QuickWatch

Concepts

Viewing Debug Information in the Debug Windows
Character Formatting of Watch Variables