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