在 linux 上,我使用objdump -dS file
c 源代码显示反汇编。
在 mac OSX 上我otool
改用,但man otool
没有提到相应的选项。我的问题有什么解决办法吗?
这是我的c源:
➜ test cat b.c
#include <stdio.h>
int main(){
int i = 0;
return i+1;
}
➜ test gcc b.c -o b.out
我想显示b.out
's disassemble with source:
b.out:
(__TEXT,__text) section
_main:
0000000100000f80 pushq %rbp
0000000100000f81 movq %rsp, %rbp
0000000100000f84 movl $0x0, -0x4(%rbp)
source: i = 0;
0000000100000f8b movl $0x0, -0x8(%rbp)
source: return i+1;
0000000100000f92 movl -0x8(%rbp), %eax
0000000100000f95 addl $0x1, %eax
不幸的是,我只会拆卸。
➜ test otool -tV b.out
b.out:
(__TEXT,__text) section
_main:
0000000100000f80 pushq %rbp
0000000100000f81 movq %rsp, %rbp
0000000100000f84 movl $0x0, -0x4(%rbp)
0000000100000f8b movl $0x0, -0x8(%rbp)
0000000100000f92 movl -0x8(%rbp), %eax
0000000100000f95 addl $0x1, %eax
0000000100000f9a popq %rbp
0000000100000f9b ret