MachineDebuggerImpl.cpp revision 0220076bc8def0ee99c7c43471290b2224756225
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* 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.
*/
#include "MachineDebuggerImpl.h"
#include "ConsoleImpl.h"
#include "Logging.h"
//
// defines
//
//
// globals
//
//
// constructor / destructor
//
{
return S_OK;
}
void MachineDebugger::FinalRelease()
{
if (isReady())
uninit();
}
//
// 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;
mLogEnabledQueued = ~0;
mVirtualTimeRateQueued = ~0;
fFlushMode = false;
setReady(true);
return S_OK;
}
/**
* Uninitializes the instance and sets the ready flag to FALSE.
* Called either from FinalRelease() or by the parent when it gets destroyed.
*/
void MachineDebugger::uninit()
{
AssertReturn (isReady(), (void) 0);
setReady (false);
}
/**
* Returns the current singlestepping flag.
*
* @returns COM status code
* @param enabled address of result variable
*/
{
if (!enabled)
return E_POINTER;
CHECK_READY();
/** @todo */
return E_NOTIMPL;
}
/**
* Sets the singlestepping flag.
*
* @returns COM status code
* @param enable new singlestepping flag
*/
{
CHECK_READY();
/** @todo */
return E_NOTIMPL;
}
/**
* Resets VM statistics.
*
* @returns COM status code.
* @param aPattern The selection pattern. A bit similar to filename globbing.
*/
{
return S_OK;
}
/**
* Dumps VM statistics to the log.
*
* @returns COM status code.
* @param aPattern The selection pattern. A bit similar to filename globbing.
*/
{
return S_OK;
}
/**
* Get the VM statistics in an XML format.
*
* @returns COM status code.
* @param aPattern The selection pattern. A bit similar to filename globbing.
* @param aWithDescriptions Whether to include the descriptions.
* @param aStats The XML document containing the statistics.
*/
{
return E_FAIL;
char *pszSnapshot;
if (RT_FAILURE(vrc))
/** @todo this is horribly inefficient! And it's kinda difficult to tell whether it failed...
* Must use UTF-8 or ASCII here and completely avoid these two extra copy operations.
* Until that's done, this method is kind of useless for debugger statistics GUI because
* of the amount statistics in a debug build. */
return S_OK;
}
/**
* Returns the current recompile user mode code flag.
*
* @returns COM status code
* @param enabled address of result variable
*/
{
if (!enabled)
return E_POINTER;
CHECK_READY();
else
*enabled = false;
return S_OK;
}
/**
* Sets the recompile user mode code flag.
*
* @returns COM status
* @param enable new user mode code recompile flag.
*/
{
CHECK_READY();
if (!fFlushMode)
{
// check if the machine is running
if (machineState != MachineState_Running)
{
// queue the request
return S_OK;
}
}
if (VBOX_SUCCESS(rcVBox))
{
}
if (VBOX_SUCCESS(rcVBox))
return S_OK;
AssertMsgFailed(("Could not set raw mode flags to %d, rcVBox = %Vrc\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;
CHECK_READY();
else
*enabled = false;
return S_OK;
}
/**
* Sets the new recompile supervisor code flag.
*
* @returns COM status code
* @param enable new recompile supervisor code flag
*/
{
CHECK_READY();
if (!fFlushMode)
{
// check if the machine is running
if (machineState != MachineState_Running)
{
// queue the request
return S_OK;
}
}
if (VBOX_SUCCESS(rcVBox))
{
}
if (VBOX_SUCCESS(rcVBox))
return S_OK;
AssertMsgFailed(("Could not set raw mode flags to %d, rcVBox = %Vrc\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;
CHECK_READY();
else
*enabled = false;
return S_OK;
}
/**
* Set the new patch manager enabled flag.
*
* @returns COM status code
* @param new patch manager enabled flag
*/
{
CHECK_READY();
if (!fFlushMode)
{
// check if the machine is running
if (machineState != MachineState_Running)
{
// queue the request
return S_OK;
}
}
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;
CHECK_READY();
else
*enabled = false;
return S_OK;
}
/**
* Sets the new code scanner enabled flag.
*
* @returns COM status code
* @param enable new code scanner enabled flag
*/
{
CHECK_READY();
if (!fFlushMode)
{
// check if the machine is running
if (machineState != MachineState_Running)
{
// queue the request
return S_OK;
}
}
int vrc;
if (enable)
else
if (VBOX_FAILURE(vrc))
{
/** @todo handle error case */
}
return S_OK;
}
/**
* Returns the log enabled / disabled status.
*
* @returns COM status code
* @param aEnabled address of result variable
*/
{
if (!aEnabled)
return E_POINTER;
CHECK_READY();
return S_OK;
}
/**
* Enables or disables logging.
*
* @returns COM status code
* @param aEnabled The new code log state.
*/
{
CHECK_READY();
if (!fFlushMode)
{
// check if the machine is running
if (machineState != MachineState_Running)
{
// queue the request
return S_OK;
}
}
if (VBOX_FAILURE(vrc))
{
/** @todo handle error code. */
}
return S_OK;
}
/**
* Returns the current hardware virtualization flag.
*
* @returns COM status code
* @param enabled address of result variable
*/
{
if (!enabled)
return E_POINTER;
CHECK_READY();
else
*enabled = false;
return S_OK;
}
/**
* Returns the current PAE flag.
*
* @returns COM status code
* @param enabled address of result variable
*/
{
if (!enabled)
return E_POINTER;
CHECK_READY();
{
}
else
*enabled = false;
return S_OK;
}
/**
* Returns the current virtual time rate.
*
* @returns COM status code.
* @param pct Where to store the rate.
*/
{
if (!pct)
return E_POINTER;
CHECK_READY();
else
*pct = 100;
return S_OK;
}
/**
* Returns the current virtual time rate.
*
* @returns COM status code.
* @param pct Where to store the rate.
*/
{
return E_INVALIDARG;
CHECK_READY();
if (!fFlushMode)
{
// check if the machine is running
if (machineState != MachineState_Running)
{
// queue the request
return S_OK;
}
}
if (VBOX_FAILURE(vrc))
{
/** @todo handle error code. */
}
return S_OK;
}
/**
* Hack for getting the VM handle.
* This is only temporary (promise) while prototyping the debugger.
*
* @returns COM status code
* @param vm Where to store the vm handle.
* Since there is no uintptr_t in COM, we're using the max integer.
* (No, ULONG is not pointer sized!)
*/
{
if (!vm)
return E_POINTER;
CHECK_READY();
/*
* Note: pVM protection provided by SafeVMPtr is no more effective
* after we return from this method.
*/
return S_OK;
}
//
// "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;
}
if (mLogEnabledQueued != ~0)
{
mLogEnabledQueued = ~0;
}
if (mVirtualTimeRateQueued != ~(uint32_t)0)
{
mVirtualTimeRateQueued = ~0;
}
fFlushMode = false;
}
//
// private methods
//