locked
Disassembly display in Visual Studio

    Question

  • I'm using VS  2010 Express and I'm trying to get my compiled source code to be displayed in assembly. I could easily do this when using VS 6 but can't see how to do this in VS 2010. I want to see each line of my source code with the coresponding assembly line below it. For example:

    ++x;                                        // source code

    mov ax, [0b3456743];               // assembly representation

    inc ax;

    mov [0b3456743], ax;

     

    Thank you for any help!

     

    Friday, December 17, 2010 7:06 PM

Answers

  • I am not sure if this works in VS 2010 Express, but you can have the compiler output assembler output with Assembly, Machine Code, and Source:

    1.) Right click on the Project Name in the Solution Explorer.

    2.) Click on the "Properties" menu item.

    3.) Navigate to "Configuration Properties -> C/C++ -> Output Files".

    4.) Set the "Assembler Output" to "Assembly, Machine Code and Source (/FAcs)"

    5.) Make sure the "ASM List Location" is set (my system defaulted to "$(IntDir)").


    If the above options are not available, then try adding the following to the "Additional Options" under "Configuration Properties -> C/C++ -> Command Line":

    /FAcs /Fa"Debug\"

     

    The listing files will have an extension of .cod

     

    For more information see the following MSDN library page:

    http://msdn.microsoft.com/en-us/library/367y26c6.aspx

     

    NOTE: The file is pretty big, I would recommend searching for a comment that is near the code you are wanting to investigate.


    David Cravey
    • Marked as answer by MandrewP Saturday, December 18, 2010 3:29 PM
    Saturday, December 18, 2010 7:42 AM

All replies

  • While debugging, go to Debug->Windows->Disassembly. The shortcut for this on my system is Ctrl+Alt+D.

    Friday, December 17, 2010 7:38 PM
  • While debugging, go to Debug->Windows->Disassembly. The shortcut for this on my system is Ctrl+Alt+D.


    Thanks for your reply, but I tried that and there is no window for disassembly. Are you using Visual Studio 2010 Express? I wonder if the express edition has that feature. The way you stated worked on VS 6 (introductory edition) but not with VS 2010.
    Friday, December 17, 2010 8:09 PM
  • I am not sure if this works in VS 2010 Express, but you can have the compiler output assembler output with Assembly, Machine Code, and Source:

    1.) Right click on the Project Name in the Solution Explorer.

    2.) Click on the "Properties" menu item.

    3.) Navigate to "Configuration Properties -> C/C++ -> Output Files".

    4.) Set the "Assembler Output" to "Assembly, Machine Code and Source (/FAcs)"

    5.) Make sure the "ASM List Location" is set (my system defaulted to "$(IntDir)").


    If the above options are not available, then try adding the following to the "Additional Options" under "Configuration Properties -> C/C++ -> Command Line":

    /FAcs /Fa"Debug\"

     

    The listing files will have an extension of .cod

     

    For more information see the following MSDN library page:

    http://msdn.microsoft.com/en-us/library/367y26c6.aspx

     

    NOTE: The file is pretty big, I would recommend searching for a comment that is near the code you are wanting to investigate.


    David Cravey
    • Marked as answer by MandrewP Saturday, December 18, 2010 3:29 PM
    Saturday, December 18, 2010 7:42 AM
  • Thanks David! That was it. And thanks for pointing out the .cod extention. Your a gentelman and a scholar.

    Saturday, December 18, 2010 3:37 PM
  • Can you please help me because I have the same problem. I made all the settings listed but do not know where to find the .cod listing files

    Sunday, October 14, 2012 8:45 AM
  • I made all the settings listed but do not know where to find the .cod listing files

    In the same project directory as where the .obj files are created.

    Note that the extension isn't always .cod - as described
    in the documentation it may be .asm, depending on which
    option you used.

    - Wayne

    Sunday, October 14, 2012 5:05 PM
  • sorry but I am not understanding at all where are these files. 

    Thursday, October 18, 2012 8:06 PM
  • Enable Expert settings in VS 2010 Express. Tools > Settings > Expert settings. Then, new window types appear under Debug > Windows (for example, Disassembly).
    Friday, January 04, 2013 11:24 AM