|
class_dump_z
class-dump-z — Extracting class interface for Objective-C version 2 ABI.
Download: http://networkpx.googlecode.com/files/class-dump-z_0.2-0.tar.gz .
Why a yet another class-dump?class-dump is a command-line tool to extract Objective-C class interfaces, written by Steve Nygard 17 years ago. The development however paused in 2007 at version 3.1.2, without support for the newest ABI. This caused the birth of class-dump-x by Holly Lee in 2008. But being a straight modified version of class-dump, it inherited some of the problems, e.g. the ivar offsets are calculated wrongly, properties are not supported, etc. I, using class-dump-x a lot for reverse engineering, finds that the ivar offset problem is hard to get over with. Having no answers a few months after a bug report, I decided to just fix the problem myself — hence class-dump-z is started. (While I was creating class-dump-z, the original class-dump development suddenly reactivated at July 1st. The newest version 3.2 does support 2.0 ABI now, but the ivar offset info is even worse than class-dump-x.) Why you don't want to use class-dump-zInstead of a generic-purpose class dumper, class-dump-z was written with iPhoneOS development in mind. Therefore, the following features will probably never be implemented:
Features10x the speed
class-dump-z is written from scratch using C++ avoiding using dynamic calls, unlike class-dump and class-dump-x which are written in Objective-C. Removing these unnecessary calls makes class-dump-z near 10 times faster than the precedences. Portable
Since class-dump-z is written in C++, it is very easy to port to other platforms. Currently Mac OS X 10.6, iPhoneOS 3.1, Linux (x86 and amd64) and Windows (≥XP) are officially supported. Correct ivar offsets
Generating ivar offsets by accumulation is a tricky business, due to alignments and bitfield packing. It is so tricky that the compiler will generate this info into the file. class-dump-z will read from that part of memory and give the most correct result. Struct name prettifying
class-dump-z will typedef structs and unions to the most presentable name with heuristics. This feature can be explicitly turned off with the -N switch. Stable name generation for anonymous structs
Ever tried to diff a library between two versions? You'll be frustrated by so many differences that are caused by a change of indices in anonymous structs. No more problem in class-dump-z — as long as the struct is having the same members, the generated name will be fixed. The name is computed by the CRC-32 checksum of the Objective-C type encoding of the struct. Properties
class-dump-z supports declared properties. Not only that, it supports every property attributes, including the undocumented ones. Moreover, it will hide the extra copy of getters/setters if a property is present. PropertizationSome libraries are written before the dot syntax was introduced or by some dot-syntax-haters, so you'll see a long list of getters/setters like -(void)setTitle:(id)title; -(id)title; -(void)setSubtitle:(id)subtitle; -(id)subtitle; ... I found it pretty annoying. In class-dump-z you can supply the -p switch to automatically convert them into @property(retain) id title; @property(retain) id subtitle; ... Hide inherited and delegate methods@interface UITableViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
int _tableViewStyle;
id _keyboardSupport;
}
@property(retain, nonatomic) UITableView* tableView;
// inherited: -(id)init;
-(id)initWithStyle:(int)style;
// inherited: -(void)dealloc;
-(id)existingTableView;
// declared property getter: -(id)tableView;
// declared property setter: -(void)setTableView:(id)view;
// inherited: -(void)loadView;
// inherited: -(void)viewWillAppear:(BOOL)view;
// inherited: -(void)viewWillDisappear:(BOOL)view;
// inherited: -(void)viewDidAppear:(BOOL)view;
-(void)setEditing:(BOOL)editing animated:(BOOL)animated;
-(void)_adjustTableForKeyboardInfo:(id)keyboardInfo;
// in a protocol: -(int)tableView:(id)view numberOfRowsInSection:(int)section;
// in a protocol: -(id)tableView:(id)view cellForRowAtIndexPath:(id)indexPath;
// in a protocol: -(void)tableView:(id)view willBeginEditingRowAtIndexPath:(id)indexPath;
// in a protocol: -(void)tableView:(id)view didEndEditingRowAtIndexPath:(id)indexPath;
@endMethod overloading in subclass is very common in OO design, but such information is useless when generating headers. Yet, by default a class dumper wouldn't know if an implementation is overloaded or a new method. If it's not useful, why not hide them? class-dump-z does that. Another class of useless information are those being implemented to adopt a protocol. class-dump-z can also filter them out. If you are running class-dump-z outside of the iPhoneOS, or you haven't installed the SDK, you have to tell class-dump-z where can the libraries be found by the -y switch. If you using using firmware 3.1, because all framework binaries are removed, hiding inherited methods from external frameworks won't work properly. Readable argument names
No more meaningless fpXX. class-dump-z will give a suitable name to each argument using Apple's coding style guide. Correct header generation
The headers generated by -H are not immediately usable because the imports usually points to non-existing .h files. There is even a page dedicated to fixing this problem. class-dump-z now will see which library the external class comes from, and tries to make up a better .h file location to import. Even with this change, headers generated by class-dump-z is generally not immediately usable either. This is usually because of name clash with Foundation and CoreFoundation objects. Most of the cases supplying the -X NS,CF flag to filter them out is enough to fix it. Miscellaneous features
What's missingThere are some features I don't find them immediately useful, so they are not supported yet. Sort by inheritance (-I flag), Recursive dumping (-r)These are not easy to implement and I find them not so useful so I left them out. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sign in to add a comment
This is FANTASTIC!
Much Appreciated. Keep up the good work.
-Max
Great tool. Thanks for your work!
Skomski
I love it!
Hi kenny I get garbage for a llot of methods in ChatKit?. example:
@interface mSMSSendButtonView : XXUnknownSuperclass { } -(BOOL)Îúíþ; -(void)Îúíþ; -(float)Îúíþ; @end @interface CKSimpleBalloonView : CKBalloonView { NSString* _text; } +(float)minimumBubbleHeight; +(float)heightForText:(id)text width:(float)width includeBuffers:(BOOL)buffers; +(BOOL)showsSubject; -(id)Îúíþ; -(id)Îúíþ; -(void)Îúíþ; -(void)setMessagePart:(id)part; -(void)setComposition:(id)composition; -(void)Îúíþ; -(void)Îúíþ; -(void)Îúíþ; -(CGRect)subjectBounds; -(CGRect)textBounds; -(void)Îúíþ; @endare you awareof it?