Changeset 40418 in vbox for trunk/src/VBox
- Timestamp:
- Mar 9, 2012 10:00:56 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 76749
- Location:
- trunk/src/VBox
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r40329 r40418 321 321 " [--teleporteraddress <address|empty>\n" 322 322 " [--teleporterpassword <password>]\n" 323 " [--tracing-enabled on|off]\n" 324 " [--tracing-config <config-string>]\n" 325 " [--tracing-allow-vm-access on|off]\n" 323 326 #if 0 324 327 " [--iocache on|off]\n" -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r39882 r40418 196 196 } 197 197 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 */ 205 static 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 198 235 /* Disable global optimizations for MSC 8.0/64 to make it compile in reasonable 199 236 time. MSC 7.1/32 doesn't have quite as much trouble with it, but still … … 211 248 HRESULT rc; 212 249 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 213 273 /* 214 274 * 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) 216 276 * is all lowercase for "VBoxManage modifyvm" parameters. Any 217 277 * other values printed are in CamelCase. … … 681 741 else 682 742 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"); 683 747 684 748 /* -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r40324 r40418 164 164 MODIFYVM_TELEPORTER_ADDRESS, 165 165 MODIFYVM_TELEPORTER_PASSWORD, 166 MODIFYVM_TRACING_ENABLED, 167 MODIFYVM_TRACING_CONFIG, 168 MODIFYVM_TRACING_ALLOW_VM_ACCESS, 166 169 MODIFYVM_HARDWARE_UUID, 167 170 MODIFYVM_HPET, … … 299 302 { "--teleporteraddress", MODIFYVM_TELEPORTER_ADDRESS, RTGETOPT_REQ_STRING }, 300 303 { "--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 }, 301 307 { "--hardwareuuid", MODIFYVM_HARDWARE_UUID, RTGETOPT_REQ_STRING }, 302 308 { "--hpet", MODIFYVM_HPET, RTGETOPT_REQ_BOOL_ONOFF }, … … 2204 2210 } 2205 2211 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 2206 2230 case MODIFYVM_FAULT_TOLERANCE: 2207 2231 { -
trunk/src/VBox/Main/glue/string.cpp
r36530 r40418 85 85 throw std::bad_alloc(); 86 86 memcpy(*pstr, c_str(), cb); 87 } 88 89 HRESULT 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; 87 97 } 88 98 #endif … … 188 198 } 189 199 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 */ 207 HRESULT 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 190 243 } /* namespace com */ -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r40352 r40418 488 488 --> 489 489 </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> 490 496 491 497 <const name="Future" value="99999"> 492 <desc>Settings version greater than "1.1 2", written by a future VirtualBox version.</desc>498 <desc>Settings version greater than "1.13", written by a future VirtualBox version.</desc> 493 499 </const> 494 500 </enum> … … 3533 3539 </desc> 3534 3540 </attribute> 3535 3536 3541 </interface> 3537 3542 … … 3683 3688 <interface 3684 3689 name="IMachine" extends="$unknown" 3685 uuid=" 116704af-f221-4d9e-8697-c11331622907"3690 uuid="b0ce140d-02b6-469a-80f5-412ef8e1318e" 3686 3691 wsmap="managed" 3687 3692 > … … 4282 4287 </attribute> 4283 4288 4284 <attribute name="bandwidthControl" type="IBandwidthControl" readonly="yes">4285 <desc>4286 Bandwidth control manager.4287 </desc>4288 </attribute>4289 4290 4289 <attribute name="pciDeviceAssignments" type="IPciDeviceAttachment" readonly="yes" safearray="yes"> 4291 4290 <desc>Array of PCI devices assigned to this machine, to get list of all … … 4295 4294 virtual hardware config. Usually, this list keeps host's physical 4296 4295 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. 4297 4339 </desc> 4298 4340 </attribute> -
trunk/src/VBox/Main/include/MachineImpl.h
r40084 r40418 1 1 /* $Id$ */ 2 2 /** @file 3 * VirtualBox COM class implementation3 * Implementation of IMachine in VBoxSVC - Header. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 297 297 typedef std::list<ComObjPtr<PciDeviceAttachment> > PciDeviceAssignmentList; 298 298 PciDeviceAssignmentList mPciDeviceAssignments; 299 300 settings::Debugging mDebugging; 299 301 }; 300 302 … … 468 470 STDMETHOD(COMGETTER(PciDeviceAssignments))(ComSafeArrayOut(IPciDeviceAttachment *, aAssignments)); 469 471 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); 470 478 471 479 // IMachine methods … … 786 794 const Guid &aCurSnapshotId, 787 795 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); 789 798 HRESULT loadStorageControllers(const settings::Storage &data, 790 799 const Guid *puuidRegistry, … … 826 835 void copyMachineDataToSettings(settings::MachineConfigFile &config); 827 836 HRESULT saveAllSnapshots(settings::MachineConfigFile &config); 828 HRESULT saveHardware(settings::Hardware &data );837 HRESULT saveHardware(settings::Hardware &data, settings::Debugging *pDbg); 829 838 HRESULT saveStorageControllers(settings::Storage &data); 830 839 HRESULT saveStorageDevices(ComObjPtr<StorageController> aStorageController, … … 1195 1204 IN_GUID aSnapshotId, 1196 1205 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); 1202 1212 void uninit(); 1203 1213 -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r38533 r40418 351 351 352 352 /** 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); \ 362 373 } while (0) 363 374 … … 959 970 * Stores the current data pointer in the backup area, allocates new data 960 971 * 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. 961 974 */ 962 975 void backup() … … 969 982 this->mData = pNewData; 970 983 } 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; 971 1009 } 972 1010 -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r40323 r40418 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Console COM Class implementation 3 * VBox Console COM Class implementation - VM Configuration Bits. 4 4 * 5 5 * @remark We've split out the code that the 64-bit VC++ v8 compiler finds … … 10 10 11 11 /* 12 * Copyright (C) 2006-201 1Oracle Corporation12 * Copyright (C) 2006-2012 Oracle Corporation 13 13 * 14 14 * This file is part of VirtualBox Open Source Edition (OSE), as … … 2588 2588 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 2589 2589 InsertConfigNode(pInst, "Config", &pCfg); 2590 hrc = BusMgr->assignPciDevice("acpi", pInst); H();2590 hrc = BusMgr->assignPciDevice("acpi", pInst); H(); 2591 2591 2592 2592 InsertConfigInteger(pCfg, "RamSize", cbRam); … … 2654 2654 2655 2655 /* 2656 * Set up the default DBGF search paths if all is cool so far.2656 * Configure DBGF (Debug(ger) Facility). 2657 2657 */ 2658 2658 { … … 2660 2660 InsertConfigNode(pRoot, "DBGF", &pDbgf); 2661 2661 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(); 2663 2664 Utf8Str strSettingsPath(bstr); 2664 2665 bstr.setNull(); … … 2676 2677 2677 2678 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); 2678 2694 } 2679 2695 } -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r40361 r40418 6364 6364 } 6365 6365 6366 STDMETHODIMP 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 6379 STDMETHODIMP 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 6400 STDMETHODIMP 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 6413 STDMETHODIMP 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 6437 STDMETHODIMP 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 6450 STDMETHODIMP 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 6366 6473 STDMETHODIMP Machine::CloneTo(IMachine *pTarget, CloneMode_T mode, ComSafeArrayIn(CloneOptions_T, options), IProgress **pProgress) 6367 6474 { … … 7707 7814 7708 7815 // hardware data 7709 rc = loadHardware(config.hardwareMachine );7816 rc = loadHardware(config.hardwareMachine, &config.debugging); 7710 7817 if (FAILED(rc)) return rc; 7711 7818 … … 7775 7882 ComObjPtr<SnapshotMachine> pSnapshotMachine; 7776 7883 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); 7782 7890 if (FAILED(rc)) return rc; 7783 7891 … … 7822 7930 7823 7931 /** 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. 7825 7936 */ 7826 HRESULT Machine::loadHardware(const settings::Hardware &data )7937 HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg) 7827 7938 { 7828 7939 AssertReturn(!isSessionMachine(), E_FAIL); … … 8051 8162 } 8052 8163 8164 /* 8165 * (The following isn't really real hardware, but it lives in HWData 8166 * for reasons of convenience.) 8167 */ 8168 8053 8169 #ifdef VBOX_WITH_GUEST_PROPS 8054 8170 /* Guest properties (optional) */ … … 8066 8182 mHWData->mGuestPropertyNotificationPatterns = data.strNotificationPatterns; 8067 8183 #endif /* VBOX_WITH_GUEST_PROPS defined */ 8184 8185 rc = loadDebugging(pDbg); 8186 if (FAILED(rc)) 8187 return rc; 8068 8188 } 8069 8189 catch(std::bad_alloc &) … … 8074 8194 AssertComRC(rc); 8075 8195 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 */ 8204 HRESULT 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; 8076 8209 } 8077 8210 … … 8893 9026 /// @todo Live Migration: config.fTeleported = (mData->mMachineState == MachineState_Teleported); 8894 9027 8895 HRESULT rc = saveHardware(config.hardwareMachine );9028 HRESULT rc = saveHardware(config.hardwareMachine, &config.debugging); 8896 9029 if (FAILED(rc)) throw rc; 8897 9030 … … 8966 9099 * given node is empty. 8967 9100 * 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. 8969 9104 */ 8970 HRESULT Machine::saveHardware(settings::Hardware &data )9105 HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDbg) 8971 9106 { 8972 9107 HRESULT rc = S_OK; … … 9198 9333 mData->mGuestPropertiesModified = FALSE; 9199 9334 #endif /* VBOX_WITH_GUEST_PROPS defined */ 9335 9336 *pDbg = mHWData->mDebugging; 9200 9337 } 9201 9338 catch(std::bad_alloc &) -
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r40257 r40418 773 773 data.strStateFile.setNull(); 774 774 775 HRESULT rc = m->pMachine->saveHardware(data.hardware );775 HRESULT rc = m->pMachine->saveHardware(data.hardware, &data.debugging); 776 776 if (FAILED(rc)) return rc; 777 777 … … 1078 1078 * @note Doesn't lock anything. 1079 1079 */ 1080 HRESULT SnapshotMachine::init(Machine *aMachine, 1081 const settings::Hardware &hardware, 1082 const settings::Storage &storage, 1083 IN_GUID aSnapshotId, 1084 const Utf8Str &aStateFilePath) 1080 HRESULT 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) 1085 1086 { 1086 1087 LogFlowThisFuncEnter(); … … 1156 1157 /* load hardware and harddisk settings */ 1157 1158 1158 HRESULT rc = loadHardware(hardware );1159 HRESULT rc = loadHardware(hardware, pDbg); 1159 1160 if (SUCCEEDED(rc)) 1160 1161 rc = loadStorageControllers(storage, -
trunk/src/VBox/Main/xml/Settings.cpp
r40066 r40418 834 834 break; 835 835 836 case SettingsVersion_v1_13: 837 pcszVersion = "1.13"; 838 break; 839 836 840 case SettingsVersion_Future: 837 841 // can be set if this code runs on XML files that were created by a future version of VBox; 838 842 // in that case, downgrade to current version when writing since we can't write future versions... 839 pcszVersion = "1.1 2";840 m->sv = SettingsVersion_v1_1 2;843 pcszVersion = "1.13"; 844 m->sv = SettingsVersion_v1_13; 841 845 break; 842 846 … … 1755 1759 && (storage == s.storage) // deep compare 1756 1760 && (llChildSnapshots == s.llChildSnapshots) // deep compare 1761 && debugging == s.debugging 1757 1762 ) 1758 1763 ); … … 3160 3165 3161 3166 /** 3167 * Called for reading the <Debugging> element under <Machine> or <Snapshot>. 3168 */ 3169 void 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 /** 3162 3184 * Called initially for the <Snapshot> element under <Machine>, if present, 3163 3185 * to store the snapshot's data into the given Snapshot structure (which is … … 3231 3253 // with data from old DVDDrive and FloppyDrive elements 3232 3254 readDVDAndFloppies_pre1_9(*pelmHardware, snap.storage); 3255 3256 readDebugging(elmSnapshot.findChildElement("Debugging"), &snap.debugging); 3233 3257 } 3234 3258 … … 3379 3403 else if (pelmMachineChild->nameEquals("MediaRegistry")) 3380 3404 readMediaRegistry(*pelmMachineChild, mediaRegistry); 3405 else if (pelmMachineChild->nameEquals("Debugging")) 3406 readDebugging(pelmMachineChild, &debugging); 3381 3407 } 3382 3408 … … 4301 4327 4302 4328 /** 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 */ 4335 void 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 /** 4303 4348 * Writes a single snapshot into the DOM tree. Initially this gets called from MachineConfigFile::write() 4304 4349 * for the root snapshot of a machine, if present; elmParent then points to the <Snapshots> node under the … … 4329 4374 // we only skip removable media for OVF, but we never get here for OVF 4330 4375 // since snapshots never get written then 4376 buildDebuggingXML(pelmSnapshot, &snap.debugging); 4331 4377 4332 4378 if (snap.llChildSnapshots.size()) … … 4476 4522 !!(fl & BuildMachineXML_SkipRemovableMedia), 4477 4523 pllElementsWithUuidAttributes); 4524 buildDebuggingXML(&elmMachine, &debugging); 4478 4525 } 4479 4526 … … 4591 4638 void MachineConfigFile::bumpSettingsVersionIfNeeded() 4592 4639 { 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 4593 4647 if (m->sv < SettingsVersion_v1_12) 4594 4648 {
Note:
See TracChangeset
for help on using the changeset viewer.