Pages

Friday, August 13, 2010

Snow Leopard. Terminal. The simplest dissamler

otool is a nice tool showing the dependencies and disassembly listing:
For example, otool -L /bin/pwd:

otool with -h shows the file header:

and otool -tv /bin/ls > ~/Desktop/ls.txt will make a text file on the desktop with the code of the ls.


/bin/ls:
(__TEXT,__text) section
0000000100001478 pushq $0x00
000000010000147a movq %rsp,%rbp
000000010000147d andq $0xf0,%rsp
0000000100001481 movq 0x08(%rbp),%rdi
0000000100001485 leaq    0x10(%rbp),%rsi
0000000100001489 movl %edi,%edx
000000010000148b addl   $0x01,%edx
000000010000148e shll     $0x03,%edx

And dtrace that requires the sudo password allows to trace. But this is a much more complicated story.

No comments:

Post a Comment