在XCode中调试程序时,我有几个CFStringRef
变量指向长度在200个字符左右的字符串.
在调试器中,它只显示这些字符串的值达到一定长度,然后将它们省略.我真的很想看到字符串的全部价值.
有没有我可以配置的选项,所以它不会以任意长度终止它们?
在调试控制台中,您可以通过执行以下操作来获取字符串值:
(gdb) print (void)CFShow(myCFString)
要么:
(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
po
print-object
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.
(gdb) print (const char *)[[theObject debugDescription] UTF8String]
This is really useful for examining things like NSData
is a shortcut for (gdb) print (void)CFShow(myCFString)
and is the same as print except for Objective-C objects. It basically functions like this:
(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
po
print-object
(gdb) print (const char *)[[theObject debugDescription] UTF8String]
This is really useful for examining things like NSData
object and NSArray/NSDictionary objects.
(gdb) print (void)CFShow(myCFString)
命令也是.