2010-01-31 177 views
1

在哪里可以找到我的使用Ubuntu和G ++编译器GMP-5.0.0 IM程序编写汇编代码.. 命令为 “g ++ test.cc -o OUTP -lgmp”GMP-汇编代码?编译代码

实际我想知道1和0的内部会发生什么...... 内存分配将如何发生以及操作如何在RAW位上执行!

回答

0

您可以使用objdump1来反汇编您的libgmp。这不会有趣。

(和你的代码的反汇编大多只是包括对libgmp函数的调用,不会透露“什么内部发生”除非你拆开libgmp为好。)

也许你想读的源代码2取而代之?

1

gcc(1)手册页:

-save-temps 
     Store the usual "temporary" intermediate files permanently; place 
     them in the current directory and name them based on the source 
     file. Thus, compiling foo.c with -c -save-temps would produce 
     files foo.i and foo.s, as well as foo.o. This creates a 
     preprocessed foo.i output file even though the compiler now 
     normally uses an integrated preprocessor. 
1

你可以使用-S标志生成的汇编语言。请记住,这将主要包含为您的代码生成的程序集,而不是您使用的库函数等生成的代码。 “主要”是因为它可以/将包含为包含的头文件中的内联函数生成的代码。

0

代码是用C编写的,所以你应该看看源代码,这将是理解汇编代码的第一步(通常足以理解“raw bits”发生了什么)。有一些程序集内联

然后,也许你可以做的是在gdb中运行你的代码,并使用disassemble命令来查看代码的少数和特定和平的汇编代码并试图理解它们。