IDebugPendingBreakpoint2::Virtualize

切换此挂起断点的虚拟化状态。 虚拟化挂起的断点时,调试引擎会在每次将新代码加载到程序中时尝试绑定它。

语法

HRESULT Virtualize(
    BOOL fVirtualize
);
int Virtualize(
    int fVirtualize
);

参数

fVirtualize
[in]设置为非零(TRUE)以虚拟化挂起的断点,或设置为零(FALSE)以关闭虚拟化。

返回值

如果成功,则返回 S_OK;否则,返回错误代码。 返回 E_BP_DELETED 是否已删除断点。

备注

每次加载代码时,都会绑定虚拟化断点。

示例

以下示例演示如何为公开 IDebugPendingBreakpoint2 接口的简单CPendingBreakpoint对象实现此方法。

HRESULT CPendingBreakpoint::Virtualize(BOOL fVirtualize)
{
    HRESULT hr;

    // Verify that the pending breakpoint has not been deleted. If deleted,
    // then return hr = E_BP_DELETED.
    if (m_state.state != PBPS_DELETED)
    {
        if (fVirtualize)
        {
            // Set the PBPSF_VIRTUALIZED flag in the PENDING_BP_STATE_FLAGS
            // structure.
            SetFlag(m_state.flags, PBPSF_VIRTUALIZED);
        }
        else
        {
            // Clear the PBPSF_VIRTUALIZED flag in the PENDING_BP_STATE_FLAGS
            // structure.
            ClearFlag(m_state.flags, PBPSF_VIRTUALIZED);
        }
        hr = S_OK;
    }
    else
    {
        hr = E_BP_DELETED;
    }

    return hr;
}

另请参阅