3

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);
Joel Coehoorn
  • 380,066
  • 110
  • 546
  • 781
dato datuashvili
  • 17,789
  • 59
  • 193
  • 310

2 Answers2

6

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
  • 5,849
  • 4
  • 34
  • 53
2

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,377
  • 6
  • 38
  • 69