What's the principle of class dump and hopper? Why can they dump out objc's method? And why can't they dump out the function that written in C style?
Asked
Active
Viewed 195 times
1 Answers
1
C functions in the binary are chunks of code each identified by virtual address. Objective-c runtime is implemented in C,so when a selector is sent a C function is called to actually do it:
id objc_msgSend(id self, SEL op, ...);
First argument is either class or instance that will receive the selector. Second is a selector
aka char*
name. Since those selector names are explicitly passed as arguments all of this needs to be handled in the executable binary. And that's where dumping classes kicks in because there's way more information compared to C functions virtual addresses.

Kamil.S
- 5,205
- 2
- 22
- 51