I'd like to see all the asm produced by Visual Studio C++ to learn a bit about ASM, compilers, etc. I know with GCC, you can do it with the -S argument, but not in VS. How do I go about doing this?
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". Compile the program and use any third-party debugger. You can use OllyDbg or WinDbg for this.
Double-click the file named main. asm to open it in the editing window. (Visual Studio users may see a popup dialog asking for the encoding method used in the asm file. just click the OK button to continue.)
The __asm keyword invokes the inline assembler and can appear wherever a C or C++ statement is legal. It cannot appear by itself. It must be followed by an assembly instruction, a group of instructions enclosed in braces, or, at the very least, an empty pair of braces.
Right-click Project, Build customizations, tick "masm". Right-click the . asm file, Properties, change Item Type to "Microsoft Macro Assembler".
The easiest way to do this is to start your program in the integrated debugger, then turn on the assembly language view. This shows the assembly language interleaved with your original source code.
Back when I used VS, this was Alt+F7 or something but it's probably changed. The advantage of doing this (over using -S
equivalent) is you can focus on exactly which line(s) of code you're interested in.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With