tags:

views:

48

answers:

4

Where i can find ASSEMBLY code for my program written for gmp-5.0.0 im using UBUNTU and G++ compiler.. command for compiling the code is "g++ test.cc -o outp -lgmp"

actually i want to know what happens internally in terms of 1's and 0's... how the memory allocation will takes place and how the operations will performed on RAW bits!!

A: 

You can use objdump1 to disassemble your libgmp. It won't be interesting.

(And the disassembly of your code mostly just include a call to the libgmp function which won't reveal "what happens internally" unless you disassemble libgmp as well.)

Perhaps you want to read the source code2 instead?

KennyTM
+1  A: 

From the gcc(1) man page:

   -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.
Ignacio Vazquez-Abrams
+1  A: 

You can get the generated assembly language using the -S flag. Keep in mind that this will mostly contain the assembly generated for your code, not the generated code for things like library functions you use. The "mostly" is because it can/will include code generated for inline functions in headers you've included.

Jerry Coffin
+1  A: 

The code is written in C so you should look at the source code this will be a first step to understand the assembly code (usually it is enough to understand what happen with "raw bits"). There is some assembly inlined anyway

Then maybe what you could do is to run your code inside gdb and use the disassemble command to see the assembly code of a very few and specific peace of code and try to understand them.

Ben