How Un-Resolvable Watch Window Symbols Can Affect Debugging Speed

Last modified by Microchip on 2024/06/24 06:30

Once a variable is added to the Watches window, it is retained even after the project debug session is ended and/or different project is currently being active. If the number of such un-resolvable variables in the watch window grows, it can considerably slow down the debugging speed of your active project.

Consider the following scenarios and corresponding watch window behaviors:

When a Debug session is not active within MPLAB® X IDE

The watch window is simply a table of information (strings). You can type in whatever you want. It is not project specific. This is a great advantage when debugging multiple projects, and keeping a clean watch view for where you want to focus.

When you start the debug session and perform a halt for any reason (user-triggered, Break Point, Step)

All the variables in the watch list will be resolved with the debug information associated with the current active debug session. The watch strings that cannot be resolved are hidden to reduce visual clutter. Local variables are labeled as out of scope if unresolvable for the current program. The ones resolved will show their respective values. In order to keep the list valid at all times this occurs on each halt.

If you switch to another active debugging session (debugging multiple projects at the same time)

The watch list is re-resolved and only the variables resolved for the new active session are shown with the others being hidden. This gives a clear view of the variables associated with the current active debug session of that project.

Similarly, if you have multiple projects open and after debugging one, Halt the session and start debugging another project the watch list will be re-resolved at a halt, to only show the variables applicable to the current active debug session. This allows you to keep a list of watches for either project that will be shown or hidden depending on which project you are actively debugging at the time.


Warning: If you never clean up your watch window, you may have numerous variables that will try to get resolved within the watch window with no luck. This takes additional time on each halt and can severely slow down debugging of your active project.

There are a few things you can do to avoid this delay.

You can save watches for specific projects and load them when you need them

For instance to change contexts between project A and project B is to click the Blue Diamond icon in the watch window with the save disk in front of it Export Watches button to save the watch list, and then click the Blue Diamond icon with the manila folder Import Watches button to import the watch list. When importing you can exchange the list or append it to the current list.

There are also alternative watch views that you can use

The alternative watch views can be enabled from the Tools > Options > Embedded > Generic Settings tab. These become available only when you are in a debug session. You can have three alternative watch views that variables can be assigned to.

watch window

You can keep variables separated by projects or by specific debug contexts you are working on. Keeping variables in the different views will provide organization and association of variables that are applicable to your debug session as well as avoid the overhead of trying to resolve watches that are not applicable.

​A best practices approach is to clear the watch list (context menu Delete All) from time to time when no debug session is active.