DebuggableAttribute.DebuggingModes 枚举

定义

指定实时 (JIT) 编译器的调试模式。Specifies the debugging mode for the just-in-time (JIT) compiler.

此枚举有一个 FlagsAttribute 属性,允许按位组合成员值。

public: enum class DebuggableAttribute::DebuggingModes
[System.Flags]
[System.Runtime.InteropServices.ComVisible(true)]
public enum DebuggableAttribute.DebuggingModes
type DebuggableAttribute.DebuggingModes = 
Public Enum DebuggableAttribute.DebuggingModes
继承
DebuggableAttribute.DebuggingModes
属性

字段

Default 1

指示实时 (JIT) 编译器使用其默认行为,包括启用优化、禁用“编辑并继续”支持以及使用符号存储区序列点(如果存在)。Instructs the just-in-time (JIT) compiler to use its default behavior, which includes enabling optimizations, disabling Edit and Continue support, and using symbol store sequence points if present. 从 .NET Framework 2.0 版本开始,始终生成 JIT 跟踪信息,即方法中相对于本机代码偏移量的 Microsoft 中间语言 (MSIL) 偏移量。Starting with the .NET Framework version 2.0, JIT tracking information, the Microsoft intermediate language (MSIL) offset to the native-code offset within a method, is always generated.

DisableOptimizations 256

禁用编译器为使输出文件更小、更快、更有效而执行的优化。Disable optimizations performed by the compiler to make your output file smaller, faster, and more efficient. 优化会导致输出文件中的代码重排,这会增加调试的难度。Optimizations result in code rearrangement in the output file, which can make debugging difficult. 通常在调试时应禁用优化。Typically optimization should be disabled while debugging. 在 2.0 或更高版本中,将这个值与 Default (Default | DisableOptimizations) 组合在一起可启用 JIT 跟踪和禁用优化。In versions 2.0 or later, combine this value with Default (Default | DisableOptimizations) to enable JIT tracking and disable optimizations.

EnableEditAndContinue 4

启用“编辑并继续”。Enable edit and continue. 借助“编辑并继续”,你可以在程序处于中断模式时对源代码进行更改。Edit and continue enables you to make changes to your source code while your program is in break mode. “编辑并继续”的能力取决于编译器。The ability to edit and continue is compiler dependent.

IgnoreSymbolStoreSequencePoints 2

使用隐式 MSIL 序列点,而非程序数据库 (PDB) 序列点。Use the implicit MSIL sequence points, not the program database (PDB) sequence points. 符号信息中的每个源行通常至少包含一个 Microsoft 中间语言 (MSIL) 偏移量。The symbolic information normally includes at least one Microsoft intermediate language (MSIL) offset for each source line. 当实时 (JIT) 编译器要编译方法时,它会请求分析服务提供应保留的 MSIL 偏移量列表。When the just-in-time (JIT) compiler is about to compile a method, it asks the profiling services for a list of MSIL offsets that should be preserved. 这些 MSIL 偏移量称为序列点。These MSIL offsets are called sequence points.

None 0

从 .NET Framework 2.0 版本开始,始终生成 JIT 跟踪信息,并且此标志与 Default 具有相同效果,将 IsJITTrackingEnabled 属性设置为 false 除外。Starting with the .NET Framework version 2.0, JIT tracking information is always generated, and this flag has the same effect as Default, except that it sets the IsJITTrackingEnabled property to false. 但是,由于始终启用 JIT 跟踪,所以在版本 2.0 或更高版本中将忽略此属性值。However, because JIT tracking is always enabled, the property value is ignored in version 2.0 or later.

请注意,与 DisableOptimizations 标志不同,None 标志不能用于禁用 JIT 优化。Note that, unlike the DisableOptimizations flag, the None flag cannot be used to disable JIT optimizations.

注解

DebuggableAttribute.DebuggingModes枚举指定运行时如何跟踪在代码生成过程中对调试器重要的信息。The DebuggableAttribute.DebuggingModes enumeration specifies how the runtime is to track information important to the debugger during code generation. 此信息有助于调试器提供丰富的调试体验。This information helps the debugger provide a rich debugging experience. 与 .NET Framework 版本1.1 不同, 版本2.0 或更高版本不允许通过实时 (JIT) 编译器关闭跟踪。Unlike the .NET Framework version 1.1, versions 2.0 or later do not allow you to turn off tracking by the just-in-time (JIT) compiler. 始终为可调试文件启用 JIT 跟踪。JIT tracking is always enabled for debuggable files. 在版本2.0 及更高版本中, 枚举值具有以下效果:In version 2.0 and later, the enumeration values have the following effect.

调试模式Debugging mode 结果Result
NoneNone 启用跟踪, 启用 JIT 优化Tracking on, JIT optimizations enabled
默认Default 启用跟踪, 启用 JIT 优化Tracking on, JIT optimizations enabled
DisableOptimizationsDisableOptimizations 启用跟踪, 启用 JIT 优化Tracking on, JIT optimizations enabled
默认| DisableOptimizationsDefault | DisableOptimizations 启用跟踪, 禁用 JIT 优化Tracking on, JIT optimizations disabled

序列点用于指示 Microsoft 中间语言 (MSIL) 代码中调试器用户预期能够唯一引用的位置, 例如用于设置断点的位置。Sequence points are used to indicate locations in the Microsoft intermediate language (MSIL) code that a debugger user expects to be able to refer to uniquely, such as for setting a breakpoint. JIT 编译器确保它不会将两个不同序列点上的 MSIL 编译成单个本机指令。The JIT compiler ensures it does not compile the MSIL at two different sequence points into a single native instruction. 默认情况下, JIT 编译器检查程序数据库 (PDB) 文件中的符号存储区以获取其他序列点的列表。By default, the JIT compiler examines the symbol store in the program database (PDB) file for a list of additional sequence points. 但是, 加载 PDB 文件要求文件可用且对性能产生负面影响。However, loading the PDB file requires that the file be available and has a negative performance impact. 从版本2.0 开始, 编译器可以通过使用 msilnop"的说明在 msil 代码流中发出 "隐式序列点"。Starting with version 2.0, compilers can emit "implicit sequence points" in the MSIL code stream through the use of MSIL "nop" instructions. 此类编译器应设置IgnoreSymbolStoreSequencePoints标志以通知公共语言运行时不加载 PDB 文件。Such compilers should set the IgnoreSymbolStoreSequencePoints flag to notify the common language runtime to not load the PDB file.

备注

此枚举主要由语言开发人员使用。This enumeration is primarily used by language developers. 它通常不在应用程序开发中使用。It is generally not used in application development. 开发环境基于DebuggableAttribute.DebuggingModes编译器参数 (例如 /debug/optimize) 使用。Development environments use DebuggableAttribute.DebuggingModes based on compiler parameters such as /debug and /optimize.

适用于