Source

gb_emulator / gb_debugger_msvs / breakpoints / error_breakpoint_resolution.cpp

Full commit
/*  Copyright Š 2011 Chris Spencer <spencercw@gmail.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#include "stdafx.h"

#include "error_breakpoint_resolution.h"

// IDebugErrorBreakpointResolution2 methods

HRESULT CErrorBreakpointResolution::GetBreakpointType(BP_TYPE *pBPType)
{
	*pBPType = BPT_CODE;
	return S_OK;
}

HRESULT CErrorBreakpointResolution::GetResolutionInfo(
	BPERESI_FIELDS dwFields,
	BP_ERROR_RESOLUTION_INFO *pErrorResolutionInfo)
{
	memset(pErrorResolutionInfo, 0, sizeof(*pErrorResolutionInfo));

	if (dwFields & BPERESI_PROGRAM)
	{
		pErrorResolutionInfo->dwFields |= BPERESI_PROGRAM;
		pErrorResolutionInfo->pProgram = program_;
		pErrorResolutionInfo->pProgram->AddRef();
	}
	if (dwFields & BPERESI_THREAD)
	{
		pErrorResolutionInfo->dwFields |= BPERESI_THREAD;
		pErrorResolutionInfo->pThread = thread_;
		pErrorResolutionInfo->pThread->AddRef();
	}
	if (dwFields & BPERESI_MESSAGE)
	{
		pErrorResolutionInfo->dwFields |= BPERESI_MESSAGE;
		pErrorResolutionInfo->bstrMessage =
			SysAllocString(L"No executable code is associated with this line.");
	}
	if (dwFields & BPERESI_TYPE)
	{
		pErrorResolutionInfo->dwFields |= BPERESI_TYPE;
		pErrorResolutionInfo->dwType = BPET_GENERAL_WARNING;
	}

	return S_OK;
}

// CErrorBreakpointResolution methods

void CErrorBreakpointResolution::Init(IDebugProgram2 *program, IDebugThread2 *thread)
{
	program_ = program;
	thread_ = thread;
}