在iPhone上记录objc_msgSend() [英] Logging objc_msgSend() on iPhone

查看:64
本文介绍了在iPhone上记录objc_msgSend()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到了一个问题,谷歌没有解决方案。我想将应用程序的Objective-C消息记录到控制台或文件。我没有编写应用程序,所以我没有源代码重新编译包含日志记录。我有一个越狱iPhone,所以没有限制如何实现这一点。我甚至考虑通过MobileSubstrate扩展来做这个事情(我可以​​钩住该应用程序的objc_msgSend来做一些日志记录?),但是没有太多的想法。你可以帮助我吗?

解决方案

有一个记录机制的ObjC消息,但我不知道是否你将获得没有符号文件的方法名称。假设您的越狱手机将允许您在调试器(gdb)的控制下运行任何应用程序,您应该可以启动应用程序,在初始化期间提前设置断点,然后执行以下操作:

 (gdb)call(void)instrumentObjcMessageSends(YES)

日志文件将被写入tmp文件夹中的文本文件。更多细节:



http://www.dribin.org/dave/blog/archives/2006/04/22/tracing_objc/


I recently ran into a problem for which there were no working solutions on Google. I'd like to log an applications's Objective-C messages to the console or to a file. I didn't write the application so I don't have the source code to recompile with logging included. I have a jailbroken iPhone so no restrictions on how to realize this. I even considered doing this through a MobileSubstrate extension (may I hook objc_msgSend for that application to do some logging?), but had not very much ideas. Can you please help me out with this?

解决方案

There is a logging mechanism for ObjC messages, but I'm not sure whether you'll get method names without symbol files. Assuming that your jailbroken phone will allow you to run any app under control of the debugger (gdb), you should be able to start the app, set a breakpoint early during the initialization, then do this:

(gdb) call (void)instrumentObjcMessageSends(YES)

The log file will be written to a text file in the tmp folder. More details here:

http://www.dribin.org/dave/blog/archives/2006/04/22/tracing_objc/

这篇关于在iPhone上记录objc_msgSend()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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