PEmicro Blog

View Variables While Code is Running in PEmicro's GDB Eclipse Plug-In

Mar 02, 2017

PEmicro’s GDB Server Plug-in for ARM devices features the ability to view variables and memory while a target ARM device is running. This Eclipse plugin can be installed in any Eclipse-based IDE and supports the debug of ARM microcontrollers via PEmicro’s Multilink, Cyclone, and OpenSDA debug hardware. The “Real Time Expressions” view, which is part of the plugin, is similar to the normal expressions view, except that it works while the part is running.

Typically when debugging a program, a user would set a breakpoint, resume the target, hit the breakpoint, step through code, check variable values and flush out any bugs that the program may have. The user would repeat this process until all bugs have been addressed. But what if the process of halting the target masks a bug? What if, in order to reproduce a particular bug, the program must be kept running while being fed a particular set of data? In those cases, having the ability to view variable values as they change without halting the target is a great asset. Also, the ability to view variable values while the target is running eliminates the need to have a physical feedback mechanism such as a blinking LED. The user can simply monitor a variable value and check for changes while the target is running to check if a particular section of code gets executed.

This new “Real Time Expressions” view feature is available in PEmicro’s GDB Server for ARM devices v2.8.1 and higher. Click to view installation instructions.

This feature is compatible with any GDB ARM Eclipse-based IDE’s, including the following:

The example below will demonstrate how to view variables while an NXP Kinetis KL25Z device is running in NXP's Kinetis Design Studio. A different example showing the NXP Kinetis K64F device can be seen on the popular MCUOnEclipse blog. All ARM Cortex devices are supported.

To open the Real Time Expressions view, please follow the instructions below:

Navigate to Window -> Show View -> Other …

Navigate to Show View
Figure 1: Navigate to Show View

In the “Show View” dialog, select “Real Time Expressions” under the “PE Microcomputer Systems” category:

Select 'Real Time Expressions'
Figure 2: Select 'Real Time Expressions'

The “Real Time Expressions” view is shown below:

'Real Time Expressions' View
Figure 3: 'Real Time Expressions' View

Once the Real time Expressions view is displayed, variables may be added to the view. After that, no other configuration is needed. The refresh mechanism is enabled by default when the target runs. Values that are refreshed are highlighted in blue text.

Values Highlighted in Blue
Figure 4: Values Highlighted in Blue

If there is a need to halt the refresh mechanism, pressing the “Halt” button freezes the values.

Halt Button Freezes Values
Figure 5: Halt Button Freezes Values

Pressing it again re-enables the refresh mechanism:

Clicking Halt Button Again Re-Enables Refresh
Figure 6: Clicking Halt Button Again Re-Enables Refresh


For pointers that are constantly changing values, the values from de-referencing the same pointer may not be accurate while the device is running. This limitation is highlighted in grey:

Limitations Highlighted in Grey
Figure 7: Limitations Highlighted in Grey

Also, the “Real Time Expressions” view is not currently available for the E200 architecture, nor for Multi-Core debugging. Currently it is only available for Cortex-M devices such as NXP's Kinetis and LPC.


For those debugging instances where it is not ideal to halt the target, the ability to view variable values while the target is running can be very useful. The “Real Time Expressions” view can be used to track down the types of bugs that show up only when the target is running.

Tags related to this Blog Post

GDB Server     ARM     NXP     Debug