[英]Is there a way to view compiler generated code in Visual Studio?
Is there a way to view C++ compiler generated code in Visual Studio?有没有办法在 Visual Studio 中查看 C++ 编译器生成的代码? What I mean by generated code is: compiler generated functions, function call transformations, casts during polymorphic behavior etc. and not assembly language
我所说的生成代码的意思是:编译器生成的函数、function 调用转换、多态行为期间的强制转换等,而不是汇编语言
If you want to see the generated assembly code (and/or machine code), you can select this in the properties, either per-project or per-source file.如果您想查看生成的汇编代码(和/或机器代码),您可以在每个项目或每个源文件的属性中 select 这个。 Various levels of detail are available.
可以使用各种级别的详细信息。
Right click the project or source file in the Solution Explorer, select the "Properties" command and then, in the "C/C++" tab, select which type (if any) of assembler output you want:右键单击解决方案资源管理器中的项目或源文件,select 的“属性”命令,然后在“C/C++”选项卡中,select 您想要哪种类型(如果有)的汇编程序 Z78E6221F6393D1356668
If you select any type of output, a file (or files) with the source(s) name(s) and the ".asm" extension will be generated in the project's "Intermediate" directory (where the ".obj" files are placed) by default, but this folder can be changed using the "ASM List Location" property.如果您 select 任何类型的 output,将在项目的“中间”目录(其中“.obj”文件位于放置)默认情况下,但可以使用“ASM 列表位置”属性更改此文件夹。
Depending on what you mean by 'generated code' you will sometimes see files in the build directories (x64\Debug for example), for example the #using directive will generate.tlh and.tli files that then get incorporated into the build.根据您所说的“生成的代码”的含义,您有时会在构建目录中看到文件(例如 x64\Debug),例如,#using 指令将生成.tlh 和.tli 文件,然后将这些文件合并到构建中。
(From a comment) I had not been aware of this but it is also possible to have MSVC directly output generated assembly using the /Fa compiler option. (来自评论)我没有意识到这一点,但也可以让 MSVC 直接使用 /Fa 编译器选项 output 生成程序集。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.