Changeset 39668 in vbox
- Timestamp:
- Dec 20, 2011 9:46:30 PM (13 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
-
Frontends/VBoxManage/VBoxManageDebugVM.cpp (modified) (2 diffs)
-
Frontends/VBoxManage/VBoxManageHelp.cpp (modified) (1 diff)
-
Main/idl/VirtualBox.xidl (modified) (2 diffs)
-
Main/include/MachineDebuggerImpl.h (modified) (3 diffs)
-
Main/src-client/MachineDebuggerImpl.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDebugVM.cpp
r39650 r39668 400 400 RTPrintf("Successfully set %u registers\n", aBstrNames.size()); 401 401 } 402 403 return RTEXITCODE_SUCCESS; 404 } 405 406 /** 407 * Handles the show sub-command. 408 * 409 * @returns Suitable exit code. 410 * @param pArgs The handler arguments. 411 * @param pDebugger Pointer to the debugger interface. 412 */ 413 static RTEXITCODE handleDebugVM_Show(HandlerArg *pArgs, IMachineDebugger *pDebugger) 414 { 415 if (pArgs->argc != 3) 416 return errorSyntax(USAGE_DEBUGVM, "The show sub-command takes exactly one argument"); 417 418 const char *pszWhat = pArgs->argv[2]; 419 if ( !strcmp(pszWhat, "log-settings") 420 || !strcmp(pszWhat, "logdbg-settings")) 421 { 422 com::Bstr bstrFlags; 423 CHECK_ERROR2_RET(pDebugger, COMGETTER(LogDbgFlags)(bstrFlags.asOutParam()), RTEXITCODE_FAILURE); 424 com::Bstr bstrGroups; 425 CHECK_ERROR2_RET(pDebugger, COMGETTER(LogDbgGroups)(bstrGroups.asOutParam()), RTEXITCODE_FAILURE); 426 com::Bstr bstrDestinations; 427 CHECK_ERROR2_RET(pDebugger, COMGETTER(LogDbgDestinations)(bstrDestinations.asOutParam()), RTEXITCODE_FAILURE); 428 RTPrintf("Debug log settings:\n"); 429 RTPrintf(" VBOX_LOG=%ls\n" 430 " VBOX_LOG_FLAGS=%ls\n" 431 " VBOX_LOG_DEST=%ls\n" 432 , bstrGroups.raw(), bstrFlags.raw(), bstrDestinations.raw()); 433 } 434 else if (!strcmp(pszWhat, "logrel-settings")) 435 { 436 com::Bstr bstrFlags; 437 CHECK_ERROR2_RET(pDebugger, COMGETTER(LogRelFlags)(bstrFlags.asOutParam()), RTEXITCODE_FAILURE); 438 com::Bstr bstrGroups; 439 CHECK_ERROR2_RET(pDebugger, COMGETTER(LogRelGroups)(bstrGroups.asOutParam()), RTEXITCODE_FAILURE); 440 com::Bstr bstrDestinations; 441 CHECK_ERROR2_RET(pDebugger, COMGETTER(LogRelDestinations)(bstrDestinations.asOutParam()), RTEXITCODE_FAILURE); 442 RTPrintf("Release log settings:\n"); 443 RTPrintf(" VBOX_RELEASE_LOG=%ls\n" 444 " VBOX_RELEASE_LOG_FLAGS=%ls\n" 445 " VBOX_RELEASE_LOG_DEST=%ls\n" 446 , bstrGroups.raw(), bstrFlags.raw(), bstrDestinations.raw()); 447 } 448 else 449 return errorSyntax(USAGE_DEBUGVM, "The show sub-command has no idea what '%s' might be", pszWhat); 402 450 403 451 return RTEXITCODE_SUCCESS; … … 527 575 else if (!strcmp(pszSubCmd, "setregisters")) 528 576 rcExit = handleDebugVM_SetRegisters(pArgs, ptrDebugger); 577 else if (!strcmp(pszSubCmd, "show")) 578 rcExit = handleDebugVM_Show(pArgs, ptrDebugger); 529 579 else if (!strcmp(pszSubCmd, "statistics")) 530 580 rcExit = handleDebugVM_Statistics(pArgs, ptrDebugger); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r39650 r39668 652 652 " getregisters [--cpu <id>] <reg>|all ... |\n" 653 653 " setregisters [--cpu <id>] <reg>=<value> ... |\n" 654 " show <logdbg-settings|logrel-settings> |\n" 654 655 " statistics [--reset] [--pattern <pattern>]\n" 655 656 " [--descriptions]\n" -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r39661 r39668 13185 13185 <interface 13186 13186 name="IMachineDebugger" extends="$unknown" 13187 uuid=" 1bfd2fa9-0d91-44d3-9515-368dcbb3eb4d"13187 uuid="a9abbb7c-d678-43b2-bed2-19ec0e32303d" 13188 13188 wsmap="suppress" 13189 13189 > … … 13541 13541 </attribute> 13542 13542 13543 <attribute name="log Flags" type="wstring" readonly="yes">13543 <attribute name="logDbgFlags" type="wstring" readonly="yes"> 13544 13544 <desc>The debug logger flags.</desc> 13545 13545 </attribute> 13546 13546 13547 <attribute name="log Groups" type="wstring" readonly="yes">13547 <attribute name="logDbgGroups" type="wstring" readonly="yes"> 13548 13548 <desc>The debug logger's group settings.</desc> 13549 13549 </attribute> 13550 13550 13551 <attribute name="logD estinations" type="wstring" readonly="yes">13551 <attribute name="logDbgDestinations" type="wstring" readonly="yes"> 13552 13552 <desc>The debug logger's destination settings.</desc> 13553 </attribute> 13554 13555 <attribute name="logRelFlags" type="wstring" readonly="yes"> 13556 <desc>The release logger flags.</desc> 13557 </attribute> 13558 13559 <attribute name="logRelGroups" type="wstring" readonly="yes"> 13560 <desc>The release logger's group settings.</desc> 13561 </attribute> 13562 13563 <attribute name="logRelDestinations" type="wstring" readonly="yes"> 13564 <desc>The relase logger's destination settings.</desc> 13553 13565 </attribute> 13554 13566 -
trunk/src/VBox/Main/include/MachineDebuggerImpl.h
r35638 r39668 22 22 23 23 #include "VirtualBoxBase.h" 24 #include <iprt/log.h> 24 25 25 26 class Console; … … 63 64 STDMETHOD(COMGETTER(LogEnabled)) (BOOL *aEnabled); 64 65 STDMETHOD(COMSETTER(LogEnabled)) (BOOL aEnable); 65 STDMETHOD(COMGETTER(LogFlags)) (BSTR *a_pbstrSettings); 66 STDMETHOD(COMGETTER(LogGroups)) (BSTR *a_pbstrSettings); 67 STDMETHOD(COMGETTER(LogDestinations)) (BSTR *a_pbstrSettings); 66 STDMETHOD(COMGETTER(LogDbgFlags)) (BSTR *a_pbstrSettings); 67 STDMETHOD(COMGETTER(LogDbgGroups)) (BSTR *a_pbstrSettings); 68 STDMETHOD(COMGETTER(LogDbgDestinations)) (BSTR *a_pbstrSettings); 69 STDMETHOD(COMGETTER(LogRelFlags)) (BSTR *a_pbstrSettings); 70 STDMETHOD(COMGETTER(LogRelGroups)) (BSTR *a_pbstrSettings); 71 STDMETHOD(COMGETTER(LogRelDestinations)) (BSTR *a_pbstrSettings); 68 72 STDMETHOD(COMGETTER(HWVirtExEnabled)) (BOOL *aEnabled); 69 73 STDMETHOD(COMGETTER(HWVirtExNestedPagingEnabled)) (BOOL *aEnabled); … … 106 110 bool queueSettings() const; 107 111 112 /** RTLogGetFlags, RTLogGetGroupSettings and RTLogGetDestinations function. */ 113 typedef DECLCALLBACK(int) FNLOGGETSTR(PRTLOGGER, char *, size_t); 114 /** Function pointer. */ 115 typedef FNLOGGETSTR *PFNLOGGETSTR; 116 HRESULT logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGetStr, const char *pszLogGetStr, BSTR *a_bstrSettings); 117 108 118 Console * const mParent; 109 119 // flags whether settings have been queued because -
trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
r39650 r39668 447 447 } 448 448 449 STDMETHODIMP MachineDebugger::COMGETTER(LogFlags)(BSTR *a_pbstrSettings) 450 { 451 ReturnComNotImplemented(); 452 } 453 454 STDMETHODIMP MachineDebugger::COMGETTER(LogGroups)(BSTR *a_pbstrSettings) 455 { 456 ReturnComNotImplemented(); 457 } 458 459 STDMETHODIMP MachineDebugger::COMGETTER(LogDestinations)(BSTR *a_pbstrSettings) 460 { 461 ReturnComNotImplemented(); 449 HRESULT MachineDebugger::logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGetStr, 450 const char *pszLogGetStr, BSTR *a_pbstrSettings) 451 { 452 /* Make sure the VM is powered up. */ 453 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 454 Console::SafeVMPtr ptrVM(mParent); 455 HRESULT hrc = ptrVM.rc(); 456 if (FAILED(hrc)) 457 return hrc; 458 459 /* Make sure we've got a logger. */ 460 if (!pLogger) 461 { 462 Bstr bstrEmpty; 463 bstrEmpty.cloneTo(a_pbstrSettings); 464 return S_OK; 465 } 466 467 /* Do the job. */ 468 size_t cbBuf = _1K; 469 for (;;) 470 { 471 char *pszBuf = (char *)RTMemTmpAlloc(cbBuf); 472 AssertReturn(pszBuf, E_OUTOFMEMORY); 473 474 int rc = pfnLogGetStr(pLogger, pszBuf, cbBuf); 475 if (RT_SUCCESS(rc)) 476 { 477 try 478 { 479 Bstr bstrRet(pszBuf); 480 bstrRet.detachTo(a_pbstrSettings); 481 hrc = S_OK; 482 } 483 catch (std::bad_alloc) 484 { 485 hrc = E_OUTOFMEMORY; 486 } 487 RTMemTmpFree(pszBuf); 488 return hrc; 489 } 490 RTMemTmpFree(pszBuf); 491 AssertReturn(rc == VERR_BUFFER_OVERFLOW, setError(VBOX_E_IPRT_ERROR, tr("%s returned %Rrc"), pszLogGetStr, rc)); 492 493 /* try again with a bigger buffer. */ 494 cbBuf *= 2; 495 AssertReturn(cbBuf <= _256K, setError(E_FAIL, tr("%s returns too much data"), pszLogGetStr)); 496 } 497 } 498 499 500 STDMETHODIMP MachineDebugger::COMGETTER(LogDbgFlags)(BSTR *a_pbstrSettings) 501 { 502 CheckComArgOutPointerValid(a_pbstrSettings); 503 504 AutoCaller autoCaller(this); 505 HRESULT hrc = autoCaller.rc(); 506 if (SUCCEEDED(hrc)) 507 hrc = logStringProps(RTLogGetDefaultInstance(), RTLogGetFlags, "RTGetFlags", a_pbstrSettings); 508 509 return hrc; 510 } 511 512 STDMETHODIMP MachineDebugger::COMGETTER(LogDbgGroups)(BSTR *a_pbstrSettings) 513 { 514 CheckComArgOutPointerValid(a_pbstrSettings); 515 516 AutoCaller autoCaller(this); 517 HRESULT hrc = autoCaller.rc(); 518 if (SUCCEEDED(hrc)) 519 hrc = logStringProps(RTLogGetDefaultInstance(), RTLogGetGroupSettings, "RTLogGetGroupSettings", a_pbstrSettings); 520 521 return hrc; 522 } 523 524 STDMETHODIMP MachineDebugger::COMGETTER(LogDbgDestinations)(BSTR *a_pbstrSettings) 525 { 526 CheckComArgOutPointerValid(a_pbstrSettings); 527 528 AutoCaller autoCaller(this); 529 HRESULT hrc = autoCaller.rc(); 530 if (SUCCEEDED(hrc)) 531 hrc = logStringProps(RTLogRelDefaultInstance(), RTLogGetDestinations, "RTLogGetDestinations", a_pbstrSettings); 532 533 return hrc; 534 } 535 536 537 STDMETHODIMP MachineDebugger::COMGETTER(LogRelFlags)(BSTR *a_pbstrSettings) 538 { 539 CheckComArgOutPointerValid(a_pbstrSettings); 540 541 AutoCaller autoCaller(this); 542 HRESULT hrc = autoCaller.rc(); 543 if (SUCCEEDED(hrc)) 544 hrc = logStringProps(RTLogRelDefaultInstance(), RTLogGetFlags, "RTGetFlags", a_pbstrSettings); 545 546 return hrc; 547 } 548 549 STDMETHODIMP MachineDebugger::COMGETTER(LogRelGroups)(BSTR *a_pbstrSettings) 550 { 551 CheckComArgOutPointerValid(a_pbstrSettings); 552 553 AutoCaller autoCaller(this); 554 HRESULT hrc = autoCaller.rc(); 555 if (SUCCEEDED(hrc)) 556 hrc = logStringProps(RTLogRelDefaultInstance(), RTLogGetGroupSettings, "RTLogGetGroupSettings", a_pbstrSettings); 557 558 return hrc; 559 } 560 561 STDMETHODIMP MachineDebugger::COMGETTER(LogRelDestinations)(BSTR *a_pbstrSettings) 562 { 563 CheckComArgOutPointerValid(a_pbstrSettings); 564 565 AutoCaller autoCaller(this); 566 HRESULT hrc = autoCaller.rc(); 567 if (SUCCEEDED(hrc)) 568 hrc = logStringProps(RTLogRelDefaultInstance(), RTLogGetDestinations, "RTLogGetDestinations", a_pbstrSettings); 569 570 return hrc; 462 571 } 463 572
Note:
See TracChangeset
for help on using the changeset viewer.

