Changeset 39668 in vbox for trunk/src/VBox/Main
- Timestamp:
- Dec 20, 2011 9:46:30 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 75489
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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.