Stack Overflow Asked on November 12, 2021
When I run my code (any code), in debug mode I have the option of "Disassembly".
I know that "Disassembly" is the creation of assembly code from machine code (‘1’ and ‘0’ that stored in object files).
So, I can assume that when I compile my code in Visual Studio, there is no "Assembly/Assembler" stage between the C/C++ code to the machine code/object file, and if I want to see the Assembly code I need to ask Visual Studio to disassemble it from object file to assembly.
So my questions are:
am I right, is there no way to see asm other than disassembly?
(if 1 is no): why does Visual Studio’s debugger show a "Disassembly" option, not "Assembly"?
Does Clang/GCC have an assembly stage, or does the C/C++ code compile to object code directly?
editor’s note: the answer to 3 actually differs for GCC vs. most other mainstream C/C++ compilers like clang/LLVM and MSVC. Since that’s kind of a separate question from how MSVC works, that part is a duplicate of these other SO Q&As:
When a debugger provides a disassembly option, it is generally examining memory of the running process, augmented by debugging information embedded in or associated with the executable file, which can include references that help the debugger identify associated source code.
Separately, compilers usually have an option to show you the assembly language that is either the assembly language they use internally (perhaps in temporary files passed to specific subprocesses, such as an assembler) or its equivalent (what it would generate if it were not generating object code directly). For GCC and Clang, the -S
switch does this. For Visual Studio, /FA
does this.
Answered by Eric Postpischil on November 12, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP