MachineDebuggerImpl.cpp revision 99f34065aa871a12e9afacbaf27bd9dc9ff8d0bb
/** @file
*
* VBox frontends: Basic Frontend (BFE):
* Implementation of MachineDebugger class
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#ifdef VBOXBFE_WITHOUT_COM
# include "COMDefs.h"
#else
#endif
#include <iprt/semaphore.h>
#include "VBoxBFE.h"
#include "MachineDebuggerImpl.h"
//
// defines
//
//
// globals
//
//
// public methods
//
/**
* Initializes the machine debugger object.
*
* @returns COM result indicator
* @param parent handle of our parent object
*/
{
singlestepQueued = ~0;
recompileUserQueued = ~0;
patmEnabledQueued = ~0;
csamEnabledQueued = ~0;
fFlushMode = false;
}
/**
* Returns the current singlestepping flag.
*
* @returns COM status code
* @param enabled address of result variable
*/
{
if (!enabled)
return E_POINTER;
/** @todo */
return E_NOTIMPL;
}
/**
* Sets the singlestepping flag.
*
* @returns COM status code
* @param enable new singlestepping flag
*/
{
/** @todo */
return E_NOTIMPL;
}
/**
* Returns the current recompile user mode code flag.
*
* @returns COM status code
* @param enabled address of result variable
*/
{
if (!enabled)
return E_POINTER;
if (gpVM)
else
*enabled = false;
return S_OK;
}
/**
* Sets the recompile user mode code flag.
*
* @returns COM status
* @param enable new user mode code recompile flag.
*/
{
if (!fFlushMode)
{
// check if the machine is running
if (machineState != VMSTATE_RUNNING)
{
// queue the request
return S_OK;
}
}
if (!gpVM)
{
return E_FAIL;
}
if (RT_SUCCESS(rcVBox))
return S_OK;
AssertMsgFailed(("Could not set raw mode flags to %d, rcVBox = %Rrc\n",
rawModeFlag, rcVBox));
return E_FAIL;
}
/**
* Returns the current recompile supervisor code flag.
*
* @returns COM status code
* @param enabled address of result variable
*/
{
if (!enabled)
return E_POINTER;
if (gpVM)
else
*enabled = false;
return S_OK;
}
/**
* Sets the new recompile supervisor code flag.
*
* @returns COM status code
* @param enable new recompile supervisor code flag
*/
{
if (!fFlushMode)
{
// check if the machine is running
if (machineState != VMSTATE_RUNNING)
{
// queue the request
return S_OK;
}
}
if (!gpVM)
{
return E_FAIL;
}
if (RT_SUCCESS(rcVBox))
return S_OK;
AssertMsgFailed(("Could not set raw mode flags to %d, rcVBox = %Rrc\n",
rawModeFlag, rcVBox));
return E_FAIL;
}
/**
* Returns the current patch manager enabled flag.
*
* @returns COM status code
* @param enabled address of result variable
*/
{
if (!enabled)
return E_POINTER;
if (gpVM)
else
*enabled = false;
return S_OK;
}
/**
* Set the new patch manager enabled flag.
*
* @returns COM status code
* @param new patch manager enabled flag
*/
{
if (!fFlushMode)
{
// check if the machine is running
if (machineState != VMSTATE_RUNNING)
{
// queue the request
return S_OK;
}
}
if (!gpVM)
return E_FAIL;
return E_NOTIMPL;
}
/**
* Returns the current code scanner enabled flag.
*
* @returns COM status code
* @param enabled address of result variable
*/
{
if (!enabled)
return E_POINTER;
if (gpVM)
else
*enabled = false;
return S_OK;
}
/**
* Sets the new code scanner enabled flag.
*
* @returns COM status code
* @param enable new code scanner enabled flag
*/
{
if (!fFlushMode)
{
// check if the machine is running
if (machineState != VMSTATE_RUNNING)
{
// queue the request
return S_OK;
}
}
if (!gpVM)
return E_FAIL;
if (enable)
else
return E_NOTIMPL;
}
//
// "public-private" methods
//
void MachineDebugger::flushQueuedSettings()
{
fFlushMode = true;
if (singlestepQueued != ~0)
{
singlestepQueued = ~0;
}
if (recompileUserQueued != ~0)
{
recompileUserQueued = ~0;
}
if (recompileSupervisorQueued != ~0)
{
}
if (patmEnabledQueued != ~0)
{
patmEnabledQueued = ~0;
}
if (csamEnabledQueued != ~0)
{
csamEnabledQueued = ~0;
}
fFlushMode = false;
}
//
// private methods
//