DBGFOS.cpp revision 4f654df57ddc8d406e3724974e46e1f46bd3d1c1
/* $Id$ */
/** @file
* VMM DBGF - Debugger Facility, Guest OS Diggers.
*/
/*
* Copyright (C) 2008 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.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_DBGF
#include "DBGFInternal.h"
/**
* Registers a guest OS digger.
*
* This will instantiate an instance of the digger and add it
* to the list for us in the next call to DBGFR3OSDetect().
*
* @returns VBox status code.
* @param pVM Pointer to the shared VM structure.
* @param pReg The registration structure.
*/
{
/*
* Validate intput.
*/
AssertMsgReturn(!strcmp(pOS->pReg->szName, pReg->szName), ("%s\n", pReg->szName), VERR_ALREADY_EXISTS);
/*
* Allocate a new structure, call the constructor and link it into the list.
*/
PDBGFOS pOS = (PDBGFOS)MMR3HeapAllocZ(pVM, MM_TAG_DBGF_OS, RT_OFFSETOF(DBGFOS, abData[pReg->cbData]));
if (RT_SUCCESS(rc))
{
}
else
{
}
return VINF_SUCCESS;
}
/**
* Internal cleanup routine called by DBGFR3Term().
*
* @param pVM Pointer to the shared VM structure.
*/
{
/*
* Terminate the current one.
*/
{
}
/*
* Destroy all the instances.
*/
{
}
}
/**
* Detectes the guest OS and try dig out symbols and useful stuff.
*
* When called the 2nd time, symbols will be updated that if the OS
* is the same.
*
* @returns VBox status code.
* @retval VINF_SUCCESS if successfully detected.
* @retval VINF_DBGF_OS_NOT_DETCTED if we cannot figure it out.
*
* @param pVM Pointer to the shared VM structure.
* @param pszName Where to store the OS name. Empty string if not detected.
* @param cchName Size of the buffer.
*/
{
/*
* Cycle thru the detection routines.
*/
*pszName = '\0';
{
int rc;
else
{
if (pOldOS)
}
return rc;
}
/* not found */
if (pOldOS)
return VINF_DBGF_OS_NOT_DETCTED;
}
/**
*
* It goes without saying that this querying is done using the current
* guest OS digger and not additions or user configuration.
*
* @returns VBox status code.
* @param pVM Pointer to the shared VM structure.
* @param pszName Where to store the OS name. Optional.
* @param cchName The size of the name buffer.
* @param pszVersion Where to store the version string. Optional.
* @param cchVersion The size of the version buffer.
*/
DBGFR3DECL(int) DBGFR3OSNameAndVersion(PVM pVM, char *pszName, size_t cchName, char *pszVersion, size_t cchVersion)
{
/*
* Initialize the output up front.
*/
*pszName = '\0';
if (pszVersion && cchVersion)
*pszVersion = '\0';
/*
* Any known OS?
*/
{
int rc = VINF_SUCCESS;
{
else
{
}
}
if (pszVersion && cchVersion)
{
int rc2 = pVM->dbgf.s.pCurOS->pReg->pfnQueryVersion(pVM, pVM->dbgf.s.pCurOS->abData, pszVersion, cchVersion);
}
return rc;
}
return VERR_DBGF_OS_NOT_DETCTED;
}
/**
* Query an optional digger interface.
*
* @returns Pointer to the digger interface on success, NULL if the interfaces isn't
* available or no active guest OS digger.
* @param pVM Pointer to the shared VM structure.
* @param enmIf The interface identifier.
*/
{
AssertMsgReturn(enmIf > DBGFOSINTERFACE_INVALID && enmIf < DBGFOSINTERFACE_END, ("%d\n", enmIf), NULL);
return NULL;
}