lldb Xcode:错误:'printf'不是有效的命令 [英] lldb Xcode: error: 'printf' is not a valid command

查看:141
本文介绍了lldb Xcode:错误:'printf'不是有效的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Xcode 4.3.3,并且想要设置符号端点.我为所有objc_msgSend符号创建了一个符号断点,并希望将其与调试器输出"结合使用.

I am using Xcode 4.3.3 and I want to set symbolic endpoints. I created a symbolic breakpoint for all objc_msgSend symbols and I wanted to combine it with a "Debugger output".

我遵循了这篇博文中的提示一个>.但是在我的调试器中,消息

I followed the tips of this post in SO. However in my debugger the message

错误:"printf"不是有效命令.

error: 'printf' is not a valid command.

出现.有什么线索吗?我希望为每个函数调用一条消息[Class method],以将其打印在调试器区域中.像这样

appears. Any clue? I want for every function call a message [Class method] to be printed in the debugger area. Like this

[UIApplication sharedApplication]
[UIApplication _isClassic]
[NSCFString getCString:maxLength:encoding:]
[UIApplication class]
[SLSMoleculeAppDelegate isSubclassOfClass:]
[SLSMoleculeAppDelegate initialize]

推荐答案

如果在断点设置中将debugr命令的前缀"expr-"作为前缀,则它可与lldb一起使用:

It works with lldb if you prefix "expr --" to the debugger command in the breakpoint settings:

expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) )

但是,该解决方案并不是完美的,因为调试器在每个输出之后都打印无结果":

The solution is not perfect however, because the debugger prints "no result" after each output:

[OS_xpc_dictionary, _xref_dispose]
<no result>
[NSObject, initialize]
<no result>
[OS_object, initialize]
<no result>

我没有发现任何东西可以抑制无结果"输出,这可能是不可能的,请参见此打开雷达.

I have found nothing to suppress the "no result" output, it may be that it is not possible, see this Open Radar.

这篇关于lldb Xcode:错误:'printf'不是有效的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