在 CentOS 上做“反汇编”一般有几个常见场景:
下面按常用方式一步步说。
sudo yum install -y binutils gdb objdump readelf
可选(更强大):
sudo yum install -y capstone radare2
objdump -d ./test
objdump -S ./test
objdump -d ./test | grep -A 20 '<main>:'
或:
objdump -d --start-address=0x400520 --stop-address=0x400560 ./test
nm ./test
readelf -h ./test
readelf -S ./test
gdb ./test
disassemble
disassemble main
disassemble 0x400520, 0x400560
layout split
objdump -d my_module.ko
查看符号:
nm my_module.ko
objdump -M intel -d ./test
set disassembly-flavor intel
disassemble main
// test.c
int add(int a, int b) {
return a + b;
}
编译:
gcc -g -O0 test.c -o test
反汇编:
objdump -M intel -S ./test | grep -A 10 '<add>:'
如果你愿意,可以告诉我:
我可以直接给你针对性命令和例子。