summaryrefslogtreecommitdiff
path: root/src/VBox/VMM/VMMR3/DBGFLog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/VMM/VMMR3/DBGFLog.cpp')
-rw-r--r--src/VBox/VMM/VMMR3/DBGFLog.cpp118
1 files changed, 61 insertions, 57 deletions
diff --git a/src/VBox/VMM/VMMR3/DBGFLog.cpp b/src/VBox/VMM/VMMR3/DBGFLog.cpp
index e5b4047b..e55cd54f 100644
--- a/src/VBox/VMM/VMMR3/DBGFLog.cpp
+++ b/src/VBox/VMM/VMMR3/DBGFLog.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -22,20 +22,15 @@
#include <VBox/vmm/vmapi.h>
#include <VBox/vmm/vmm.h>
#include <VBox/vmm/dbgf.h>
+#include <VBox/vmm/uvm.h>
+#include <VBox/vmm/vm.h>
#include <VBox/log.h>
#include <VBox/err.h>
#include <iprt/assert.h>
+#include <iprt/param.h>
#include <iprt/string.h>
-/*******************************************************************************
-* Internal Functions *
-*******************************************************************************/
-static DECLCALLBACK(int) dbgfR3LogModifyGroups(PVM pVM, const char *pszGroupSettings);
-static DECLCALLBACK(int) dbgfR3LogModifyFlags(PVM pVM, const char *pszFlagSettings);
-static DECLCALLBACK(int) dbgfR3LogModifyDestinations(PVM pVM, const char *pszDestSettings);
-
-
/**
* Checkes for logger prefixes and selects the right logger.
*
@@ -46,14 +41,14 @@ static PRTLOGGER dbgfR3LogResolvedLogger(const char **ppsz)
{
PRTLOGGER pLogger;
const char *psz = *ppsz;
- if (!strncmp(psz, "release:", sizeof("release:") - 1))
+ if (!strncmp(psz, RT_STR_TUPLE("release:")))
{
*ppsz += sizeof("release:") - 1;
pLogger = RTLogRelDefaultInstance();
}
else
{
- if (!strncmp(psz, "debug:", sizeof("debug:") - 1))
+ if (!strncmp(psz, RT_STR_TUPLE("debug:")))
*ppsz += sizeof("debug:") - 1;
pLogger = RTLogDefaultInstance();
}
@@ -62,62 +57,45 @@ static PRTLOGGER dbgfR3LogResolvedLogger(const char **ppsz)
/**
- * Changes the logger group settings.
- *
- * @returns VBox status code.
- * @param pVM Pointer to the VM.
- * @param pszGroupSettings The group settings string. (VBOX_LOG)
- * By prefixing the string with \"release:\" the
- * changes will be applied to the release log
- * instead of the debug log. The prefix \"debug:\"
- * is also recognized.
- */
-VMMR3DECL(int) DBGFR3LogModifyGroups(PVM pVM, const char *pszGroupSettings)
-{
- AssertPtrReturn(pVM, VERR_INVALID_POINTER);
- AssertPtrReturn(pszGroupSettings, VERR_INVALID_POINTER);
-
- return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyGroups, 2, pVM, pszGroupSettings);
-}
-
-
-/**
* EMT worker for DBGFR3LogModifyGroups.
*
* @returns VBox status code.
- * @param pVM Pointer to the VM.
+ * @param pUVM The user mode VM handle.
* @param pszGroupSettings The group settings string. (VBOX_LOG)
*/
-static DECLCALLBACK(int) dbgfR3LogModifyGroups(PVM pVM, const char *pszGroupSettings)
+static DECLCALLBACK(int) dbgfR3LogModifyGroups(PUVM pUVM, const char *pszGroupSettings)
{
PRTLOGGER pLogger = dbgfR3LogResolvedLogger(&pszGroupSettings);
if (!pLogger)
return VINF_SUCCESS;
int rc = RTLogGroupSettings(pLogger, pszGroupSettings);
- if (RT_SUCCESS(rc))
- rc = VMMR3UpdateLoggers(pVM);
+ if (RT_SUCCESS(rc) && pUVM->pVM)
+ {
+ VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE);
+ rc = VMMR3UpdateLoggers(pUVM->pVM);
+ }
return rc;
}
/**
- * Changes the logger flag settings.
+ * Changes the logger group settings.
*
* @returns VBox status code.
- * @param pVM Pointer to the VM.
- * @param pszFlagSettings The group settings string. (VBOX_LOG_FLAGS)
+ * @param pUVM The user mode VM handle.
+ * @param pszGroupSettings The group settings string. (VBOX_LOG)
* By prefixing the string with \"release:\" the
* changes will be applied to the release log
* instead of the debug log. The prefix \"debug:\"
* is also recognized.
*/
-VMMR3DECL(int) DBGFR3LogModifyFlags(PVM pVM, const char *pszFlagSettings)
+VMMR3DECL(int) DBGFR3LogModifyGroups(PUVM pUVM, const char *pszGroupSettings)
{
- AssertPtrReturn(pVM, VERR_INVALID_POINTER);
- AssertPtrReturn(pszFlagSettings, VERR_INVALID_POINTER);
+ UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
+ AssertPtrReturn(pszGroupSettings, VERR_INVALID_POINTER);
- return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyFlags, 2, pVM, pszFlagSettings);
+ return VMR3ReqPriorityCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyGroups, 2, pUVM, pszGroupSettings);
}
@@ -125,39 +103,42 @@ VMMR3DECL(int) DBGFR3LogModifyFlags(PVM pVM, const char *pszFlagSettings)
* EMT worker for DBGFR3LogModifyFlags.
*
* @returns VBox status code.
- * @param pVM Pointer to the VM.
+ * @param pUVM The user mode VM handle.
* @param pszFlagSettings The group settings string. (VBOX_LOG_FLAGS)
*/
-static DECLCALLBACK(int) dbgfR3LogModifyFlags(PVM pVM, const char *pszFlagSettings)
+static DECLCALLBACK(int) dbgfR3LogModifyFlags(PUVM pUVM, const char *pszFlagSettings)
{
PRTLOGGER pLogger = dbgfR3LogResolvedLogger(&pszFlagSettings);
if (!pLogger)
return VINF_SUCCESS;
int rc = RTLogFlags(pLogger, pszFlagSettings);
- if (RT_SUCCESS(rc))
- rc = VMMR3UpdateLoggers(pVM);
+ if (RT_SUCCESS(rc) && pUVM->pVM)
+ {
+ VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE);
+ rc = VMMR3UpdateLoggers(pUVM->pVM);
+ }
return rc;
}
/**
- * Changes the logger destination settings.
+ * Changes the logger flag settings.
*
* @returns VBox status code.
- * @param pVM Pointer to the VM.
- * @param pszDestSettings The destination settings string. (VBOX_LOG_DEST)
+ * @param pUVM The user mode VM handle.
+ * @param pszFlagSettings The group settings string. (VBOX_LOG_FLAGS)
* By prefixing the string with \"release:\" the
* changes will be applied to the release log
* instead of the debug log. The prefix \"debug:\"
* is also recognized.
*/
-VMMR3DECL(int) DBGFR3LogModifyDestinations(PVM pVM, const char *pszDestSettings)
+VMMR3DECL(int) DBGFR3LogModifyFlags(PUVM pUVM, const char *pszFlagSettings)
{
- AssertReturn(VALID_PTR(pVM), VERR_INVALID_POINTER);
- AssertReturn(VALID_PTR(pszDestSettings), VERR_INVALID_POINTER);
+ UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
+ AssertPtrReturn(pszFlagSettings, VERR_INVALID_POINTER);
- return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyDestinations, 2, pVM, pszDestSettings);
+ return VMR3ReqPriorityCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyFlags, 2, pUVM, pszFlagSettings);
}
@@ -165,18 +146,41 @@ VMMR3DECL(int) DBGFR3LogModifyDestinations(PVM pVM, const char *pszDestSettings)
* EMT worker for DBGFR3LogModifyFlags.
*
* @returns VBox status code.
- * @param pVM Pointer to the VM.
+ * @param pUVM The user mode VM handle.
* @param pszDestSettings The destination settings string. (VBOX_LOG_DEST)
*/
-static DECLCALLBACK(int) dbgfR3LogModifyDestinations(PVM pVM, const char *pszDestSettings)
+static DECLCALLBACK(int) dbgfR3LogModifyDestinations(PUVM pUVM, const char *pszDestSettings)
{
PRTLOGGER pLogger = dbgfR3LogResolvedLogger(&pszDestSettings);
if (!pLogger)
return VINF_SUCCESS;
int rc = RTLogDestinations(NULL, pszDestSettings);
- if (RT_SUCCESS(rc))
- rc = VMMR3UpdateLoggers(pVM);
+ if (RT_SUCCESS(rc) && pUVM->pVM)
+ {
+ VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE);
+ rc = VMMR3UpdateLoggers(pUVM->pVM);
+ }
return rc;
}
+
+/**
+ * Changes the logger destination settings.
+ *
+ * @returns VBox status code.
+ * @param pUVM The user mode VM handle.
+ * @param pszDestSettings The destination settings string. (VBOX_LOG_DEST)
+ * By prefixing the string with \"release:\" the
+ * changes will be applied to the release log
+ * instead of the debug log. The prefix \"debug:\"
+ * is also recognized.
+ */
+VMMR3DECL(int) DBGFR3LogModifyDestinations(PUVM pUVM, const char *pszDestSettings)
+{
+ UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
+ AssertPtrReturn(pszDestSettings, VERR_INVALID_POINTER);
+
+ return VMR3ReqPriorityCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyDestinations, 2, pUVM, pszDestSettings);
+}
+