A watch window is opened by selecting the 'Watch' command from the 'View' menu or by clicking the Watch window button on the 'View toolbar'.
The watch window is best suited for watching and modifying high level variables - symbols with associated type. You do not need to bother with their locations; you only need to specify their name.
To improve winIDEA responsiveness when high speed real-time access updates are required, watch window updates only items currently visible in the watch window. If, for example, you wish to inspect only a part of an array, you may set watch window to only display the relevant part of the array (example of observing only a part of the array is depicted on the image below, where the array consists of 10 elements, but only first 7 are displayed).
Watch arrays can be expanded up to 4096 elements.
see Watch Window Toolbar for more detailed explanation.
Display pane shows the values of the specified watch items. Content is displayed in the following columns:
Specified watch item name. Variables or SFR items can be drag-and-dropped to the Watch window.
For more control over specifying watch items please read the Watch Expressions chapter.
Value is displayed either in decimal or hexadecimal format, based on the Hexadecimal display option (available in the context menu), together with a representation in the specified format. Double-click the value to modify it. Displayed value can be additionally modified by the ANSI C printf syntax.
Watch item type, as detected by winIDEA, is displayed. Read Watch Expression Type Modifiers chapter to learn about manually specifying the watch item type.
Watch item address is displayed.
Error message is displayed in case the watch item can not be evaluated. Common error messages:
Unknown identifier - symbol with this name was not found / local variable is not defined in this context.
Invalid format specifier - wrong syntax is used for specifying the watch item.
Watching complex data structures
Complex data types can be watched by expanding the tree box expression.
Structures, unions and classes members will also be shown. If these are complex as well, they can be expanded further until a simple type is reached.
When expanding a pointer the value that the pointer points to is shown in the expanded leaf. This can again be expanded until a simple type is reached.
Watch window retains expanded structure of a complex type even if the expression goes out of scope, and retains values of expression which are currently invalid (out of scope, memory access error,…)..
When out of scope, the structure is retained, but Value values are displayed in gray color and the Error reflects the cause of failure.
Note: If the expression is changed or the expression can evaluate to a different type in a changed context, the structure is collapsed.
The watch window consists of two real-time updated panes and two panes that are updated when program execution is stopped. Panes are easily switched by clicking on the appropriate pane selector. This way you can configure a larger number of watches without having to constantly scroll. Settings for real-time updates can be changed in 'Debug/Debug Options/Update' dialog.
Preset Watch List selection
Watch lists allow saving and restoring the configuration of the watch window. Watch lists are kept in .xwl files in the workspace directory. See Watch lists for more detailed explanation.