我可以在哪里找到我的程序的汇编代码,用于使用 UBUNTU 和 G++ 编译器为 gmp-5.0.0 im 编写的程序。编译代码的命令是“g++ test.cc -o outp -lgmp”
实际上我想知道在 1 和 0 方面内部发生了什么......内存分配将如何发生以及操作将如何在 RAW 位上执行!
GMP 包包含一个mpn\
文件夹,其中包含 GMP 的所有汇编代码。请在此处查看我的答案,但简而言之,所有 GMP 高级函数(如mpz_...
、mpq_...
和mpf_...
)都调用mpn_...
函数以对自然数进行运算。这些“低级”函数实际上调用了为大量平台(x86、ARM、sparcs、powerpcs 等)编写的高度优化的汇编代码,并且由 GMP Autotools 决定链接哪些特定代码( Autoconf 和 Automake) 系统根据您的目标平台。dir 中的代码mpn\
非常不言自明。
从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.
-S
您可以使用该标志获取生成的汇编语言。请记住,这将主要包含为您的代码生成的程序集,而不是为您使用的库函数等生成的代码。“主要”是因为它可以/将包含为您包含的标题中的内联函数生成的代码。
代码是用 C 语言编写的,因此您应该查看源代码,这将是理解汇编代码的第一步(通常理解“原始位”会发生什么就足够了)。反正有一些程序集内联
那么或许你能做的就是在gdb里面运行你的代码,使用disassemble
命令查看极少数特定和平代码的汇编代码,并尝试理解它们。