Please enable JavaScript to view this site.

winIDEA Help

Version: 9.21.36

Watches Window

The Watches 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 and winIDEA will resolve them for you.

 

 

The Watches Window allows you to:

 

Warning40x40

To improve winIDEA responsiveness when high 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, to improve responsiveness.

 

 

Opening the Watches Window

To open Watches Window select View menu / Debug / Watches or select WatchWindowButton Watches Window button on main toolbar.

 

 

Elements of the Watches Window

WatchWindow

number1

Toolbar

number2

Display pane

number3

Watch selection

 

 

Toolbar

Button

Description

WatchWindow-NewWatchButton

Add New Watch

Opens the Browsing Variables window to add new watch.

You can also configure a new watch expression by:

1. selecting an empty line in the watch window and start entering the watch expressions or;

2. select the expression you wish to watch in the editor and drag it to the watch window.

WatchWindow-DeleteWatchButton

Delete Watch

Deletes the selected watch element.

WatchesSelectAll

Select All Watches

Select all watches available in the list.

RealTimeButton

Real Time update

Enable/Disable Real-time update.

Watches Window can show normal watch and real-time watch panes.

Normal Watches can be used to view variables when the CPU is stopped.

Real-time Watches can be used to follow the value of the variable in real-time.

WatchWindow-ToggleHexButton

Toggle Hex Mode

Toggles the display value between decimal and Hexadecimal.

WatchWindow-SetDisplayModeButton

Set Display Mode

Opens Watch Display window where graphical display can be enabled. See Display mode for more detailed explanation.

WatchWindow-PropertiesButton

Properties

Opens Properties window.

CreateInitScriptButton

Create init script

Creates Python Initialization script.

Find.watch

Find Watch

Find Watched

ExportButton

Export as watch list

Saves variables watch list to the disk in a workspace folder.

ImportButton

Import from watch list

Creates a new watch list, scans the workspace folder and looks for available *.xwl files. Select a file to import from a small pop-up window.

 

 

Display pane

Display pane shows the values of the specified watch items. Content is displayed in the following columns:

  • Name - Specified watch item name. For more control over specifying watch items please read the Watch Expressions chapter.
  • Complex data types can be watched by expanding the tree box expression. Structures, unions and class 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.

Watches 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 values are displayed in gray color.

 

Warning40x40

If the expression is changed or the expression can evaluate to a different type in a changed context, the structure is collapsed.

 

Warning40x40

