views:

34

answers:

2

sorry id this question is not sensible just i am interesting i am using visual studio 2010 and suppose i have write some program can i make such that visual studio show me this code translated into assembly language? and if yes how do it? for example i have factorial program

int fact(int n){

if (n<=1)  return 1;
 return n*fact(n-1);

thanks very much

+1  A: 

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.
Stephen
@Stephen and @Marius thanks very much i have done
A: 

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

celavek