Changeset 39650 in vbox
- Timestamp:
- Dec 16, 2011 11:27:51 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 75451
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDebugVM.cpp
r35550 r39650 150 150 return RTEXITCODE_SUCCESS; 151 151 } 152 153 /** 154 * Handles the log sub-command. 155 * 156 * @returns Suitable exit code. 157 * @param pArgs The handler arguments. 158 * @param pDebugger Pointer to the debugger interface. 159 * @param pszSubCmd The sub command. 160 */ 161 static RTEXITCODE handleDebugVM_LogXXXX(HandlerArg *pArgs, IMachineDebugger *pDebugger, const char *pszSubCmd) 162 { 163 /* 164 * Parse arguments. 165 */ 166 bool fRelease = false; 167 com::Utf8Str strSettings; 168 169 RTGETOPTSTATE GetState; 170 RTGETOPTUNION ValueUnion; 171 static const RTGETOPTDEF s_aOptions[] = 172 { 173 { "--release", 'r', RTGETOPT_REQ_NOTHING }, 174 }; 175 int rc = RTGetOptInit(&GetState, pArgs->argc, pArgs->argv, s_aOptions, RT_ELEMENTS(s_aOptions), 2, 0 /*fFlags*/); 176 AssertRCReturn(rc, RTEXITCODE_FAILURE); 177 178 while ((rc = RTGetOpt(&GetState, &ValueUnion)) != 0) 179 { 180 switch (rc) 181 { 182 case 'r': 183 fRelease = true; 184 break; 185 186 case 'd': 187 fRelease = false; 188 break; 189 190 case VINF_GETOPT_NOT_OPTION: 191 if (strSettings.length() == 0) 192 strSettings = ValueUnion.psz; 193 else 194 { 195 strSettings.append(' '); 196 strSettings.append(ValueUnion.psz); 197 } 198 break; 199 200 default: 201 return errorGetOpt(USAGE_DEBUGVM, rc, &ValueUnion); 202 } 203 } 204 205 if (fRelease) 206 { 207 com::Utf8Str strTmp(strSettings); 208 strSettings = "release: "; 209 strSettings.append(strTmp); 210 } 211 212 com::Bstr bstrSettings(strSettings); 213 if (!strcmp(pszSubCmd, "log")) 214 CHECK_ERROR2_RET(pDebugger, ModifyLogGroups(bstrSettings.raw()), RTEXITCODE_FAILURE); 215 else if (!strcmp(pszSubCmd, "logdest")) 216 CHECK_ERROR2_RET(pDebugger, ModifyLogDestinations(bstrSettings.raw()), RTEXITCODE_FAILURE); 217 else if (!strcmp(pszSubCmd, "logflags")) 218 CHECK_ERROR2_RET(pDebugger, ModifyLogFlags(bstrSettings.raw()), RTEXITCODE_FAILURE); 219 else 220 AssertFailedReturn(RTEXITCODE_FAILURE); 221 222 return RTEXITCODE_SUCCESS; 223 } 224 152 225 153 226 /** … … 442 515 else if (!strcmp(pszSubCmd, "injectnmi")) 443 516 rcExit = handleDebugVM_InjectNMI(pArgs, ptrDebugger); 517 else if (!strcmp(pszSubCmd, "log")) 518 rcExit = handleDebugVM_LogXXXX(pArgs, ptrDebugger, pszSubCmd); 519 else if (!strcmp(pszSubCmd, "logdest")) 520 rcExit = handleDebugVM_LogXXXX(pArgs, ptrDebugger, pszSubCmd); 521 else if (!strcmp(pszSubCmd, "logflags")) 522 rcExit = handleDebugVM_LogXXXX(pArgs, ptrDebugger, pszSubCmd); 444 523 else if (!strcmp(pszSubCmd, "osdetect")) 445 524 rcExit = handleDebugVM_OSDetect(pArgs, ptrDebugger); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r39169 r39650 645 645 " info <item> [args] |\n" 646 646 " injectnmi |\n" 647 " log [--release|--debug] <settings> ...|\n" 648 " logdest [--release|--debug] <settings> ...|\n" 649 " logflags [--release|--debug] <settings> ...|\n" 647 650 " osdetect |\n" 648 651 " osinfo |\n" -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r39450 r39650 9158 9158 Retrieves status, exit code and the exit reason of a formerly started 9159 9159 guest process. If a guest process exited or got terminated this function 9160 returns its final status and removes this process from the list of 9160 returns its final status and removes this process from the list of 9161 9161 known guest processes for further retrieval. 9162 9162 … … 13257 13257 <method name="modifyLogGroups"> 13258 13258 <desc> 13259 Modifies the group settings of the debug logger. 13260 13261 This feature is not implemented in the 4.0.0 release but may show up 13262 in a dot release. 13259 Modifies the group settings of the debug or release logger. 13263 13260 </desc> 13264 13261 <param name="settings" type="wstring" dir="in"> 13265 <desc>The group settings string. See iprt/log.h for details.</desc> 13262 <desc> 13263 The group settings string. See iprt/log.h for details. To target the 13264 release logger, prefix the string with "release:". 13265 </desc> 13266 13266 </param> 13267 13267 </method> … … 13269 13269 <method name="modifyLogFlags"> 13270 13270 <desc> 13271 Modifies the debug logger flags. 13272 13273 This feature is not implemented in the 4.0.0 release but may show up 13274 in a dot release. 13271 Modifies the debug or release logger flags. 13275 13272 </desc> 13276 13273 <param name="settings" type="wstring" dir="in"> 13277 <desc>The flags settings string. See iprt/log.h for details.</desc> 13274 <desc> 13275 The flags settings string. See iprt/log.h for details. To target the 13276 release logger, prefix the string with "release:". 13277 </desc> 13278 13278 </param> 13279 13279 </method> … … 13281 13281 <method name="modifyLogDestinations"> 13282 13282 <desc> 13283 Modifies the debug logger destinations. 13284 13285 This feature is not implemented in the 4.0.0 release but may show up 13286 in a dot release. 13283 Modifies the debug or release logger destinations. 13287 13284 </desc> 13288 13285 <param name="settings" type="wstring" dir="in"> 13289 <desc>The destination settings string. See iprt/log.h for details.</desc> 13286 <desc> 13287 The destination settings string. See iprt/log.h for details. To target the 13288 release logger, prefix the string with "release:". 13289 </desc> 13290 13290 </param> 13291 13291 </method> -
trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
r38324 r39650 963 963 STDMETHODIMP MachineDebugger::ModifyLogFlags(IN_BSTR a_bstrSettings) 964 964 { 965 ReturnComNotImplemented(); 965 CheckComArgStrNotEmptyOrNull(a_bstrSettings); 966 Utf8Str strSettings(a_bstrSettings); 967 968 LogFlowThisFunc(("a_bstrSettings=%s\n", strSettings.c_str())); 969 AutoCaller autoCaller(this); 970 HRESULT hrc = autoCaller.rc(); 971 if (SUCCEEDED(hrc)) 972 { 973 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 974 Console::SafeVMPtr ptrVM(mParent); 975 hrc = ptrVM.rc(); 976 if (SUCCEEDED(hrc)) 977 { 978 int vrc = DBGFR3LogModifyFlags(ptrVM, strSettings.c_str()); 979 if (RT_SUCCESS(vrc)) 980 hrc = S_OK; 981 else 982 hrc = setError(E_FAIL, tr("DBGFR3LogModifyFlags failed with %Rrc"), vrc); 983 } 984 } 985 return hrc; 966 986 } 967 987 968 988 STDMETHODIMP MachineDebugger::ModifyLogGroups(IN_BSTR a_bstrSettings) 969 989 { 970 ReturnComNotImplemented(); 990 CheckComArgStrNotEmptyOrNull(a_bstrSettings); 991 Utf8Str strSettings(a_bstrSettings); 992 993 LogFlowThisFunc(("a_bstrSettings=%s\n", strSettings.c_str())); 994 AutoCaller autoCaller(this); 995 HRESULT hrc = autoCaller.rc(); 996 if (SUCCEEDED(hrc)) 997 { 998 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 999 Console::SafeVMPtr ptrVM(mParent); 1000 hrc = ptrVM.rc(); 1001 if (SUCCEEDED(hrc)) 1002 { 1003 int vrc = DBGFR3LogModifyGroups(ptrVM, strSettings.c_str()); 1004 if (RT_SUCCESS(vrc)) 1005 hrc = S_OK; 1006 else 1007 hrc = setError(E_FAIL, tr("DBGFR3LogModifyGroups failed with %Rrc"), vrc); 1008 } 1009 } 1010 return hrc; 971 1011 } 972 1012 973 1013 STDMETHODIMP MachineDebugger::ModifyLogDestinations(IN_BSTR a_bstrSettings) 974 1014 { 975 ReturnComNotImplemented(); 1015 CheckComArgStrNotEmptyOrNull(a_bstrSettings); 1016 Utf8Str strSettings(a_bstrSettings); 1017 1018 LogFlowThisFunc(("a_bstrSettings=%s\n", strSettings.c_str())); 1019 AutoCaller autoCaller(this); 1020 HRESULT hrc = autoCaller.rc(); 1021 if (SUCCEEDED(hrc)) 1022 { 1023 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1024 Console::SafeVMPtr ptrVM(mParent); 1025 hrc = ptrVM.rc(); 1026 if (SUCCEEDED(hrc)) 1027 { 1028 int vrc = DBGFR3LogModifyDestinations(ptrVM, strSettings.c_str()); 1029 if (RT_SUCCESS(vrc)) 1030 hrc = S_OK; 1031 else 1032 hrc = setError(E_FAIL, tr("DBGFR3LogModifyDestinations failed with %Rrc"), vrc); 1033 } 1034 } 1035 return hrc; 976 1036 } 977 1037 -
trunk/src/VBox/VMM/VMMR3/DBGFLog.cpp
r38838 r39650 26 26 #include <VBox/err.h> 27 27 #include <iprt/assert.h> 28 #include <iprt/string.h> 28 29 29 30 … … 37 38 38 39 /** 40 * Checkes for logger prefixes and selects the right logger. 41 * 42 * @returns Target logger. 43 * @param ppsz Pointer to the string pointer. 44 */ 45 static PRTLOGGER dbgfR3LogResolvedLogger(const char **ppsz) 46 { 47 PRTLOGGER pLogger; 48 const char *psz = *ppsz; 49 if (!strncmp(psz, "release:", sizeof("release:") - 1)) 50 { 51 *ppsz += sizeof("release:") - 1; 52 pLogger = RTLogRelDefaultInstance(); 53 } 54 else 55 { 56 if (!strncmp(psz, "debug:", sizeof("debug:") - 1)) 57 *ppsz += sizeof("debug:") - 1; 58 pLogger = RTLogDefaultInstance(); 59 } 60 return pLogger; 61 } 62 63 64 /** 39 65 * Changes the logger group settings. 40 66 * … … 42 68 * @param pVM The VM handle. 43 69 * @param pszGroupSettings The group settings string. (VBOX_LOG) 70 * By prefixing the string with \"release:\" the 71 * changes will be applied to the release log 72 * instead of the debug log. The prefix \"debug:\" 73 * is also recognized. 44 74 */ 45 75 VMMR3DECL(int) DBGFR3LogModifyGroups(PVM pVM, const char *pszGroupSettings) … … 61 91 static DECLCALLBACK(int) dbgfR3LogModifyGroups(PVM pVM, const char *pszGroupSettings) 62 92 { 63 int rc = RTLogGroupSettings(NULL, pszGroupSettings); 93 PRTLOGGER pLogger = dbgfR3LogResolvedLogger(&pszGroupSettings); 94 if (!pLogger) 95 return VINF_SUCCESS; 96 97 int rc = RTLogGroupSettings(pLogger, pszGroupSettings); 64 98 if (RT_SUCCESS(rc)) 65 99 rc = VMMR3UpdateLoggers(pVM); … … 74 108 * @param pVM The VM handle. 75 109 * @param pszFlagSettings The group settings string. (VBOX_LOG_FLAGS) 110 * By prefixing the string with \"release:\" the 111 * changes will be applied to the release log 112 * instead of the debug log. The prefix \"debug:\" 113 * is also recognized. 76 114 */ 77 115 VMMR3DECL(int) DBGFR3LogModifyFlags(PVM pVM, const char *pszFlagSettings) … … 93 131 static DECLCALLBACK(int) dbgfR3LogModifyFlags(PVM pVM, const char *pszFlagSettings) 94 132 { 95 int rc = RTLogFlags(NULL, pszFlagSettings); 133 PRTLOGGER pLogger = dbgfR3LogResolvedLogger(&pszFlagSettings); 134 if (!pLogger) 135 return VINF_SUCCESS; 136 137 int rc = RTLogFlags(pLogger, pszFlagSettings); 96 138 if (RT_SUCCESS(rc)) 97 139 rc = VMMR3UpdateLoggers(pVM); … … 106 148 * @param pVM The VM handle. 107 149 * @param pszDestSettings The destination settings string. (VBOX_LOG_DEST) 150 * By prefixing the string with \"release:\" the 151 * changes will be applied to the release log 152 * instead of the debug log. The prefix \"debug:\" 153 * is also recognized. 108 154 */ 109 155 VMMR3DECL(int) DBGFR3LogModifyDestinations(PVM pVM, const char *pszDestSettings) … … 125 171 static DECLCALLBACK(int) dbgfR3LogModifyDestinations(PVM pVM, const char *pszDestSettings) 126 172 { 173 PRTLOGGER pLogger = dbgfR3LogResolvedLogger(&pszDestSettings); 174 if (!pLogger) 175 return VINF_SUCCESS; 176 127 177 int rc = RTLogDestinations(NULL, pszDestSettings); 128 178 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.