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.
Variable Hoover
The variable hover in Kepler now shows the variables in different formats. Most of the time, I get all the information needed:
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 :-).
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:
Global Variables
There is one big downside using Kepler with GDB: adding global variables to the variables view is not supported 😦
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:
The global variables can be displayed as expressions:
💡 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 🙂
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
LikeLike
Hi Peter,
You are welcome, and you are not alone. That small triangle with the menu is easily missed.
Erich
LikeLike
Pingback: Failed to Debug with GDB: Breakpoints or Expressions on non-existing Locations | MCU on Eclipse
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
LikeLike
Hi Cesar,
that is a CDT extension and CodeWarrior specific feature. The CodeWarrior team had implemented that, and this feature is not present in stock CDT/GDB.
Erich
LikeLike
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.
LikeLike
Hi Eric,
Yes, I agree that Kepler has not made it easy for setting watchpoints or viewing global variables. But it is possible to set watchpoints from teh Outline view, see https://mcuoneclipse.com/2014/05/17/cc-watchpoints-with-eclipse-kepler/
I hope this helps?
LikeLike
Hi Erich, Is there a way to see expression values automatically without suspending execution? As on the Variables view on CW v10.x.
LikeLike
Hi Carlos,
no, this is currently not possible without suspending execution. Actually CW for MCU10.x did suspend execution too, but did it in a way nor really visible to you. I’m using GDB in a ‘periodic’ mode which is similar to what exists in CW for MCU 10.x: I have a special breakpoint which dumps the variable and then automatically continues execution. Maybe this is interesting for you?
LikeLike
Hi Carlos,
this article might get you close to the same thing: https://mcuoneclipse.com/2015/07/14/automatic-variable-expression-and-memory-display-with-gdb-and-eclipse/
LikeLike
Pingback: Show Floating Point Variable Bytes in Eclipse CDT | MCU on Eclipse
Pingback: MCUXPresso IDE: Unified Eclipse IDE for NXPs ARM Cortex-M Microcontrollers | MCU on Eclipse