如何静态转储在Cocoa应用程序中调用的所有ObjC方法? [英] How to statically dump all ObjC methods called in a Cocoa App?
问题描述
假设我有一个基于Cocoa的Mac或iOS应用程序。我想在我的应用程序的源代码 或上运行一个静态分析器来检索所有Objective-C方法的列表 strong>称为。是否有可以执行此操作的工具?
以下几点:
-
我在寻找一个静态解决方案。我不是在寻找动态解决方案。
-
可以对二进制或源代码运行的任何东西都是可以接受的。
-
理想情况下,输出只是一个重复的Objective-C方法列表,如:
...
- [MyClass foo]
...
+ [NSMutableString stringWithCapacity:]
...
- [NSString length]
...
$ p $如果其他类型的符号(C函数,静态变量等)存在,那么p>
(如果它不是去重的,那么很酷) -
我熟悉 class-dump ,但AFAIK会将二进制文件中声明的类转储,而不是二进制文件中的方法。这不是我想要的。如果我错了,您可以使用类别转储执行此操作,请更正我。
-
这是可行的。所以如果不是,这也是一个很好的答案。 :)
<
我最清楚的是 otx
,它是 otool
的一个包装,可以在objc_msgSend()调用站点重建选择器。
Assume I have a Cocoa-based Mac or iOS app. I'd like to run a static analyzer on my app's source code or my app's binary to retrieve a list of all Objective-C methods called therein. Is there a tool that can do this?
A few points:
I am looking for a static solution. I am not looking for a dynamic solution.
Something which can be run against either a binary or source code is acceptable.
Ideally the output would just be a massive de-duped list of Objective-C methods like:
… -[MyClass foo] … +[NSMutableString stringWithCapacity:] … -[NSString length] …
(If it's not de-duped that's cool)
If other types of symbols (C functions, static vars, etc) are present, that is fine.
I'm familiar with class-dump, but AFAIK, it dumps the declared Classes in your binary, not the called methods in your binary. That's not what I'm looking for. If I am wrong, and you can do this with class-dump, please correct me.
I'm not entirely sure this is feasible. So if it's not, that's a good answer too. :)
The closest I'm aware of is otx
, which is a wrapper around otool
and can reconstruct the selectors at objc_msgSend() call sites.
这篇关于如何静态转储在Cocoa应用程序中调用的所有ObjC方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!