is there any way to see the assembly coded version of a c++ program in a compiler or are any utilities exist which convert c++ coded program to assembly language?
Printable View
is there any way to see the assembly coded version of a c++ program in a compiler or are any utilities exist which convert c++ coded program to assembly language?
A compiler will make the c++ code into machine code. From there, a decompiler will turn it into assembly code.
Most decent compilers will have a debug utility that supports disassembly. You can view the C/C++ code and then the assembly code that that makes it up, on my compiler the result is this:
-PreludeCode:1: #include <stdio.h>
2:
3: int main ( void )
4: {
00401020 push ebp
00401021 mov ebp,esp
00401023 sub esp,40h
00401026 push ebx
00401027 push esi
00401028 push edi
00401029 lea edi,[ebp-40h]
0040102C mov ecx,10h
00401031 mov eax,0CCCCCCCCh
00401036 rep stos dword ptr [edi]
5: printf ( "Hello, World!\n" );
00401038 push offset string "Hello, World!\n" (00420f7c)
0040103D call printf (00401150)
00401042 add esp,4
6: return 0;
00401045 xor eax,eax
7: }
00401047 pop edi
00401048 pop esi
00401049 pop ebx
0040104A add esp,40h
0040104D cmp ebp,esp
0040104F call __chkesp (00401110)
00401054 mov esp,ebp
00401056 pop ebp
00401057 ret
so where can i find it and how to operate??
>so where can i find it and how to operate??
The compiler's documentation comes to mind.
-Prelude
well,i have VC++ 6.0.how to access the assembler file?
You can use the debugger of VC++. It shows you the assembly code. You can choose "Start Debug" from the "Build" menu or press F5.
1) Select the "Build" option in the menu
2) Expand the "Start Debug" option
3) Select "Step Into"
4) In the debug control dialog there is a button with a magnifying glass over a window, the tool tip will say Disassembly. Click that and you're done.
-Prelude
one more thing.i am pretty well in mips assembly language.will i be able to convert that file to assembly easily for a very simple c++ code?