1 | /* $Id: DBGFLog.cpp 23 2007-01-15 14:08:28Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VMM DBGF - Debugger Facility, Log Manager.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
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 as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | */
|
---|
21 |
|
---|
22 |
|
---|
23 |
|
---|
24 | /*******************************************************************************
|
---|
25 | * Header Files *
|
---|
26 | *******************************************************************************/
|
---|
27 | #include <VBox/vmapi.h>
|
---|
28 | #include <VBox/vmm.h>
|
---|
29 | #include <VBox/dbgf.h>
|
---|
30 | #include <VBox/log.h>
|
---|
31 | #include <VBox/err.h>
|
---|
32 | #include <iprt/assert.h>
|
---|
33 |
|
---|
34 |
|
---|
35 | /*******************************************************************************
|
---|
36 | * Internal Functions *
|
---|
37 | *******************************************************************************/
|
---|
38 | static DECLCALLBACK(int) dbgfR3LogModifyGroups(PVM pVM, const char *pszGroupSettings);
|
---|
39 | static DECLCALLBACK(int) dbgfR3LogModifyFlags(PVM pVM, const char *pszFlagSettings);
|
---|
40 | static DECLCALLBACK(int) dbgfR3LogModifyDestinations(PVM pVM, const char *pszDestSettings);
|
---|
41 |
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * Changes the logger group settings.
|
---|
45 | *
|
---|
46 | * @returns VBox status code.
|
---|
47 | * @param pVM The VM handle.
|
---|
48 | * @param pszGroupSettings The group settings string. (VBOX_LOG)
|
---|
49 | */
|
---|
50 | DBGFR3DECL(int) DBGFR3LogModifyGroups(PVM pVM, const char *pszGroupSettings)
|
---|
51 | {
|
---|
52 | AssertReturn(VALID_PTR(pVM), VERR_INVALID_POINTER);
|
---|
53 | AssertReturn(VALID_PTR(pszGroupSettings), VERR_INVALID_POINTER);
|
---|
54 |
|
---|
55 | PVMREQ pReq;
|
---|
56 | int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)dbgfR3LogModifyGroups, 2, pVM, pszGroupSettings);
|
---|
57 | if (VBOX_SUCCESS(rc))
|
---|
58 | rc = pReq->iStatus;
|
---|
59 | VMR3ReqFree(pReq);
|
---|
60 | return rc;
|
---|
61 | }
|
---|
62 |
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * EMT worker for DBGFR3LogModifyGroups.
|
---|
66 | *
|
---|
67 | * @returns VBox status code.
|
---|
68 | * @param pVM The VM handle.
|
---|
69 | * @param pszGroupSettings The group settings string. (VBOX_LOG)
|
---|
70 | */
|
---|
71 | static DECLCALLBACK(int) dbgfR3LogModifyGroups(PVM pVM, const char *pszGroupSettings)
|
---|
72 | {
|
---|
73 | int rc = RTLogGroupSettings(NULL, pszGroupSettings);
|
---|
74 | if (VBOX_SUCCESS(rc))
|
---|
75 | rc = VMMR3UpdateLoggers(pVM);
|
---|
76 | return rc;
|
---|
77 | }
|
---|
78 |
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * Changes the logger flag settings.
|
---|
82 | *
|
---|
83 | * @returns VBox status code.
|
---|
84 | * @param pVM The VM handle.
|
---|
85 | * @param pszFlagSettings The group settings string. (VBOX_LOG_FLAGS)
|
---|
86 | */
|
---|
87 | DBGFR3DECL(int) DBGFR3LogModifyFlags(PVM pVM, const char *pszFlagSettings)
|
---|
88 | {
|
---|
89 | AssertReturn(VALID_PTR(pVM), VERR_INVALID_POINTER);
|
---|
90 | AssertReturn(VALID_PTR(pszFlagSettings), VERR_INVALID_POINTER);
|
---|
91 |
|
---|
92 | PVMREQ pReq;
|
---|
93 | int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)dbgfR3LogModifyFlags, 2, pVM, pszFlagSettings);
|
---|
94 | if (VBOX_SUCCESS(rc))
|
---|
95 | rc = pReq->iStatus;
|
---|
96 | VMR3ReqFree(pReq);
|
---|
97 | return rc;
|
---|
98 | }
|
---|
99 |
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * EMT worker for DBGFR3LogModifyFlags.
|
---|
103 | *
|
---|
104 | * @returns VBox status code.
|
---|
105 | * @param pVM The VM handle.
|
---|
106 | * @param pszFlagSettings The group settings string. (VBOX_LOG_FLAGS)
|
---|
107 | */
|
---|
108 | static DECLCALLBACK(int) dbgfR3LogModifyFlags(PVM pVM, const char *pszFlagSettings)
|
---|
109 | {
|
---|
110 | int rc = RTLogFlags(NULL, pszFlagSettings);
|
---|
111 | if (VBOX_SUCCESS(rc))
|
---|
112 | rc = VMMR3UpdateLoggers(pVM);
|
---|
113 | return rc;
|
---|
114 | }
|
---|
115 |
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * Changes the logger destination settings.
|
---|
119 | *
|
---|
120 | * @returns VBox status code.
|
---|
121 | * @param pVM The VM handle.
|
---|
122 | * @param pszDestSettings The destination settings string. (VBOX_LOG_DEST)
|
---|
123 | */
|
---|
124 | DBGFR3DECL(int) DBGFR3LogModifyDestinations(PVM pVM, const char *pszDestSettings)
|
---|
125 | {
|
---|
126 | AssertReturn(VALID_PTR(pVM), VERR_INVALID_POINTER);
|
---|
127 | AssertReturn(VALID_PTR(pszDestSettings), VERR_INVALID_POINTER);
|
---|
128 |
|
---|
129 | PVMREQ pReq;
|
---|
130 | int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)dbgfR3LogModifyDestinations, 2, pVM, pszDestSettings);
|
---|
131 | if (VBOX_SUCCESS(rc))
|
---|
132 | rc = pReq->iStatus;
|
---|
133 | VMR3ReqFree(pReq);
|
---|
134 | return rc;
|
---|
135 | }
|
---|
136 |
|
---|
137 |
|
---|
138 | /**
|
---|
139 | * EMT worker for DBGFR3LogModifyFlags.
|
---|
140 | *
|
---|
141 | * @returns VBox status code.
|
---|
142 | * @param pVM The VM handle.
|
---|
143 | * @param pszDestSettings The destination settings string. (VBOX_LOG_DEST)
|
---|
144 | */
|
---|
145 | static DECLCALLBACK(int) dbgfR3LogModifyDestinations(PVM pVM, const char *pszDestSettings)
|
---|
146 | {
|
---|
147 | int rc = VERR_NOT_IMPLEMENTED; //RTLogDestination(NULL, pszDestSettings);
|
---|
148 | if (VBOX_SUCCESS(rc))
|
---|
149 | rc = VMMR3UpdateLoggers(pVM);
|
---|
150 | return rc;
|
---|
151 | }
|
---|
152 |
|
---|