DBGFR3Trace.cpp revision 1759f65b60e18f669f6d569aebd4fb7217ab414f
/* $Id$ */
/** @file
* DBGF - Debugger Facility, Tracing.
*/
/*
* Copyright (C) 2011 Oracle Corporation
*
* 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.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_DBGF
#include "DBGFInternal.h"
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
/**
* Initializes the tracing.
*
* @returns VBox status code
* @param pVM The VM handle.
*/
{
/*
* Don't enable it twice.
*/
return VERR_ALREADY_EXISTS;
/*
* Resolve default parameter values.
*/
int rc;
if (!cbEntry)
{
rc = CFGMR3QueryU32Def(CFGMR3GetChild(CFGMR3GetRoot(pVM), "DBGF"), "TraceBufEntrySize", &cbEntry, 128);
}
if (!cEntries)
{
rc = CFGMR3QueryU32Def(CFGMR3GetChild(CFGMR3GetRoot(pVM), "DBGF"), "TraceBufEntries", &cEntries, 4096);
}
/*
* Figure the required size.
*/
if (rc != VERR_BUFFER_OVERFLOW)
{
return rc;
}
/*
* Allocate a hyper heap block and carve a trace buffer out of it.
*
* Note! We ASSUME that the returned trace buffer handle has the same value
* as the heap block.
*/
void *pvBlock;
if (RT_FAILURE(rc))
return rc;
return VINF_SUCCESS;
}
/**
* Initializes the tracing.
*
* @returns VBox status code
* @param pVM The VM handle.
*/
{
/*
* Initialize the trace buffer handles.
*/
/*
* Check the config and enable tracing if requested.
*/
#if defined(DEBUG) || defined(RTTRACE_ENABLED)
bool const fDefault = true;
#else
bool const fDefault = false;
#endif
bool fTracingEnabled;
if (fTracingEnabled)
/*
* Register a debug info item that will dump the trace buffer content.
*/
if (RT_SUCCESS(rc))
rc = DBGFR3InfoRegisterInternal(pVM, "tracebuf", "Display the trace buffer content. No arguments.", dbgfR3TraceInfo);
return rc;
}
/**
* Terminates the tracing.
*
* @param pVM The VM handle.
*/
{
/* nothing to do */
}
/**
* Relocates the trace buffer handle in RC.
*
* @param pVM The VM handle.
*/
{
}
/**
* @callback_method_impl{FNRTTRACEBUFCALLBACK}
*/
static DECLCALLBACK(int)
dbgfR3TraceInfoDumpEntry(RTTRACEBUF hTraceBuf, uint32_t iEntry, uint64_t NanoTS, RTCPUID idCpu, const char *pszMsg, void *pvUser)
{
return VINF_SUCCESS;
}
/**
* @callback_method_impl{FNDBGFHANDLERINT, Info handler for displaying the trace buffer content.}
*/
{
if (hTraceBuf == NIL_RTTRACEBUF)
else
{
}
}