There are always hidden treasures in Eclipse, and here is one: By default, variables might look like which is not always what I want:
How to change the format to hexadecimal (or any other format)?
Changing Format in Variables View
A solution is to select multiple variables and to change the format to Hexadecimal:
Then I have it in the format I have selected:
But this only works for a few (I always have to select the variable(s) and change the format), and worse: I need to do this for every debug session.
Changing Format Globally
A better way is to set the default to what I need on a workspace level. For this there is a setting in the menu Window > Preferences > C/C++ > Debug where I can change the default format (not only for variables):
With this, all my variables are now in hexadecimal format:
Happy Formatting 🙂
Reblogged this on Sutoprise Avenue, A SutoCom Source.
LikeLike
Excellent. This helps to establish a set of common knowledge FAQ’s for the toolset. Finding out all these issues one at a time for each person with the toolset is very frustrating and time consuming. Thank for posting this on a good spot for future reference.
LikeLike
A number of FAQ’s and Tips and Tricks are in the CodeWarrior documentation. In MCU10.3 it is under the menu Help > Tips & Tricks.
LikeLike
Thanks, you can not imagine the amount of time that I lost for not knowing that.
LikeLike
Ever worked with Freemaster? I is very useful for debugging real-time, but I have some doubts how to interface to HTML.
LikeLike
Another question, is there any way to use the Freedom with Freemaster through the openSDA in debug mode?
LikeLike
I would think so, but for this Freemaster would have to use the OpenSDA debug port. I have not checked it this is already present/implemented.
LikeLike
I have not used it much. Freemaster is nice to set u a nice graphical view. There is a feature in the debugger (‘live view’) which is much simpler and easier to use: it allows to watch the variable value while the target is running in the debugger.
LikeLike
Yes, but sometimes i need a real time view and the debugger’s view is very slow
LikeLike
FreeMaster cannot be much faster (unless it is using a dedicated hardware communication channel). I used Freemaster over OSBDM/OSJTAG, and here it is about the same speed as with the debugger (because it goes through the same communication channel: OSBDM/OSJTAG). But FreeMaster adds nice visualization, for sure.
LikeLike
Hi Carlos,
I just completed a post about using FreeMaster here:
https://mcuoneclipse.com/2013/08/24/tutorial-freemaster-visualization-and-run-time-debugging/
LikeLike
Thanks, but even with this I can’t get the eclipse C++ debug hover to display in hex. Have you any idea how?
LikeLike
Hi Rupert,
which version of CodeWarrior are you using? And does it not work for all kind of variables?
LikeLike
Actually it’s stranger than I thought – I set the preferences to hexadecimal in Window > Preferences > C/C++ > Debug but in both the debug hover and variables window I still get decimal values for char and some but not all integer types. This is in eclipse bundled with NXP’s LXPExpresso. It’s funny because I can’t imagine anyone in embedded wanting decimal.
LikeLike
Then it could be that the LXPExpresso is using a differnt Eclipse distribution? CodeWarrior 10.3 is on Eclipse 3.7.
LikeLike
Hi ,
I tried Changing Format Globally in eclipse juno in Ubuntu 12.04 version with CDT 8.1.2 .But it doesn’t effect any changes in variables, registers or in expressions but Changing Format in Variables View works fine . please help me as i tried the similar scenarios in Windows platform too but there also doesn’t work.
LikeLike
Hi,
yes, this is broken with CDT 8.1 (not sure since when). I noticed that this is not working any more in my Eclipse Kepler. So it is not platform specific. I think it is caused by another feature of CDT 8.1 which in my view at least makes it not such a big problem. Now you can click the small triangle on the right side of the views and then select Number Format > Hex. This will change the format for the whole view.
LikeLike
Finally, all numbers automatically look like they should..
LikeLike
Yes, agreed, I’m a Hex Number Lover too 🙂
LikeLike
Pingback: Show Floating Point Variable Bytes in Eclipse CDT | MCU on Eclipse
Frankly, I don’t think that numbers should be displayed in decimal by default in an IDE. Decimal format is as non-native to programmers, as Mandarin Chinese is to Minnesota Norwegians. And taking the time to find out how to change the format…is a big waste of time.
LikeLike
Hi Jake,
exactly and I agree. That’s why I have published this article about how to change this 🙂
LikeLike