Personal Original, reprint please indicate source:Cnblogs.com/jailbreaker
OBJC is a completely object-oriented language, so the inverse focus is on the reverse class, which uses Ida's magical F5 function to reverse the creation of an object.
We look directly at the reverse arm code of the Main method in Ida:
Basically, we use Ida's F5 analysis to derive the pseudo-code of C syntax as follows:
I've turned off the automatic memory management arc in the source code to make it cleaner.
In 8, 9 rows are seen Objc_msgsend, this objc_msgsend is actually compiler generated code, in the source, OBJC call instance method is actually dynamic through message delivery, only in runtime to determine which method to deal with, This means that the function address cannot be determined at all during compilation.
The Objc_msgsend function includes at least 2 parameters, the first parameter type is the ID, which is the generic class, can pass any class, and the 2nd parameter type is Sel,selector, which temporarily understands the literal declaration of method, Later in the post will be described in detail selector. The parameters that follow the beginning of the 3rd are the specific parameters required by the Sel method, and in this case there are only 2 parameters.
Finally, take a look at main source code:
[iOS reverse combat four] create OBJC objects