共用方式為


IDebugThread2

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 a thread running in a program.

Syntax

IDebugThread2 : IUnknown

Notes for Implementers

The debug engine (DE) implements this interface to represent a thread of execution in a single program.

Notes for Callers

Call GetThread to obtain this interface representing the currently active thread.

This interface is also used in creating a breakpoint request (see BP_REQUEST_INFO).

This interface is also returned when resolving a bound or error breakpoint (see BP_RESOLUTION_INFO and BP_ERROR_RESOLUTION_INFO).

Methods in Vtable Order

The following table shows the methods of IDebugThread2.

Method Description
EnumFrameInfo Retrieves a list of the stack frames for this thread.
GetName Gets the name of the thread.
SetThreadName Sets the name of the thread.
GetProgram Gets the program in which a thread is running.
CanSetNextStatement Determines whether the next statement can be set to the given stack frame and code context.
SetNextStatement Sets the next statement to the given stack frame and code context.
GetThreadId Gets the system thread identifier.
Suspend Suspends a thread.
Resume Resumes a thread.
GetThreadProperties Gets properties that describe a thread.
GetLogicalThread Gets the logical thread associated with this physical thread.

Remarks

Because a single physical thread can run in multiple programs, more than one IDebugThread2 from more than one program can represent the same physical thread.

When a breakpoint or exception occurs, an event is sent by calling Event. One of the arguments to this method is an IDebugThread2 interface representing the current thread. EnumFrameInfo is used to obtain the IDebugStackFrame2 interface for the current stack frame.

Requirements

Header: msdbg.h

Namespace: Microsoft.VisualStudio.Debugger.Interop

Assembly: Microsoft.VisualStudio.Debugger.Interop.dll

See also