views:

2010

answers:

1

While debugging a program in XCode I have several CFStringRef variables that point to strings with lengths around the 200 character mark.

In the debugger, it only shows the value of these strings up to a certain length and then just ellipses them away. I'd really like to see the full value of the strings.

Is there some option I can configure so it doesn't terminate them at arbitrary length?

+6  A: 

In the debugging console you can get the string value by doing something like:

(gdb) print (void)CFShow(myCFString)

or:

(gdb) po (NSString*)myCFString

Either of those will display the entire string's contents to the debugging console. It's probably the easiest way to deal with large, variable-length strings or data structures of any kind.

For more information, the print command in the debugger basically dumps some data structure to the console. You can also call any functions or whatever, but since print doesn't have access to the function declarations, you have to make sure you provide them implicitly (as shown in the example above), or the print command will complain.

po is a shortcut for print-object and is the same as print except for Objective-C objects. It basically functions like this:

(gdb) print (const char *)[[theObject debugDescription] UTF8String]

This is really useful for examining things like NSData object and NSArray/NSDictionary objects.

For a lot more information on debugging topics, see Technical Note TN2124 - Mac OS X Debugging Magic and (from the debugger console) you can issue the help command as well.

Jason Coco
Thanks. Kind of lame that this is not built into the XCode views, but at least I can see what I'm looking at now.
bmoeskau