In older version of winIDEA default color when modifying value or focusing a specific symbol is red with gray background which provides bad contrast. In updated version of winIDEA this has been changed, but the older default color stays in your saved option values. To improve visibility *xtrf file has to be deleted: (i) Click Start or Cortana search icon in Windows 10; (ii) In search box type in %appdata% and select the folder, (iii) In AppData/Roaming file delete [USER]\AppData\Roaming\ASYST\winIDEA\winIDEA.xtrf

 

  • Value - Value is displayed either in decimal or hexadecimal format, based on the Hexadecimal display option (available in the toolbar/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.

 

winIDEA can only modify values of expressions that evaluate to a target system address (also called Lvalues). You can't modify constant expressions or Rvalues.

Here are some expressions whose value can be modified:

 

c         variable 'c'
:0x1000   memory at address 1000h

 
and following can't:
1         constant
c+1       Rvalue

 

Warning40x40

If the expression does not change, the CPU might have problems with write access to that location.

 

  • Type - Watch item type, as detected by winIDEA, is displayed. The type can be manually overridden with type modifiers specified with the watch name.
  • Address - Watch item address is displayed.
  • Error - 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.

 

 

Right click to copy the link address  Watch selection

The watch window enables to drag-and-drop and join real-time and normal watches (also other windows) to one window in panes. 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.

 

Warning40x40

Existing watches will be removed when a new watch list is loaded.

 

 

Context menu

You open the context menu with right-clicking within the Watches Window.

 

WatchesContexmenu

Hexadecimal display - Toggles the display value between decimal and hexadecimal.

 

Format - winIDEA will display high level variable values formatted according to their data type. If you wish to override default formatting or to enforce a type to a typeless expression, you can use type modifiers.

 

Expand Full - Complex data types can be watched by expanding the tree box expression. Structures, unions and class members will also be shown. If these are complex as well, they can be expanded further until a simple type is reached.

Real Time - Enable and disable real-time watches update.

 

Add Watch - Opens the Browsing Variables window to add new watch.

 

Set Write Breakpoint - Variables configured in the Watches window can be used to directly set a hardware write access breakpoint.

When a single variable whose address is linear in memory space (i.e. not in a register, or using a register offset) is selected, the context menu’s Set Write Breakpoint option configures the hardware access breakpoint logic (if available on the current platform).

 

Delete Watch - Delete selected watch.

 

Create Initialization Script - The watch window can create an initialization script.

 

Properties - Show more detailed properties of the selected variable.

 

Save - Opens a dialog Export Init Script where you can save/export watches values.  

 

Auto Fit - Adjusts the width of columns to fit the content into the available space.

 

Options - Provides access to the dialog that allows customization of colors and fonts of the Watches Window.

 

 

Enable graphical display in Display Mode

Dialog enables adding a bar-graph type visualization in the background to selected variables.

 

WatchDisplay

1. Right-click within Watches Window and in context menu choose Display Mode or click on the Set Display Mode button in the Watches toolbar.

2. Enable graphical display mode in the checkbox.

3. Choose a scale type (linear, exponential, logarithmic).

4. Type in a range within which the graphical display will display the variable’s state

5. Choose a color for the graphical display. Each variable can be displayed in a different color.

 

 

Displaying columns in the window

To display or hide columns right-click on a column header and select what you want to see.

 

Watches Options

To configure colors and fonts  and fonts right-click in the window and select Options from the context menu.

 

 

Right click to copy the link address Watch Expressions

Expression Conventions

A watch expression can be any legal C expression, with exception of the ternary '?' operator. Here are some examples of legal expressions:

 

c            variable 'c'
a[3]            third element of array 'a'
a[c+3]*2          can you figure it out?

 

 

The value of the watch can be further formatted using the ANSI C printf syntax: ifloat,"%4.2f"  - ifloat variable printed 4 characters wide, with two decimal digits
 

Warning40x40

The type of the expression must match the format string type, otherwise an Incompatible format type result is displayed as value.

 

 

Registers and absolute memory locations in Expressions:

The expression syntax has been extended to allow usage of registers and absolute memory locations in expressions.

 

1. Register name

Use the '@' prefix to specify a register by the register name:

@R1                        (value of R1 register)

 

2. Full path to a register / bit field

Use the '@' prefix to specify full path to a register / bit field. This allows display of SFRs with identical names belonging to different CPU modules:

 

@"PCU Power Control Unit"\PCU_PCONF0\STBY0

 

Use quotes to wrap the module names separated by spaces.

 

Path can be placed to the SFR window by:

  • typing the full SFR path
  • either SFR or a specific bit field can be dragged from the SFR Window to the Watch window. In this case the path separator is '\' and quotes are required.

 

Example - Following syntax is valid:

@"STM\STM2_TIM0" - Drag & dropped from the SFR window

@STM\STM2_TIM0

@STM2_TIM0

 

Same syntax can be used to access SFR registers via isystem.connect.

 

3. Absolute memory

Use the ':' prefix to access absolute memory. If the CPU has more than one memory area, use memory area specifier before the colon:

 

:0x1000      (byte on address 1000h)

XDATA:0x30                (byte on XDATA 30h)

 

 

4. I/O module pins

Use the '`' prefix to access I/O module pins.

Warning40x40

Character is a grave accent (ASCII code 96), not an apostrophe:

 

`DIN.DIN0                (value on DIN.DIN0 pin)

Warning40x40

I/O module pins can be renamed in the Hardware / Options / I/O tab and in such case the new user-defined names must be used (e.g. DIN.myPinName).

 

 

Overriding default scope

The ANSI C expression evaluator was extended to allow accessing static variables (file or function scope) even when program execution is out of the relevant scope.

The syntax is as follows:

 

To access a variable that is static on a file scope:

 

"<module name>"#<var name>

 

 

Example 1:

To access gs_byCount variable in the testfile.c module

 

"testfile.c#"gs_byCount

 

 

To access a variable that is static on a function scope:

 

<function name>##<var name>

 

Example 2:

To access s_byCount variable in the main function

 

main##s_byCount

 

 

Using several download files

If there are several download files in the workspace, the default file for debugging will be used to gather information on the variables added to the watch list.

To access a variable (for example iCounter) that is defined in a non-default download file (secondOutput.elf) use the following syntax (two commas):

 

iCounter,,secondOutput.elf

 

 

Watch expression type modifiers

winIDEA will display high level variable values formatted according to their type. If you wish to override default formatting or to enforce a type to a typeless expression, you can use type modifiers.

A type modifier is a comma followed by a set of characters after the expression:

 

<expression>,<type modifier>

 

 

Example:

 

:0x1000,I        (7281)

 

Same can be also selected via Format command in context menu.

The following type modifiers are available:

  • c - force 8 bit signed integer type
  • z - force 8 bit unsigned integer type
  • i - force 16 bit signed integer type
  • w - force 16 bit unsigned integer type
  • l - force 32 bit signed integer type
  • u - force 32 bit unsigned integer type
  • ll - force 64 bit signed integer type
  • ull - force 64 bit unsigned integer type
  • f - force 32 bit float type
  • e - force 64 bit float type
  • s - force string interpretation
  • a - force array interpretation
  • d - decimal formatting
  • x or h - hexadecimal formatting
  • b - binary formatting
  • m - hexadecimal dump
  • UTF16 - UTF-16 formatting
  • r - display struct member names
  • <number> - repeat <number> times

 

 

Example 1:

Displays locations 0x1000-0x1001 as a signed 16-bit integer.

 

:0x1000,I   ->   7281  

 

 

Displays locations 0x1000-0x1007 as an array of two 32-bit floats.

 

:0x1000,F2   ->   (4.01,3.14)

 

 

Displays variable 'structure', showing member names and their values formatted hexadecimal.

 

structure,rx   ->   (a:0x3,y:0x55)

 

 

Displays the array 'largearray', starting from the 500th element in the array. This enables watching arrays greater than 256 bytes.

 

largearray,a500

 

 

Example 2:

When trying to monitor stack pointer content, it is very convenient to monitor it in the Watch window.

To monitor SP content, use following syntax in the watch pane:

:(@SP-8),8m        displays 8 bytes down from current SP

:(@SP),6m                displays 6 bytes up from current SP

 

 

Array offset and number of elements displayed

Displaying elements of large arrays would slow down the debug experience, so it is advised to limit the part of the array you wish to display by using the appropriate type modifiers.

Format:

 

<watch expression>,a[<first element][.<number of elements>]

 

 

Example:

sz,a3            // display array elements starting from sz[3]
sz,a3.2          // display 2 array elements, starting at sz[3]
sz,a.2                  // display first 2 array elements

Same can be achieved by selecting Set array offset format option in the context menu.

 

 

Display of char type arrays

Arrays of type char can be displayed in watch window as zero terminated strings. Enable Debug / Debug Options / Symbols / Display char arrays as zero terminated strings option to do so.

If the option is not checked, the string is displayed as an array of 8-bit characters. Individual elements are displayed according to Character display configuration in the same dialog.

The global setting can be explicitly overridden for individual watches with watch modifiers as described in the chapter above.

 

 

Right click to copy the link address Setting write access hardware breakpoint

Variables configured in the Watch window can be used to directly set a hardware write access hardware breakpoint.

When a single variable whose address is linear in memory space (i.e. not in a register, or using a register offset), Set Write Breakpoint command in the context menu configures the hardware access breakpoint logic (if available on the current platform).

 

 

Right click to copy the link address Creating initialization scripts

Watches Window can create a Python initialization script. All selected watches (which can be modified) are exported to a Python file along with their current values:

 

1. Select the watch expressions.

2. Right click and select Create Initialization Script command.

3. Specify the file name and save the Python script. The script is using standard isystem.connect Python syntax and can be executed as such.

4. To initialize the variables to their saved state, select in the main toolbar Tools / External Scripts.

5. A menu with all available Python scripts will be opened. Select the required script the variable contents will be restored.

 

Warning40x40

If regular watch pane is used, monitor access will be used to perform the modification. If real-time watch pane is used, real-time access will be used. This setting can be manually overridden by editing the Python file.

 

Creating initialization script with char variables

When generating an initialization script from the watch window variable values will be used as displayed in the watch window. This may be problematic for the char variables, as most commonly they are displayed in ASCII (integer) format. This format will not work in the initialization script. In order to change the display format of the char variables go to Debug / Debug options / Symbols / Character display and choose Integer.

 

 

Right click to copy the link address Normal time vs. Real-time Watch

When the CPU is running, the Real-time Watch attempts to show every change of a variable’s content. A Normal Watch marks every change since the CPU was last stopped. Therefore changes are displayed permanently (until the next CPU stops) whilst changes in real-time watch are displayed only until they change again.

 

The Real-Time Watch feature attempts to update all listed variable as often as possible.

Several factors limit the speed of the updates:

  • The more variables that are selected, the slower the updates will occur.
  • The feature is highly dependent on the target’s CPUs debug hardware and the speed of the debug interface.

 

By default real-time update is 0.2 s and it can be changed by clicking Debug / Debug Options / Update.

 

Warning40x40

This feature may impact the real-time performance of your application and the debug interface may be stealing read/write accesses from the microcontroller’s internal bus system.

 

More information about Memory Access and Real-time update in Debug Options.

 

 

Find in Watches Window

Use CTRL+F and search through items in the window. A small additional overlaying view will pop up in the top right corner where the user can enter the desired search. If an item with the desired search string in its name is found the item will be selected and shown if out of view

 

Watches-Find

Use keys:

  • Enter or F3 - Cycle through the matching items,
  • SHIFT - Cycle in reverse order
  • ESC - Close the Find overlay (F3 and SHIFT+F3 can still be used to cycle through the matching items.)

 

CaseSensitiveButton

Case Sensitive -  Limit the search to Case Sensitive (ALT+C).

SearchForwardButton

Search forward - F3 or arrow button keys left and right.

SearchBackwardButton

Search backward - SHIFT+F3 or arrow button keys left and right.

 

 

bulb

More resources

 

Copyright© iSYSTEM AG Carl-Zeiss-Str.1 85247 Schwabhausen Germany