共用方式為


IDebugCodeContext2

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

This interface represents the starting position of a code instruction. For most run-time architectures today, a code context can be thought of as an address in a program's execution stream.

Syntax

IDebugCodeContext2 : IDebugMemoryContext2

Notes for Implementers

The debug engine implements this interface to relate the position of a code instruction to a document position.

Notes for Callers

Methods on many interfaces return this interface, most typically, GetCodeContext. It is also used extensively with the IDebugDisassemblyStream2 interface as well as in breakpoint resolution information.

Methods in Vtable Order

In addition to the methods on the IDebugMemoryContext2 interface, this interface implements the following methods:

Method Description
GetDocumentContext Gets the document context that corresponds to the active code context.
GetLanguageInfo Gets the language information for this code context.

Remarks

The key difference between an IDebugCodeContext2 interface and an IDebugMemoryContext2 interface is that an IDebugCodeContext2 is always instruction-aligned. This means that an IDebugCodeContext2 is always pointing to the beginning of an instruction, whereas an IDebugMemoryContext2 may point to any byte of memory in the run-time architecture. IDebugCodeContext2 is incremented by instructions rather than by the basic storage size (typically byte).

Requirements

Header: msdbg.h

Namespace: Microsoft.VisualStudio.Debugger.Interop

Assembly: Microsoft.VisualStudio.Debugger.Interop.dll

See also