我使用的是 Xcode 4.3.3,我想设置符号端点。我为所有 objc_msgSend 符号创建了一个符号断点,我想将其与“调试器输出”结合起来。
我按照this post in SO的提示进行操作。但是在我的调试器中消息
error: 'printf' is not a valid command.
出现。有什么线索吗?我希望每个函数调用都会在调试器区域中打印一条消息 [Class method]。像这样
[UIApplication sharedApplication]
[UIApplication _isClassic]
[NSCFString getCString:maxLength:encoding:]
[UIApplication class]
[SLSMoleculeAppDelegate isSubclassOfClass:]
[SLSMoleculeAppDelegate initialize]
最佳答案
如果在断点设置中为调试器命令添加前缀“expr --”,它可以与 lldb 一起使用:
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) )
但是,该解决方案并不完美,因为调试器在每次输出后都会打印“无结果”:
[OS_xpc_dictionary, _xref_dispose]
<no result>
[NSObject, initialize]
<no result>
[OS_object, initialize]
<no result>
我没有发现任何东西可以抑制“无结果”输出,可能是不可能,参见this Open Radar .
关于ios - lldb Xcode : error: 'printf' is not a valid command,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12693237/