VirtualBox

Changeset 39668 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Dec 20, 2011 9:46:30 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
75489
Message:

Implemented the log setting properties (read-only).

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r39661 r39668  
    1318513185  <interface
    1318613186    name="IMachineDebugger" extends="$unknown"
    13187     uuid="1bfd2fa9-0d91-44d3-9515-368dcbb3eb4d"
     13187    uuid="a9abbb7c-d678-43b2-bed2-19ec0e32303d"
    1318813188    wsmap="suppress"
    1318913189    >
     
    1354113541    </attribute>
    1354213542
    13543     <attribute name="logFlags" type="wstring" readonly="yes">
     13543    <attribute name="logDbgFlags" type="wstring" readonly="yes">
    1354413544      <desc>The debug logger flags.</desc>
    1354513545    </attribute>
    1354613546
    13547     <attribute name="logGroups" type="wstring" readonly="yes">
     13547    <attribute name="logDbgGroups" type="wstring" readonly="yes">
    1354813548      <desc>The debug logger's group settings.</desc>
    1354913549    </attribute>
    1355013550
    13551     <attribute name="logDestinations" type="wstring" readonly="yes">
     13551    <attribute name="logDbgDestinations" type="wstring" readonly="yes">
    1355213552      <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>
    1355313565    </attribute>
    1355413566
  • trunk/src/VBox/Main/include/MachineDebuggerImpl.h

    r35638 r39668  
    2222
    2323#include "VirtualBoxBase.h"
     24#include <iprt/log.h>
    2425
    2526class Console;
     
    6364    STDMETHOD(COMGETTER(LogEnabled)) (BOOL *aEnabled);
    6465    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);
    6872    STDMETHOD(COMGETTER(HWVirtExEnabled)) (BOOL *aEnabled);
    6973    STDMETHOD(COMGETTER(HWVirtExNestedPagingEnabled)) (BOOL *aEnabled);
     
    106110    bool queueSettings() const;
    107111
     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
    108118    Console * const mParent;
    109119    // flags whether settings have been queued because
  • trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp

    r39650 r39668  
    447447}
    448448
    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();
     449HRESULT 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
     500STDMETHODIMP 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
     512STDMETHODIMP 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
     524STDMETHODIMP 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
     537STDMETHODIMP 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
     549STDMETHODIMP 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
     561STDMETHODIMP 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;
    462571}
    463572
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette