当前位置:  开发笔记 > IOS > 正文

XCode调试器:显示长字符串

如何解决《XCode调试器:显示长字符串》经验,为你挑选了1个好方法。

在XCode中调试程序时,我有几个CFStringRef变量指向长度在200个字符左右的字符串.

在调试器中,它只显示这些字符串的值达到一定长度,然后将它们省略.我真的很想看到字符串的全部价值.

有没有我可以配置的选项,所以它不会以任意长度终止它们?



1> Jason Coco..:

在调试控制台中,您可以通过执行以下操作来获取字符串值:

(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

poprint-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

poprint-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) 命令也是.

推荐阅读
臭小子
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有