class-dump 是一个用于检查 Mach-O 文件中 Objective-C 段的 命令行实用程序。它会为类(class)、类别(category)和协议(protocol) 生成声明。这些信息与使用 'otool -ov' 获得的信息相同,但 以正常的 Objective-C 声明形式呈现。
最新版本和信息可在以下网址获取:
http://stevenygard.com/projects/class-dump
源代码也可从我的 Github 仓库获取:
https://github.com/nygard/class-dump
class-dump 3.5 (64 bit)
Usage: class-dump [options] <mach-o-file>
where options are:
-a show instance variable offsets
-A show implementation addresses
--arch <arch> choose a specific architecture from a universal binary (ppc, ppc64, i386, x86_64)
-C <regex> only display classes matching regular expression
-f <str> find string in method name
-H generate header files in current directory, or directory specified with -o
-I sort classes, categories, and protocols by inheritance (overrides -s)
-o <dir> output directory used for -H
-r recursively expand frameworks and fixed VM shared libraries
-s sort classes and categories by name
-S sort methods by name
-t suppress header in output, for testing
--list-arches list the arches in the file, then exit
--sdk-ios specify iOS SDK version (will look in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS<version>.sdk
--sdk-mac specify Mac OS X version (will look in /Developer/SDKs/MacOSX<version>.sdk
--sdk-root specify the full SDK root path (or use --sdk-ios/--sdk-mac for a shortcut)
对 AppKit 执行 class-dump:
class-dump /System/Library/Frameworks/AppKit.framework
对 UIKit 执行 class-dump:
class-dump /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System/Library/Frameworks/UIKit.framework
对 UIKit(及其使用的所有框架)执行 class-dump:
class-dump /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System/Library/Frameworks/UIKit.framework -r --sdk-ios 4.3
当开发工具安装在 /Dev42(而非 /Developer)时,对 UIKit(及其使用的所有框架)执行 class-dump:
class-dump /Dev42/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework -r --sdk-root /Dev42/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk
本文件是 class-dump 的一部分,class-dump 是一个用于检查 Mach-O 文件中 Objective-C 段的实用程序。 Copyright (C) 1997-2019 Steve Nygard。
本程序为自由软件;您可以依据自由软件基金会所发表的 GNU 通用公共许可证的条款,对本程序进行再发布及/或修改; 无论您依据本许可证的第二版或 (按您的选择)任何更新版本。
本程序之所以发布,是希望它有用, 但没有任何担保;甚至没有适销性或 特定用途适用性的隐含担保。 详情请参阅 GNU 通用公共许可证。
您应该已经随本程序收到一份 GNU 通用公共许可证的副本; 如果没有,请写信给 Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA。
您可以通过以下方式联系作者: 电子邮件: nygard at gmail.com