Categories

{{ selectedCategory.name }}

{{ topic.Title }} {{ topic.Ddate | formatDate }}

{{ topic.Content }}

No topics found!

A variable in Real-Time Watch Window doesn't display correct value and is not updated

29-Apr-2024

Possible solutions

Enable Real-time update in the Watch window

Symbols in the Watch window may not be updated while the application is running due to a disabled Real-time update.


Check your download files

Most often the reason for the incorrect symbol value displayed in the Watch window is, that the symbol's debug information (address, size, format,...) is loaded from the wrong symbol file when more than one symbol file is specified for one application.

You can change the Default file for debugging from the drop-down menu, where symbol files are listed (go to Debug / Configure Session / Application / Symbol Files).


Make sure your code is not optimized

1. Check if debug symbols are available. Can you set a breakpoint in the file editor or not?

2. Check disassembly and through the code, to see if you can go to desired code or not.

3. If code is not executed (skipped), check compiler optimization. Make sure you have optimization level 0.

4. If part of the code is still skipped, make variables volatile.

The most problematic variables are:

for (int i = 0; i < my_number; i++)


Instead, use:

for (volatile int i = 0; i < my_number; i++)


Add variables via the Symbol browser

It's recommended to add variables to the Watch window via Add new watch / Symbol browser. This way the syntax is correct and you do not have to edit it manually. 


Manually edit syntax in the Watch window

You can also manually fix the syntax. Variables should be specified with fully qualified names to reduce ambiguity during symbol evaluation.


winIDEA resolves the syntax in the following manner:

Syntax to access a variable that is static on a file scope:

"<module name>"#<var name>


For example, to access gs_byCount variable in the TestfileA.c module, use the following syntax in the Watch window:

"TestfileA.c#"gs_byCount


Syntax to access a variable that is static on a function scope:

<function name>##<var name>


For example, to access s_byCount variable in the main function, use the following syntax:

main##s_byCount


If the application (winIDEA workspace) only has one download file, the download file will not be added to the symbol expression. If there are multiple download files, then the download file will be listed for all symbols even if there are no collisions.


Syntax to access a variable that is defined in a non-default download file (secondOutput.elf)

Use the following syntax (two commas) with or example iCounter:

iCounter,,secondOutput.elf


More resources in winIDEA Help:

Was this answer helpful?

Sorry this article didn't answer your question, we'd love to hear how we can improve it.
Note: This form won't submit a case. We'll just use it to make this article better.

Similar topics

{{ topic.Title }} {{ topic.Ddate | formatDate }}

{{ topic.Content }}

No similar topics found!

Other topics in the same category

{{ topic.Title }} {{ topic.Ddate | formatDate }}

{{ topic.Content }}

No topics found!