Xcode debugger: display long strings Xcode debugger: display long strings xcode xcode

Xcode debugger: display long strings


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.


To display really long string use method from print long string in xcode 6 debugging console

  1. In lldb console increase max-string-summary-length
setting set target.max-string-summary-length 10000
  1. Print your string with print or po commands
print my_string


If you are compiling c++ project in xcode just use this command

po string_name