Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to see Objective-C ARC output?

In xcode, it's possible given some Objective-C code, to see the code it would output in Assembly.
Is it possible to see given ARC enabled code, to see the Objective-C that would be outputted by ARC?

like image 408
1dayitwillmake Avatar asked Dec 26 '22 00:12

1dayitwillmake


2 Answers

It is not possible, because ARC does not produce Objective-C code. ARC is a compiler feature that modifies the assembly produced in the same way that enabling optimizations might do. You can't tell the compiler to show you "optimized" C code; the optimizations are not applied at the level of C code. Likewise, you cannot ask to see the "ARC-ified" Objective-C, because the ARC memory management calls are not applied at the level of Objective-C code.

If you really want to see where the memory management calls are being made, you'll have to look at the assembly.

like image 177
BJ Homer Avatar answered Jan 16 '23 13:01

BJ Homer


ARC doesn't as such output Objective-C, it a phase of the compiler which alters the assembler/machine code the compiler produces - and as you noted you can see that in Xcode. However if you use a decompiler on the binary you should see a "MRC equivalent", which is as good as you'll get. Try Hopper - demo available, I've not used it myself, don't know the producers, etc. However it produces psuedo-code, which looks like structured assembly, not Objective-C. HTH.

like image 37
CRD Avatar answered Jan 16 '23 14:01

CRD