VirtualBox

Changeset 40418 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 9, 2012 10:00:56 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
76749
Message:

Main: Extended IMachine and the settings XML with three tracing related properties.

Location:
trunk/src/VBox
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r40329 r40418  
    321321                     "                            [--teleporteraddress <address|empty>\n"
    322322                     "                            [--teleporterpassword <password>]\n"
     323                     "                            [--tracing-enabled on|off]\n"
     324                     "                            [--tracing-config <config-string>]\n"
     325                     "                            [--tracing-allow-vm-access on|off]\n"
    323326#if 0
    324327                     "                            [--iocache on|off]\n"
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r39882 r40418  
    196196}
    197197
     198/**
     199 * This takes care of escaping double quotes and slashes that the string might
     200 * contain.
     201 *
     202 * @param   pszName             The variable name.
     203 * @param   pbstrValue          The value.
     204 */
     205static void outputMachineReadableString(const char *pszName, Bstr const *pbstrValue)
     206{
     207    Assert(strpbrk(pszName, "\"\\") == NULL);
     208
     209    com::Utf8Str strValue(*pbstrValue);
     210    if (    strValue.isEmpty()
     211        || (   !strValue.count('"')
     212            && !strValue.count('\\')))
     213        RTPrintf("%s=\"%s\"\n", pszName, strValue.c_str());
     214    else
     215    {
     216        /* The value needs escaping. */
     217        RTPrintf("%s=\"", pszName);
     218        const char *psz = strValue.c_str();
     219        for (;;)
     220        {
     221            const char *pszNext = strpbrk(psz, "\"\\");
     222            if (!pszNext)
     223            {
     224                RTPrintf("%s", psz);
     225                break;
     226            }
     227            RTPrintf(".*s\\%c", psz - pszNext, *pszNext);
     228            psz = pszNext + 1;
     229        }
     230        RTPrintf("\"\n");
     231    }
     232}
     233
     234
    198235/* Disable global optimizations for MSC 8.0/64 to make it compile in reasonable
    199236   time. MSC 7.1/32 doesn't have quite as much trouble with it, but still
     
    211248    HRESULT rc;
    212249
     250#define SHOW_BOOLEAN_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman) \
     251    do \
     252    { \
     253        BOOL f; \
     254        CHECK_ERROR2_RET(machine, COMGETTER(a_Prop)(&f), hrcCheck); \
     255        if (details == VMINFO_MACHINEREADABLE) \
     256            RTPrintf( a_szMachine "=\"%s\"\n", f ? "on" : "off"); \
     257        else \
     258            RTPrintf("%-16s %s\n", a_szHuman ":", f ? "on" : "off"); \
     259    } while (0)
     260
     261#define SHOW_STRING_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman) \
     262    do \
     263    { \
     264        Bstr bstr; \
     265        CHECK_ERROR2_RET(machine, COMGETTER(a_Prop)(bstr.asOutParam()), hrcCheck); \
     266        if (details == VMINFO_MACHINEREADABLE) \
     267            outputMachineReadableString(a_szMachine, &bstr); \
     268        else \
     269            RTPrintf("%-16s %ls\n", a_szHuman ":", bstr.raw()); \
     270    } while (0)
     271
     272
    213273    /*
    214274     * The rules for output in -argdump format:
    215      * 1) the key part (the [0-9a-zA-Z_]+ string before the '=' delimiter)
     275     * 1) the key part (the [0-9a-zA-Z_\-]+ string before the '=' delimiter)
    216276     *    is all lowercase for "VBoxManage modifyvm" parameters. Any
    217277     *    other values printed are in CamelCase.
     
    681741    else
    682742        RTPrintf("Teleporter Password: %ls\n", teleporterPassword.raw());
     743
     744    SHOW_BOOLEAN_PROP(machine, TracingEnabled, "tracing-enabled", "Tracing Enabled");
     745    SHOW_BOOLEAN_PROP(machine, AllowTracingToAccessVM, "tracing-allow-vm-access", "Allow Tracing to Access VM");
     746    SHOW_STRING_PROP(machine, TracingConfig, "tracing-config", "Tracing Configuration");
    683747
    684748    /*
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r40324 r40418  
    164164    MODIFYVM_TELEPORTER_ADDRESS,
    165165    MODIFYVM_TELEPORTER_PASSWORD,
     166    MODIFYVM_TRACING_ENABLED,
     167    MODIFYVM_TRACING_CONFIG,
     168    MODIFYVM_TRACING_ALLOW_VM_ACCESS,
    166169    MODIFYVM_HARDWARE_UUID,
    167170    MODIFYVM_HPET,
     
    299302    { "--teleporteraddress",        MODIFYVM_TELEPORTER_ADDRESS,        RTGETOPT_REQ_STRING },
    300303    { "--teleporterpassword",       MODIFYVM_TELEPORTER_PASSWORD,       RTGETOPT_REQ_STRING },
     304    { "--tracing-enabled",          MODIFYVM_TRACING_ENABLED,           RTGETOPT_REQ_BOOL_ONOFF },
     305    { "--tracing-config",           MODIFYVM_TRACING_CONFIG,            RTGETOPT_REQ_STRING },
     306    { "--tracing-allow-vm-access",  MODIFYVM_TRACING_ALLOW_VM_ACCESS,   RTGETOPT_REQ_BOOL_ONOFF },
    301307    { "--hardwareuuid",             MODIFYVM_HARDWARE_UUID,             RTGETOPT_REQ_STRING },
    302308    { "--hpet",                     MODIFYVM_HPET,                      RTGETOPT_REQ_BOOL_ONOFF },
     
    22042210            }
    22052211
     2212            case MODIFYVM_TRACING_ENABLED:
     2213            {
     2214                CHECK_ERROR(machine, COMSETTER(TracingEnabled)(ValueUnion.f));
     2215                break;
     2216            }
     2217
     2218            case MODIFYVM_TRACING_CONFIG:
     2219            {
     2220                CHECK_ERROR(machine, COMSETTER(TracingConfig)(Bstr(ValueUnion.psz).raw()));
     2221                break;
     2222            }
     2223
     2224            case MODIFYVM_TRACING_ALLOW_VM_ACCESS:
     2225            {
     2226                CHECK_ERROR(machine, COMSETTER(AllowTracingToAccessVM)(ValueUnion.f));
     2227                break;
     2228            }
     2229
    22062230            case MODIFYVM_FAULT_TOLERANCE:
    22072231            {
  • trunk/src/VBox/Main/glue/string.cpp

    r36530 r40418  
    8585        throw std::bad_alloc();
    8686    memcpy(*pstr, c_str(), cb);
     87}
     88
     89HRESULT Utf8Str::cloneToEx(char **pstr) const
     90{
     91    size_t cb = length() + 1;
     92    *pstr = (char*)nsMemory::Alloc(cb);
     93    if (RT_UNLIKELY(!*pstr))
     94        return E_OUTOFMEMORY;
     95    memcpy(*pstr, c_str(), cb);
     96    return S_OK;
    8797}
    8898#endif
     
    188198}
    189199
     200/**
     201 * A variant of Utf8Str::copyFrom that does not throw any exceptions but returns
     202 * E_OUTOFMEMORY instead.
     203 *
     204 * @param   a_pbstr         The source string.
     205 * @returns S_OK or E_OUTOFMEMORY.
     206 */
     207HRESULT Utf8Str::copyFromEx(CBSTR a_pbstr)
     208{
     209    if (a_pbstr && *a_pbstr)
     210    {
     211        int vrc = RTUtf16ToUtf8Ex((PCRTUTF16)a_pbstr,
     212                                  RTSTR_MAX,        // size_t cwcString: translate entire string
     213                                  &m_psz,           // char **ppsz: output buffer
     214                                  0,                // size_t cch: if 0, func allocates buffer in *ppsz
     215                                  &m_cch);          // size_t *pcch: receives the size of the output string, excluding the terminator.
     216        if (RT_SUCCESS(vrc))
     217            m_cbAllocated = m_cch + 1;
     218        else
     219        {
     220            if (   vrc != VERR_NO_STR_MEMORY
     221                && vrc != VERR_NO_MEMORY)
     222            {
     223                /* ASSUME: input is valid Utf-16. Fake out of memory error. */
     224                AssertLogRelMsgFailed(("%Rrc %.*Rhxs\n", vrc, RTUtf16Len(a_pbstr) * sizeof(RTUTF16), a_pbstr));
     225            }
     226
     227            m_cch = 0;
     228            m_cbAllocated = 0;
     229            m_psz = NULL;
     230
     231            return E_OUTOFMEMORY;
     232        }
     233    }
     234    else
     235    {
     236        m_cch = 0;
     237        m_cbAllocated = 0;
     238        m_psz = NULL;
     239    }
     240    return S_OK;
     241}
     242
    190243} /* namespace com */
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r40352 r40418  
    488488      -->
    489489    </const>
     490    <const name="v1_13"     value="15">
     491      <desc>Settings version "1.13", written by VirtualBox 4.2.x.</desc>
     492      <!--
     493          Machine changes: tracing config;
     494      -->
     495    </const>
    490496
    491497    <const name="Future"     value="99999">
    492       <desc>Settings version greater than "1.12", written by a future VirtualBox version.</desc>
     498      <desc>Settings version greater than "1.13", written by a future VirtualBox version.</desc>
    493499    </const>
    494500  </enum>
     
    35333539      </desc>
    35343540    </attribute>
    3535 
    35363541  </interface>
    35373542
     
    36833688  <interface
    36843689    name="IMachine" extends="$unknown"
    3685     uuid="116704af-f221-4d9e-8697-c11331622907"
     3690    uuid="b0ce140d-02b6-469a-80f5-412ef8e1318e"
    36863691    wsmap="managed"
    36873692    >
     
    42824287    </attribute>
    42834288
    4284     <attribute name="bandwidthControl" type="IBandwidthControl" readonly="yes">
    4285       <desc>
    4286         Bandwidth control manager.
    4287       </desc>
    4288     </attribute>
    4289 
    42904289    <attribute name="pciDeviceAssignments" type="IPciDeviceAttachment" readonly="yes" safearray="yes">
    42914290      <desc>Array of PCI devices assigned to this machine, to get list of all
     
    42954294        virtual hardware config. Usually, this list keeps host's physical
    42964295        devices assigned to the particular machine.
     4296      </desc>
     4297    </attribute>
     4298
     4299    <attribute name="bandwidthControl" type="IBandwidthControl" readonly="yes">
     4300      <desc>
     4301        Bandwidth control manager.
     4302      </desc>
     4303    </attribute>
     4304
     4305    <attribute name="tracingEnabled" type="boolean">
     4306      <desc>
     4307        Enables the tracing facility in the VMM (including PDM devices +
     4308        drivers).  The VMM will consume about 0.5MB of more memory when
     4309        enabled and there may be some extra overhead from tracepoints that are
     4310        always enabled.
     4311      </desc>
     4312    </attribute>
     4313
     4314    <attribute name="tracingConfig" type="wstring">
     4315      <desc>
     4316        Tracepoint configuration to apply at startup when
     4317        <link to="IMachine::tracingEnabled" /> is true.  The string specifies
     4318        a space separated of tracepoint group names to enable.  The special
     4319        group 'all' enables all tracepoints.  Check DBGFR3TracingConfig for
     4320        more details on available tracepoint groups and such.
     4321
     4322        Note that on hosts supporting DTrace (or similar), a lot of the
     4323        tracepoints may be implemented exclusivly as DTrace probes.  So, the
     4324        effect of the same config may differ between Solaris and Windows for
     4325        example.
     4326      </desc>
     4327    </attribute>
     4328
     4329    <attribute name="allowTracingToAccessVM" type="boolean">
     4330      <desc>
     4331        Enables tracepoints in PDM devices and drivers to use the VMCPU or VM
     4332        structures when firing off trace points.  This is especially useful
     4333        with DTrace tracepoints, as it allow you to use the VMCPU or VM pointer
     4334        to obtail useful information such as guest register state.
     4335
     4336        This is disabled by default because devices and drivers normally has no
     4337        business accessing the VMCPU or VM structures, and are therefore unable
     4338        to get any pointers to these.
    42974339      </desc>
    42984340    </attribute>
  • trunk/src/VBox/Main/include/MachineImpl.h

    r40084 r40418  
    11/* $Id$ */
    22/** @file
    3  * VirtualBox COM class implementation
     3 * Implementation of IMachine in VBoxSVC - Header.
    44 */
    55
    66/*
    7  * Copyright (C) 2006-2011 Oracle Corporation
     7 * Copyright (C) 2006-2012 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    297297        typedef std::list<ComObjPtr<PciDeviceAttachment> > PciDeviceAssignmentList;
    298298        PciDeviceAssignmentList mPciDeviceAssignments;
     299
     300        settings::Debugging  mDebugging;
    299301    };
    300302
     
    468470    STDMETHOD(COMGETTER(PciDeviceAssignments))(ComSafeArrayOut(IPciDeviceAttachment *, aAssignments));
    469471    STDMETHOD(COMGETTER(BandwidthControl))(IBandwidthControl **aBandwidthControl);
     472    STDMETHOD(COMGETTER(TracingEnabled))(BOOL *pfEnabled);
     473    STDMETHOD(COMSETTER(TracingEnabled))(BOOL fEnabled);
     474    STDMETHOD(COMGETTER(TracingConfig))(BSTR *pbstrConfig);
     475    STDMETHOD(COMSETTER(TracingConfig))(IN_BSTR bstrConfig);
     476    STDMETHOD(COMGETTER(AllowTracingToAccessVM))(BOOL *pfAllow);
     477    STDMETHOD(COMSETTER(AllowTracingToAccessVM))(BOOL fAllow);
    470478
    471479    // IMachine methods
     
    786794                         const Guid &aCurSnapshotId,
    787795                         Snapshot *aParentSnapshot);
    788     HRESULT loadHardware(const settings::Hardware &data);
     796    HRESULT loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg);
     797    HRESULT loadDebugging(const settings::Debugging *pDbg);
    789798    HRESULT loadStorageControllers(const settings::Storage &data,
    790799                                   const Guid *puuidRegistry,
     
    826835    void copyMachineDataToSettings(settings::MachineConfigFile &config);
    827836    HRESULT saveAllSnapshots(settings::MachineConfigFile &config);
    828     HRESULT saveHardware(settings::Hardware &data);
     837    HRESULT saveHardware(settings::Hardware &data, settings::Debugging *pDbg);
    829838    HRESULT saveStorageControllers(settings::Storage &data);
    830839    HRESULT saveStorageDevices(ComObjPtr<StorageController> aStorageController,
     
    11951204                 IN_GUID aSnapshotId,
    11961205                 const Utf8Str &aStateFilePath);
    1197     HRESULT init(Machine *aMachine,
    1198                  const settings::Hardware &hardware,
    1199                  const settings::Storage &storage,
    1200                  IN_GUID aSnapshotId,
    1201                  const Utf8Str &aStateFilePath);
     1206    HRESULT initFromSettings(Machine *aMachine,
     1207                             const settings::Hardware &hardware,
     1208                             const settings::Debugging *pDbg,
     1209                             const settings::Storage &storage,
     1210                             IN_GUID aSnapshotId,
     1211                             const Utf8Str &aStateFilePath);
    12021212    void uninit();
    12031213
  • trunk/src/VBox/Main/include/VirtualBoxBase.h

    r38533 r40418  
    351351
    352352/**
    353  * Checks that the string argument is not a NULL or empty string and returns
    354  * E_INVALIDARG + extended error info on failure.
    355  * @param arg   Input string argument (BSTR etc.).
    356  */
    357 #define CheckComArgStrNotEmptyOrNull(arg) \
    358     do { \
    359         if (RT_UNLIKELY((arg) == NULL || *(arg) == '\0')) \
    360             return setError(E_INVALIDARG, \
    361                 tr("Argument %s is empty or NULL"), #arg); \
     353 * Checks that a string input argument is valid (not NULL or obviously invalid
     354 * pointer), returning E_INVALIDARG + extended error info if invalid.
     355 * @param a_bstrIn  Input string argument (IN_BSTR).
     356 */
     357#define CheckComArgStr(a_bstrIn) \
     358    do { \
     359        IN_BSTR const bstrInCheck = (a_bstrIn); /* type check */ \
     360        if (RT_UNLIKELY(!RT_VALID_PTR(bstrInCheck))) \
     361            return setError(E_INVALIDARG, tr("Argument %s is an invalid pointer"), #a_bstrIn); \
     362    } while (0)
     363/**
     364 * Checks that the string argument is not a NULL, a invalid pointer or an empty
     365 * string, returning E_INVALIDARG + extended error info on failure.
     366 * @param a_bstrIn  Input string argument (BSTR etc.).
     367 */
     368#define CheckComArgStrNotEmptyOrNull(a_bstrIn) \
     369    do { \
     370        IN_BSTR const bstrInCheck = (a_bstrIn); /* type check */ \
     371        if (RT_UNLIKELY(!RT_VALID_PTR(bstrInCheck) || *(bstrInCheck) == '\0')) \
     372            return setError(E_INVALIDARG, tr("Argument %s is empty or an invalid pointer"), #a_bstrIn); \
    362373    } while (0)
    363374
     
    959970     *  Stores the current data pointer in the backup area, allocates new data
    960971     *  using the copy constructor on current data and makes new data active.
     972     *
     973     *  @deprecated Use backupEx to avoid throwing wild out-of-memory exceptions.
    961974     */
    962975    void backup()
     
    969982            this->mData = pNewData;
    970983        }
     984    }
     985
     986    /**
     987     *  Stores the current data pointer in the backup area, allocates new data
     988     *  using the copy constructor on current data and makes new data active.
     989     *
     990     *  @returns S_OK, E_OUTOFMEMORY or E_FAIL (internal error).
     991     */
     992    HRESULT backupEx()
     993    {
     994        AssertMsgReturn(this->mData, ("data must not be NULL"), E_FAIL);
     995        if (this->mData && !mBackupData)
     996        {
     997            try
     998            {
     999                D *pNewData = new D(*this->mData);
     1000                mBackupData = this->mData;
     1001                this->mData = pNewData;
     1002            }
     1003            catch (std::bad_alloc &)
     1004            {
     1005                return E_OUTOFMEMORY;
     1006            }
     1007        }
     1008        return S_OK;
    9711009    }
    9721010
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r40323 r40418  
    11/* $Id$ */
    22/** @file
    3  * VBox Console COM Class implementation
     3 * VBox Console COM Class implementation - VM Configuration Bits.
    44 *
    55 * @remark  We've split out the code that the 64-bit VC++ v8 compiler finds
     
    1010
    1111/*
    12  * Copyright (C) 2006-2011 Oracle Corporation
     12 * Copyright (C) 2006-2012 Oracle Corporation
    1313 *
    1414 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    25882588            InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
    25892589            InsertConfigNode(pInst,    "Config", &pCfg);
    2590             hrc = BusMgr->assignPciDevice("acpi", pInst);                               H();
     2590            hrc = BusMgr->assignPciDevice("acpi", pInst);                                   H();
    25912591
    25922592            InsertConfigInteger(pCfg,  "RamSize",          cbRam);
     
    26542654
    26552655        /*
    2656          * Set up the default DBGF search paths if all is cool so far.
     2656         * Configure DBGF (Debug(ger) Facility).
    26572657         */
    26582658        {
     
    26602660            InsertConfigNode(pRoot, "DBGF", &pDbgf);
    26612661
    2662             hrc = pMachine->COMGETTER(SettingsFilePath)(bstr.asOutParam());         H();
     2662            /* Paths to search for debug info and such things. */
     2663            hrc = pMachine->COMGETTER(SettingsFilePath)(bstr.asOutParam());                 H();
    26632664            Utf8Str strSettingsPath(bstr);
    26642665            bstr.setNull();
     
    26762677
    26772678            InsertConfigString(pDbgf, "Path", strPath.c_str());
     2679
     2680            /* Tracing configuration. */
     2681            BOOL fTracingEnabled;
     2682            hrc = pMachine->COMGETTER(TracingEnabled)(&fTracingEnabled);                    H();
     2683            if (fTracingEnabled)
     2684                InsertConfigInteger(pDbgf, "TracingEnabled", 1);
     2685
     2686            hrc = pMachine->COMGETTER(TracingConfig)(bstr.asOutParam());                    H();
     2687            if (fTracingEnabled)
     2688                InsertConfigString(pDbgf, "TracingConfig", bstr);
     2689
     2690            BOOL fAllowTracingToAccessVM;
     2691            hrc = pMachine->COMGETTER(AllowTracingToAccessVM)(&fAllowTracingToAccessVM);    H();
     2692            if (fAllowTracingToAccessVM)
     2693                InsertConfigInteger(pPDM, "AllowTracingToAccessVM", 1);
    26782694        }
    26792695    }
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r40361 r40418  
    63646364}
    63656365
     6366STDMETHODIMP Machine::COMGETTER(TracingEnabled)(BOOL *pfEnabled)
     6367{
     6368    CheckComArgOutPointerValid(pfEnabled);
     6369    AutoCaller autoCaller(this);
     6370    HRESULT hrc = autoCaller.rc();
     6371    if (SUCCEEDED(hrc))
     6372    {
     6373        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     6374        *pfEnabled = mHWData->mDebugging.fTracingEnabled;
     6375    }
     6376    return hrc;
     6377}
     6378
     6379STDMETHODIMP Machine::COMSETTER(TracingEnabled)(BOOL fEnabled)
     6380{
     6381    AutoCaller autoCaller(this);
     6382    HRESULT hrc = autoCaller.rc();
     6383    if (SUCCEEDED(hrc))
     6384    {
     6385        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     6386        hrc = checkStateDependency(MutableStateDep);
     6387        if (SUCCEEDED(hrc))
     6388        {
     6389            hrc = mHWData.backupEx();
     6390            if (SUCCEEDED(hrc))
     6391            {
     6392                setModified(IsModified_MachineData);
     6393                mHWData->mDebugging.fTracingEnabled = fEnabled != FALSE;
     6394            }
     6395        }
     6396    }
     6397    return hrc;
     6398}
     6399
     6400STDMETHODIMP Machine::COMGETTER(TracingConfig)(BSTR *pbstrConfig)
     6401{
     6402    CheckComArgOutPointerValid(pbstrConfig);
     6403    AutoCaller autoCaller(this);
     6404    HRESULT hrc = autoCaller.rc();
     6405    if (SUCCEEDED(hrc))
     6406    {
     6407        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     6408        hrc = mHWData->mDebugging.strTracingConfig.cloneToEx(pbstrConfig);
     6409    }
     6410    return hrc;
     6411}
     6412
     6413STDMETHODIMP Machine::COMSETTER(TracingConfig)(IN_BSTR bstrConfig)
     6414{
     6415    CheckComArgStr(bstrConfig);
     6416    AutoCaller autoCaller(this);
     6417    HRESULT hrc = autoCaller.rc();
     6418    if (SUCCEEDED(hrc))
     6419    {
     6420        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     6421        hrc = checkStateDependency(MutableStateDep);
     6422        if (SUCCEEDED(hrc))
     6423        {
     6424            hrc = mHWData.backupEx();
     6425            if (SUCCEEDED(hrc))
     6426            {
     6427                hrc = mHWData->mDebugging.strTracingConfig.cloneEx(bstrConfig);
     6428                if (SUCCEEDED(hrc))
     6429                    setModified(IsModified_MachineData);
     6430            }
     6431        }
     6432    }
     6433    return hrc;
     6434
     6435}
     6436
     6437STDMETHODIMP Machine::COMGETTER(AllowTracingToAccessVM)(BOOL *pfAllow)
     6438{
     6439    CheckComArgOutPointerValid(pfAllow);
     6440    AutoCaller autoCaller(this);
     6441    HRESULT hrc = autoCaller.rc();
     6442    if (SUCCEEDED(hrc))
     6443    {
     6444        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     6445        *pfAllow = mHWData->mDebugging.fAllowTracingToAccessVM;
     6446    }
     6447    return hrc;
     6448}
     6449
     6450STDMETHODIMP Machine::COMSETTER(AllowTracingToAccessVM)(BOOL fAllow)
     6451{
     6452    AutoCaller autoCaller(this);
     6453    HRESULT hrc = autoCaller.rc();
     6454    if (SUCCEEDED(hrc))
     6455    {
     6456        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     6457        hrc = checkStateDependency(MutableStateDep);
     6458        if (SUCCEEDED(hrc))
     6459        {
     6460            hrc = mHWData.backupEx();
     6461            if (SUCCEEDED(hrc))
     6462            {
     6463                setModified(IsModified_MachineData);
     6464                mHWData->mDebugging.fAllowTracingToAccessVM = fAllow != FALSE;
     6465            }
     6466        }
     6467    }
     6468    return hrc;
     6469}
     6470
     6471
     6472
    63666473STDMETHODIMP Machine::CloneTo(IMachine *pTarget, CloneMode_T mode, ComSafeArrayIn(CloneOptions_T, options), IProgress **pProgress)
    63676474{
     
    77077814
    77087815    // hardware data
    7709     rc = loadHardware(config.hardwareMachine);
     7816    rc = loadHardware(config.hardwareMachine, &config.debugging);
    77107817    if (FAILED(rc)) return rc;
    77117818
     
    77757882    ComObjPtr<SnapshotMachine> pSnapshotMachine;
    77767883    pSnapshotMachine.createObject();
    7777     rc = pSnapshotMachine->init(this,
    7778                                 data.hardware,
    7779                                 data.storage,
    7780                                 data.uuid.ref(),
    7781                                 strStateFile);
     7884    rc = pSnapshotMachine->initFromSettings(this,
     7885                                            data.hardware,
     7886                                            &data.debugging,
     7887                                            data.storage,
     7888                                            data.uuid.ref(),
     7889                                            strStateFile);
    77827890    if (FAILED(rc)) return rc;
    77837891
     
    78227930
    78237931/**
    7824  *  @param aNode    <Hardware> node.
     7932 *  Loads settings into mHWData.
     7933 *
     7934 *  @param data     Reference to the hardware settings.
     7935 *  @param pDbg     Pointer to the debugging settings.
    78257936 */
    7826 HRESULT Machine::loadHardware(const settings::Hardware &data)
     7937HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg)
    78277938{
    78287939    AssertReturn(!isSessionMachine(), E_FAIL);
     
    80518162        }
    80528163
     8164        /*
     8165         * (The following isn't really real hardware, but it lives in HWData
     8166         * for reasons of convenience.)
     8167         */
     8168
    80538169#ifdef VBOX_WITH_GUEST_PROPS
    80548170        /* Guest properties (optional) */
     
    80668182        mHWData->mGuestPropertyNotificationPatterns = data.strNotificationPatterns;
    80678183#endif /* VBOX_WITH_GUEST_PROPS defined */
     8184
     8185        rc = loadDebugging(pDbg);
     8186        if (FAILED(rc))
     8187            return rc;
    80688188    }
    80698189    catch(std::bad_alloc &)
     
    80748194    AssertComRC(rc);
    80758195    return rc;
     8196}
     8197
     8198/**
     8199 * Called from Machine::loadHardware() to load the debugging settings of the
     8200 * machine.
     8201 *
     8202 * @param   pDbg        Pointer to the settings.
     8203 */
     8204HRESULT Machine::loadDebugging(const settings::Debugging *pDbg)
     8205{
     8206    mHWData->mDebugging = *pDbg;
     8207    /* no more processing currently required, this will probably change. */
     8208    return S_OK;
    80768209}
    80778210
     
    88939026    /// @todo Live Migration:        config.fTeleported = (mData->mMachineState == MachineState_Teleported);
    88949027
    8895     HRESULT rc = saveHardware(config.hardwareMachine);
     9028    HRESULT rc = saveHardware(config.hardwareMachine, &config.debugging);
    88969029    if (FAILED(rc)) throw rc;
    88979030
     
    89669099 *  given node is empty.
    89679100 *
    8968  *  @param aNode    <Hardware> node to save the VM hardware configuration to.
     9101 *  @param data     Reference to the settings object for the hardware config.
     9102 *  @param pDbg     Pointer to the settings object for the debugging config
     9103 *                  which happens to live in mHWData.
    89699104 */
    8970 HRESULT Machine::saveHardware(settings::Hardware &data)
     9105HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDbg)
    89719106{
    89729107    HRESULT rc = S_OK;
     
    91989333        mData->mGuestPropertiesModified = FALSE;
    91999334#endif /* VBOX_WITH_GUEST_PROPS defined */
     9335
     9336        *pDbg = mHWData->mDebugging;
    92009337    }
    92019338    catch(std::bad_alloc &)
  • trunk/src/VBox/Main/src-server/SnapshotImpl.cpp

    r40257 r40418  
    773773        data.strStateFile.setNull();
    774774
    775     HRESULT rc = m->pMachine->saveHardware(data.hardware);
     775    HRESULT rc = m->pMachine->saveHardware(data.hardware, &data.debugging);
    776776    if (FAILED(rc)) return rc;
    777777
     
    10781078 *  @note Doesn't lock anything.
    10791079 */
    1080 HRESULT SnapshotMachine::init(Machine *aMachine,
    1081                               const settings::Hardware &hardware,
    1082                               const settings::Storage &storage,
    1083                               IN_GUID aSnapshotId,
    1084                               const Utf8Str &aStateFilePath)
     1080HRESULT SnapshotMachine::initFromSettings(Machine *aMachine,
     1081                                          const settings::Hardware &hardware,
     1082                                          const settings::Debugging *pDbg,
     1083                                          const settings::Storage &storage,
     1084                                          IN_GUID aSnapshotId,
     1085                                          const Utf8Str &aStateFilePath)
    10851086{
    10861087    LogFlowThisFuncEnter();
     
    11561157    /* load hardware and harddisk settings */
    11571158
    1158     HRESULT rc = loadHardware(hardware);
     1159    HRESULT rc = loadHardware(hardware, pDbg);
    11591160    if (SUCCEEDED(rc))
    11601161        rc = loadStorageControllers(storage,
  • trunk/src/VBox/Main/xml/Settings.cpp

    r40066 r40418  
    834834            break;
    835835
     836        case SettingsVersion_v1_13:
     837            pcszVersion = "1.13";
     838            break;
     839
    836840        case SettingsVersion_Future:
    837841            // can be set if this code runs on XML files that were created by a future version of VBox;
    838842            // in that case, downgrade to current version when writing since we can't write future versions...
    839             pcszVersion = "1.12";
    840             m->sv = SettingsVersion_v1_12;
     843            pcszVersion = "1.13";
     844            m->sv = SettingsVersion_v1_13;
    841845            break;
    842846
     
    17551759                  && (storage               == s.storage)                   // deep compare
    17561760                  && (llChildSnapshots      == s.llChildSnapshots)          // deep compare
     1761                  && debugging              == s.debugging
    17571762                )
    17581763           );
     
    31603165
    31613166/**
     3167 * Called for reading the <Debugging> element under <Machine> or <Snapshot>.
     3168 */
     3169void MachineConfigFile::readDebugging(const xml::ElementNode *pElmDebugging, Debugging *pDbg)
     3170{
     3171    if (!pElmDebugging || m->sv < SettingsVersion_v1_13)
     3172        return;
     3173
     3174    const xml::ElementNode * const pelmTracing = pElmDebugging->findChildElement("Tracing");
     3175    if (pelmTracing)
     3176    {
     3177        pelmTracing->getAttributeValue("enabled", pDbg->fTracingEnabled);
     3178        pelmTracing->getAttributeValue("allowTracingToAccessVM", pDbg->fAllowTracingToAccessVM);
     3179        pelmTracing->getAttributeValue("config", pDbg->strTracingConfig);
     3180    }
     3181}
     3182
     3183/**
    31623184 * Called initially for the <Snapshot> element under <Machine>, if present,
    31633185 * to store the snapshot's data into the given Snapshot structure (which is
     
    32313253        // with data from old DVDDrive and FloppyDrive elements
    32323254        readDVDAndFloppies_pre1_9(*pelmHardware, snap.storage);
     3255
     3256    readDebugging(elmSnapshot.findChildElement("Debugging"), &snap.debugging);
    32333257}
    32343258
     
    33793403            else if (pelmMachineChild->nameEquals("MediaRegistry"))
    33803404                readMediaRegistry(*pelmMachineChild, mediaRegistry);
     3405            else if (pelmMachineChild->nameEquals("Debugging"))
     3406                readDebugging(pelmMachineChild, &debugging);
    33813407        }
    33823408
     
    43014327
    43024328/**
     4329 * Creates a <Debugging> node under elmParent and then writes out the XML
     4330 * keys under that. Called for both the <Machine> node and for snapshots.
     4331 *
     4332 * @param pElmParent    Pointer to the parent element.
     4333 * @param pDbg          Pointer to the debugging settings.
     4334 */
     4335void MachineConfigFile::buildDebuggingXML(xml::ElementNode *pElmParent, const Debugging *pDbg)
     4336{
     4337    if (m->sv < SettingsVersion_v1_13 || pDbg->areDefaultSettings())
     4338        return;
     4339
     4340    xml::ElementNode *pElmDebugging = pElmParent->createChild("Debugging");
     4341    xml::ElementNode *pElmTracing   = pElmDebugging->createChild("Tracing");
     4342    pElmTracing->setAttribute("enabled", pDbg->fTracingEnabled);
     4343    pElmTracing->setAttribute("allowTracingToAccessVM", pDbg->fAllowTracingToAccessVM);
     4344    pElmTracing->setAttribute("config", pDbg->strTracingConfig);
     4345}
     4346
     4347/**
    43034348 * Writes a single snapshot into the DOM tree. Initially this gets called from MachineConfigFile::write()
    43044349 * for the root snapshot of a machine, if present; elmParent then points to the <Snapshots> node under the
     
    43294374                                    // we only skip removable media for OVF, but we never get here for OVF
    43304375                                    // since snapshots never get written then
     4376    buildDebuggingXML(pelmSnapshot, &snap.debugging);
    43314377
    43324378    if (snap.llChildSnapshots.size())
     
    44764522                               !!(fl & BuildMachineXML_SkipRemovableMedia),
    44774523                               pllElementsWithUuidAttributes);
     4524    buildDebuggingXML(&elmMachine, &debugging);
    44784525}
    44794526
     
    45914638void MachineConfigFile::bumpSettingsVersionIfNeeded()
    45924639{
     4640    if (m->sv < SettingsVersion_v1_13)
     4641    {
     4642        // VirtualBox 4.2 adds tracing.
     4643        if (!debugging.areDefaultSettings())
     4644            m->sv = SettingsVersion_v1_13;
     4645    }
     4646
    45934647    if (m->sv < SettingsVersion_v1_12)
    45944648    {
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