如何做到这一点呢?

如果我想分析某些东西是如何编译的,我该如何获得发出的程序集代码?


当前回答

最近我想知道a中每个函数的组装,我是这样做的:

gcc main.c    // 'main.c' source file
gdb a.exe     // 'gdb a.out' in Linux

广东发展银行:

disass main   // Note here 'main' is a function
              // Similarly, it can be done for other functions.

其他回答

使用“-S”作为选项。它在终端中显示程序集输出。

使用-S开关:

g++ -S main.cpp

或者也可以用gcc:

gcc -S main.c

还有这个。

如果您正在寻找LLVM程序集:

llvm-gcc -emit-llvm -S hello.c

使用-S选项:

gcc -S program.c

最近我想知道a中每个函数的组装,我是这样做的:

gcc main.c    // 'main.c' source file
gdb a.exe     // 'gdb a.out' in Linux

广东发展银行:

disass main   // Note here 'main' is a function
              // Similarly, it can be done for other functions.