Resolving variables with same name in C-SPY

Technical Note 45813

Targets:
ARM

Component:
Debugger

Updated:
4/1/2011 2:00 PM

Introduction

If your application code contains variables with the same name, it might be difficult to set a breakpoint (using C-SPY macros), or to set a watch on one of them in the C-SPY watch window.

Solution

You need to specify the symbol location in a more specific way.

The syntax is:

<module>\<function>::<symbol>

For example, if the files "main.c" and "test.c" contain a static global (file global) variable called "testvar", the syntax would be:

main\testvar

and

test\testvar

If the file "main.c" contains a function called "testfunc" with a local variable called "testvar", the syntax to add this variable to the Watch window would be:

main\testfunc::testvar

The syntax above works in the Watch window and in C-SPY macros (for example __setSimBreak). Note that in C-SPY macros you need to protect the backslashes (\) with an extra backslash (for example "main\\testvar").

See the example screenshot from C-SPY (below), and the Example project for IAR Embedded Workbench for ARM 6.10.

 

All product names are trademarks or registered trademarks of their respective owners.

Related Tech Notes

© IAR Systems 1995-2016 - All rights reserved.