assembly file

This is a discussion on assembly file within the C++ Programming forums, part of the General Programming Boards category; is there any way to see the assembly coded version of a c++ program in a compiler or are any ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    39

    assembly file

    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?

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    A compiler will make the c++ code into machine code. From there, a decompiler will turn it into assembly code.

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    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:
    Code:
    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
    -Prelude
    My best code is written with the delete key.

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    39

    ???

    so where can i find it and how to operate??
    once a kohatian,always a kohatian!

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >so where can i find it and how to operate??
    The compiler's documentation comes to mind.

    -Prelude
    My best code is written with the delete key.

  6. #6
    Registered User
    Join Date
    Jan 2002
    Posts
    39

    VC++

    well,i have VC++ 6.0.how to access the assembler file?
    once a kohatian,always a kohatian!

  7. #7
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    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.

  8. #8
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    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
    My best code is written with the delete key.

  9. #9
    Registered User
    Join Date
    Jan 2002
    Posts
    39

    thanxs!!!!

    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?
    once a kohatian,always a kohatian!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  2. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  4. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 09:57 AM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21