Introduction to C-SPY
An integrated environment
C-SPY is a high-level-language debugger for embedded applications. It is designed for use with the IAR compilers and assemblers, and is completely integrated in the IDE, providing development and debugging within the same application. This gives you possibilities such as:
Editing while debugging
During a debug session, you can make corrections directly in the same source code window that is used for controlling the debugging. Changes will be included in the next project rebuild.
Setting breakpoints at any point during the development cycle
You can inspect and modify breakpoint definitions also when the debugger is not running, and breakpoint definitions flow with the text as you edit. Your debug settings, such as watch properties, window layouts, and register groups will be preserved between your debug sessions.
All windows that are open in the IAR Embedded Workbench workspace will stay open when you start the C-SPY Debugger. In addition, a set of C-SPY-specific windows are opened.
General C-SPY debugger features
Because IAR provides an entire toolchain, the output from the compiler and linker can include extensive debug information for the debugger, resulting in good debugging possibilities for you.
C-SPY offers these general features:
Source and disassembly level debugging
C-SPY allows you to switch between source and disassembly debugging as required, for both C or C++ and assembler source code.
Single-stepping on a function call level
Compared to traditional debuggers, where the finest granularity for source level stepping is line by line, C-SPY provides a finer level of control by identifying every statement and function call as a step point. This means that each function call—inside expressions, and function calls that are part of parameter lists to other functions—can be single-stepped. The latter is especially useful when debugging C++ code, where numerous extra function calls are made, for example to object constructors.
Code and data breakpoints
The C-SPY breakpoint system lets you set breakpoints of various kinds in the application being debugged, allowing you to stop at locations of particular interest. For example, you set breakpoints to investigate whether your program logic is correct or to investigate how and when the data changes.
Monitoring variables and expressions
For variables and expressions there is a wide choice of facilities. You can easily monitor values of a specified set of variables and expressions, continuously or on demand. You can also choose to monitor only local variables, static variables, etc.
Container awareness
When you run your application in C-SPY, you can view the elements of library data types such as STL lists and vectors. This gives you a very good overview and debugging opportunities when you work with C++ STL containers.
Call stack information
The compiler generates extensive call stack information. This allows the debugger to show, without any runtime penalty, the complete stack of function calls wherever the program counter is. You can select any function in the call stack, and for each function you get valid information for local variables and available registers.
Powerful macro system
C-SPY includes a powerful internal macro system, to allow you to define complex sets of actions to be performed. C-SPY macros can be used on their own or in conjunction with complex breakpoints and—for some cores or devices—the interrupt simulation system to perform a wide variety of tasks.
Additional general C-SPY debugger features
This list shows some additional features:
Threaded execution keeps the IDE responsive while running the target application
Automatic stepping
The source browser provides easy navigation to functions, types, and variables
Extensive type recognition of variables
Configurable registers (CPU and peripherals) and memory windows
Graphical stack view with overflow detection
Support for code coverage
The target application can access files on the host PC using file I/O
Optional terminal I/O emulation
RTOS awareness
C-SPY supports RTOS-aware debugging.
These operating systems are currently supported:
Azure RTOS ThreadX
CMX
FreeRTOS
Micrium uC/OS-II
OSEK Run Time Interface (ORTI)
Segger embOS
RTOS plugin modules can be provided by IAR, and by third-party suppliers. Contact your software distributor or IAR representative, alternatively visit the IAR web site, for information about supported RTOS modules.