简体   繁体   English

有没有办法在 Visual Studio 中查看编译器生成的代码?

[英]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.

相关问题 优化由Microsoft Visual Studio编译器生成的程序集 - Optimizing assembly generated by Microsoft Visual Studio Compiler 使用Visual Studio编译器以编程方式分析代码 - Analyzing code programmatically using Visual Studio compiler 如何在 Visual Studio Code 中包含编译器标志? - How to include compiler flags in Visual Studio Code? 如何为 WSL 和 Visual Studio 代码配置编译器 - How to configure compiler for WSL and visual studio code Visual Studio Code和Visual Studio使用相同的编译器吗? - Do Visual Studio Code and Visual Studio use the same compiler? 有什么方法可以让 Visual Studio 编译器为此 C++ 代码发出警告? - Is there any way to get the visual studio compiler to emit a warning for this C++ code? Visual Studio控件编辑器为Visual C ++生成的代码在哪里? - where is the code generated by visual studio controls editor for visual c++? 如何在Visual Studio中查看模板编译器错误详细信息 - How to view template compiler error details in Visual Studio 确定C ++编译器是否将以某种方式在Visual Studio中进行优化 - Determine whether a C++ compiler will optimize in a certain way in Visual Studio Visual Studio编译器? - visual studio compiler?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM