tags:

views:

19

answers:

3

Hello,

Is it possible to see strings that use 16 bits chars in Xcode debugger? I use a custom string class, not NSString. The strings are NULL terminated. The only way I can see the strings is if I see them as memory, but they are hard to read.

Thank you!

A: 

Use Data Formatting in the XCode debugger

Mark
There is no option to see a variable as multi-byte char. I can already view the string as unsigned short*, but I want to view it as a normal NULL terminated string
Felics
you could call a function on the string to make it displayable
Mark
A: 

You'll need to write a data formatter bundle -- just writing the data formatter expressions inside the debugger isn't enough. Viewing strings in the Xcode debugger is a black art. Even once you've written the data formatter bundle, be prepared for them not to work at least 50% of the time. We've been fighting this issue for about 5 years now. Most of the time the debugger will tell you the variable is no longer in scope when it really is, and you'll still need to drill down into the members to view the raw memory anyway.

Something that may make it easier (I haven't tried this) is to write a method in the class that returns an NSString and then you may be able to get the data formatter expressions to display something useful.

the_mandrill
A: 

For custom classes I always found it helpful to implement description and debugDescription methods. Maybe this approach will be sufficient in your case too.

Steam Trout