ICorDebug Interface

Provides methods that allow developers to debug applications in the common language runtime (CLR) environment.


Mixed-mode (managed and native code) debugging is not supported on Windows 95, Windows 98, or Windows ME, or on non-x86 platforms (such as IA64 and AMD64).

interface ICorDebug : IUnknown {
    HRESULT CanLaunchOrAttach (
        [in] DWORD                         dwProcessId,
        [in] BOOL                          win32DebuggingEnabled
    HRESULT CreateProcess (
        [in] LPCWSTR                       lpApplicationName,
        [in] LPWSTR                        lpCommandLine,
        [in] LPSECURITY_ATTRIBUTES         lpProcessAttributes,
        [in] LPSECURITY_ATTRIBUTES         lpThreadAttributes,
        [in] BOOL                          bInheritHandles,
        [in] DWORD                         dwCreationFlags,
        [in] PVOID                         lpEnvironment,
        [in] LPCWSTR                       lpCurrentDirectory,
        [in] LPSTARTUPINFOW                lpStartupInfo,
        [in] LPPROCESS_INFORMATION         pProcessInformation,
        [in] CorDebugCreateProcessFlags    debuggingFlags,
        [out] ICorDebugProcess             **ppProcess
    HRESULT DebugActiveProcess (
        [in] DWORD                         id,
        [in] BOOL                          win32Attach,
        [out] ICorDebugProcess             **ppProcess
    HRESULT EnumerateProcesses (
        [out] ICorDebugProcessEnum         **ppProcess
    HRESULT GetProcess (
                [in] DWORD dwProcessId,
        [out] ICorDebugProcess **ppProcess);

    HRESULT Initialize();
    HRESULT SetManagedHandler (
        [in] ICorDebugManagedCallback      *pCallback
    HRESULT SetUnmanagedHandler (
        [in] ICorDebugUnmanagedCallback    *pCallback
    HRESULT Terminate ();

Method Description

ICorDebug::CanLaunchOrAttach Method

Determines whether launching a new process or attaching to the given process is possible within the context of the current machine and runtime configuration.

ICorDebug::CreateProcess Method

Launches a process and its primary thread under the control of the debugger.

ICorDebug::DebugActiveProcess Method

Attaches the debugger to an existing process.

ICorDebug::EnumerateProcesses Method

Gets an enumerator for the processes that are being debugged.

ICorDebug::GetProcess Method

Returns the ICorDebugProcess Interface object with the given process ID.

ICorDebug::Initialize Method

Initializes the ICorDebug object.

ICorDebug::SetManagedHandler Method

Specifies the event handler object for managed events.

ICorDebug::SetUnmanagedHandler Method

Specifies the event handler object for unmanaged events.

ICorDebug::Terminate Method

Terminates the ICorDebug object.

ICorDebug represents an event processing loop for a debugger process. The debugger must wait for the ICorDebugManagedCallback::ExitProcess Method callback from all processes being debugged before releasing this interface.

The ICorDebug object is the initial object to control all further managed debugging. In the .NET Framework versions 1.0 and 1.1, this object was a CoClass object created from COM. In the .NET Framework version 2.0, this object is no longer a CoClass object. It must be created by the CreateDebuggingInterfaceFromVersion Function function, which is more version-aware. This new creation function enables clients to get a specific implementation of ICorDebug, which also emulates a specific version of the debugging API.

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: CorDebug.idl

Library: CorGuids.lib

.NET Framework Version: 2.0, 1.1, 1.0

Community Additions