1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
/* $Id: DBGFLog.cpp $ */
/** @file
* DBGF - Debugger Facility, Log Manager.
*/
/*
* Copyright (C) 2006-2007 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* 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 *
*******************************************************************************/
#include <VBox/vmapi.h>
#include <VBox/vmm.h>
#include <VBox/dbgf.h>
#include <VBox/log.h>
#include <VBox/err.h>
#include <iprt/assert.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);
/**
* Changes the logger group settings.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pszGroupSettings The group settings string. (VBOX_LOG)
*/
VMMR3DECL(int) DBGFR3LogModifyGroups(PVM pVM, const char *pszGroupSettings)
{
AssertPtrReturn(pVM, VERR_INVALID_POINTER);
AssertPtrReturn(pszGroupSettings, VERR_INVALID_POINTER);
return VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyGroups, 2, pVM, pszGroupSettings);
}
/**
* EMT worker for DBGFR3LogModifyGroups.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pszGroupSettings The group settings string. (VBOX_LOG)
*/
static DECLCALLBACK(int) dbgfR3LogModifyGroups(PVM pVM, const char *pszGroupSettings)
{
int rc = RTLogGroupSettings(NULL, pszGroupSettings);
if (RT_SUCCESS(rc))
rc = VMMR3UpdateLoggers(pVM);
return rc;
}
/**
* Changes the logger flag settings.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pszFlagSettings The group settings string. (VBOX_LOG_FLAGS)
*/
VMMR3DECL(int) DBGFR3LogModifyFlags(PVM pVM, const char *pszFlagSettings)
{
AssertPtrReturn(pVM, VERR_INVALID_POINTER);
AssertPtrReturn(pszFlagSettings, VERR_INVALID_POINTER);
return VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyFlags, 2, pVM, pszFlagSettings);
}
/**
* EMT worker for DBGFR3LogModifyFlags.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pszFlagSettings The group settings string. (VBOX_LOG_FLAGS)
*/
static DECLCALLBACK(int) dbgfR3LogModifyFlags(PVM pVM, const char *pszFlagSettings)
{
int rc = RTLogFlags(NULL, pszFlagSettings);
if (RT_SUCCESS(rc))
rc = VMMR3UpdateLoggers(pVM);
return rc;
}
/**
* Changes the logger destination settings.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pszDestSettings The destination settings string. (VBOX_LOG_DEST)
*/
VMMR3DECL(int) DBGFR3LogModifyDestinations(PVM pVM, const char *pszDestSettings)
{
AssertReturn(VALID_PTR(pVM), VERR_INVALID_POINTER);
AssertReturn(VALID_PTR(pszDestSettings), VERR_INVALID_POINTER);
return VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)dbgfR3LogModifyDestinations, 2, pVM, pszDestSettings);
}
/**
* EMT worker for DBGFR3LogModifyFlags.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pszDestSettings The destination settings string. (VBOX_LOG_DEST)
*/
static DECLCALLBACK(int) dbgfR3LogModifyDestinations(PVM pVM, const char *pszDestSettings)
{
int rc = RTLogDestinations(NULL, pszDestSettings);
if (RT_SUCCESS(rc))
rc = VMMR3UpdateLoggers(pVM);
return rc;
}
|