Setting the Default Variable Format

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Setting the Default Variable Format

Jump to solution
2,921 Views
d_
Contributor I

Hi,

 

CodeWarrior 10.6

 

I'm looking at variables (local only?) and expressions (variables added to the watch window?) while debugging.  I'd like to change the format to something other than ASCII and have it stick.  I don't see a way to do this.

 

There are a couple of different problems.  If the variable is an array and I want to view in hex, is there a way to change the format for the entire array?

 

Is there a way to set the default format to something other than ASCII?

 

When the format is manually changed, why does CodeWarrior set it back to the default ASCII as  you step in and out of functions?  That makes it extremely difficult to debug anything unless you're used to working in ASCII.

 

Thanks!

 

d.

Labels (1)
0 Kudos
1 Solution
4 Replies
1,827 Views
matthewkendall
Contributor V

If you haven't changed anything then the default format is not actually ASCII, it's "natural", which means the format most suited to the type of the variable. In the screenshot "phBasis" is a float, "measDSItemTab" is a pointer, "name" is a char* and "type" is some enumerated type. They are all shown with useful formatting. It would be much less helpful if they were all just shown in hex.

variables.png

Since "name" is a char*, when I expand it I see the char at the referenced location. Actually, "name" is pointing to a string. There are a couple of ways of seeing the whole string. One is to right-click on the variable and select Display As Array, but the easiest is just to highlight the variable and the string is shown in the lower half of the view - "msr.vsrc.1.an" in this case.

A possible reason you might be seeing variables in ASCII by default is if they are 8-bit integers and the underlying type is char. Then ASCII would be the "natural" format. I don't know what the best way to address this would be, but one thing that might help to know is that you can change the format of multiple things (e.g. all the elements of an array) at once by selecting them all (click then shift click, etc., in the usual way) then right-clicking and choosing a format.

1,827 Views
d_
Contributor I

Thanks Matthew.  I can try changing multiples.  (Thought I tried that once and it didn't work.  But I won't be on the hardware again until Monday.)

Regardless, anything unsigned should have ASCII as the natural format (IMO) and it's still a time suck to change formats for every debug session.

Thanks again.

Dave

0 Kudos
1,828 Views
BlackNight
NXP Employee
NXP Employee
0 Kudos
1,827 Views
d_
Contributor I

Hi Erich,

Thanks, that is very helpful and answers my 2nd question.  Obviously I'm new to Eclipse.

The 1st and 3rd questions are somewhat related and I suspect there's no way to do this.

To explain the 1st question, I can now set all my variables to hex.  But I might have an array that is ASCII.  I still don't see a way to set the entire array to ASCII.  And if it's a large array, it isn't practical to change all the elements of the array.

And of course the 3rd question is important when going in and out of debug.  Continually setting the variable formats each time I go into debug is an enormous time suck.

(The NI LabWindows IDE allows you to change format and it sticks from debug session to debug session.  The Microchip IDE allows you to add columns so you can view variables in multiple formats, hex, decimal, ASCII, etc.  Both of those are enormous productivity improvements.  Unfortunately, I've not seen any IDEs that handle this well.)

Dave

0 Kudos