5

I am using Visual Studio 2010 and suppose I have to write some program. Can I make it such that Visual Studio shows me this code translated into assembly language?

And if yes how do I do it? For example, I have a factorial program:

int fact(int n) {
    if (n<=1)  
        return 1;
    return n*fact(n-1);
  }
Cylian
  • 10,970
  • 4
  • 42
  • 55

2 Answers2

9

See the answers to this question:

There are several approaches:

  1. You can normally see assembly code while debugging C++ in visual studio (and eclipse too). For this in Visual Studio put a breakpoint on code in question and when debugger hits it rigth click and find "Go To Assembly" ( or press CTRL+ALT+D )
  2. Second approach is to generate assembly listings while compiling. For this go to project settings -> C/C++ -> Output Files -> ASM List Location and fill in file name. Also select "Assembly Output" to "Assembly With Source Code".
  3. Compile the program and use any third-party debugger. You can use OllyDbg or WinDbg for this. Also you can use IDA (interactive disassembler). But this is hardcore way of doing it.
Community
  • 1
  • 1
Stephen
  • 6,027
  • 4
  • 37
  • 55
4

Put a breakpoint into your factorial function, start debugging, go to Call Stack window, right click on your function, select Go To Disassembly

celavek
  • 5,575
  • 6
  • 41
  • 69