Symbols in the Watch window may not be updated while the application is running due to disabled Real-time update.
Most often the reason for the incorrect symbol value displayed in the Watch
window is, that 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.
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++) |
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.
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 |
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.
{{ topic.Content }}