Variable Debugging with Eclipse Kepler

The current Eclipse Kepler version comes with changes for debugging variables. I have students coming from the earlier Eclipse versions, so here are a few tips for dealing with variables in Eclipse Kepler.

Variables View in Eclipse

Variables View in Eclipse

Variable Hoover

The variable hover in Kepler now shows the variables in different formats. Most of the time, I get all the information needed:

Variable Hoover

Variable Hover

Variables View

The hover functionality already shows most of the time the information I need. If I need more, then I can use the Variables view.

Multiple Selection

A cool feature is that I can select multiple variables (with CTRL key pressed), and it will show in the details pane the different content. Remember my post about “Eclipse Debugging with Strings“? This works now as expected in Kepler too :-).

Variables View with multiple Selections

Variables View with multiple Selections

Changing the Number Format

The ability to change the number format (hex, decimal, octal, binary, string) is hidden behind the small triangle of the view:

Changing the Number Format

Changing the Number Format

Global Variables

There is one big downside using Kepler with GDB: adding global variables to the variables view is not supported 😦

Global Variables Grayed Out

Global Variables Grayed Out

Eclipse moved to the DSF (Debugger Services Framework), and adding global variables to the Variables view is not supported (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=219040). The workaround is to use the Expressions view:

Adding Expressions View

Adding Expressions View

The global variables can be displayed as expressions:

Expressions View to Show Global Variables

Expressions View to Show Global Variables

💡 Instead typing the expression, I can drag&drop variables from the Source view to the Expressions view.

Summary

Eclipse Kepler comes with changes how it deals with variable debugging. The good news is that things are more versatile and powerful (e.g. string debugging finally works). Only global variable debugging is very different: the Expressions view needs to be used for this. But after a while, it is not a bad solution anyway.

Happy Variabling 🙂

12 thoughts on “Variable Debugging with Eclipse Kepler

  1. thank you, thank you!!! Drove me nuts that I could not figure how to change the register display to hex. It was so intuitive with Juni by just right clicking and setting the format.

    Peter

    Like

  2. Pingback: Failed to Debug with GDB: Breakpoints or Expressions on non-existing Locations | MCU on Eclipse

  3. Hi Erich,

    Notwithstanding this post being six months old, and KDS now be in version 1.1.1, let’s see if I’ve missed something:

    In the CodeWarrior debug perspective at least the Global variables can be monitored while the target processor is running (in fact there is even a “refresh time” setting for this in the interface), however, in KDS I cannot find means of having this functionality!

    Is the change to DSF in Eclipse plus the use of gdb for the debugger that lacks the means for having this feature?


    Cesar Rabak

    Like

  4. As a consequence of not being able to view global variables, apparently one cannot set a watchpoint on a global variable. I’m trying to find the code that is corrupting one of my globals.

    Like

  5. Hi Erich, Is there a way to see expression values automatically without suspending execution? As on the Variables view on CW v10.x.

    Like

  6. Pingback: Show Floating Point Variable Bytes in Eclipse CDT | MCU on Eclipse

  7. Pingback: MCUXPresso IDE: Unified Eclipse IDE for NXPs ARM Cortex-M Microcontrollers | MCU on Eclipse

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.