Changeset 51092 in vbox for trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
- Timestamp:
- Apr 16, 2014 5:57:25 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 93367
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
r47905 r51092 125 125 * @param a_fEnabled Where to store the result. 126 126 */ 127 STDMETHODIMP MachineDebugger::COMGETTER(SingleStep)(BOOL *a_fEnabled) 128 { 129 CheckComArgOutPointerValid(a_fEnabled); 130 131 AutoCaller autoCaller(this); 132 HRESULT hrc = autoCaller.rc(); 133 if (SUCCEEDED(hrc)) 134 { 135 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 136 Console::SafeVMPtr ptrVM(mParent); 137 hrc = ptrVM.rc(); 138 if (SUCCEEDED(hrc)) 139 { 140 /** @todo */ 141 ReturnComNotImplemented(); 142 } 127 HRESULT MachineDebugger::getSingleStep(BOOL *aSingleStep) 128 { 129 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 130 Console::SafeVMPtr ptrVM(mParent); 131 HRESULT hrc = ptrVM.rc(); 132 if (SUCCEEDED(hrc)) 133 { 134 /** @todo */ 135 ReturnComNotImplemented(); 143 136 } 144 137 return hrc; … … 151 144 * @param a_fEnable The new state. 152 145 */ 153 STDMETHODIMP MachineDebugger::COMSETTER(SingleStep)(BOOL a_fEnable) 154 { 155 AutoCaller autoCaller(this); 156 HRESULT hrc = autoCaller.rc(); 157 if (SUCCEEDED(hrc)) 158 { 159 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 160 Console::SafeVMPtr ptrVM(mParent); 161 hrc = ptrVM.rc(); 162 if (SUCCEEDED(hrc)) 163 { 164 /** @todo */ 165 ReturnComNotImplemented(); 166 } 146 HRESULT MachineDebugger::setSingleStep(BOOL aSingleStep) 147 { 148 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 149 Console::SafeVMPtr ptrVM(mParent); 150 HRESULT hrc = ptrVM.rc(); 151 if (SUCCEEDED(hrc)) 152 { 153 /** @todo */ 154 ReturnComNotImplemented(); 167 155 } 168 156 return hrc; … … 176 164 * @param pfEnforced Where to return the policy setting. 177 165 */ 178 HRESULT MachineDebugger:: getEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL *pfEnforced)166 HRESULT MachineDebugger::i_getEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL *pfEnforced) 179 167 { 180 168 CheckComArgOutPointerValid(pfEnforced); … … 185 173 { 186 174 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 187 if ( queueSettings())175 if (i_queueSettings()) 188 176 *pfEnforced = maiQueuedEmExecPolicyParams[enmPolicy] == 1; 189 177 else … … 207 195 * @param fEnforce Whether to enforce the policy or not. 208 196 */ 209 HRESULT MachineDebugger:: setEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL fEnforce)197 HRESULT MachineDebugger::i_setEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL fEnforce) 210 198 { 211 199 AutoCaller autoCaller(this); … … 214 202 { 215 203 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 216 if ( queueSettings())204 if (i_queueSettings()) 217 205 maiQueuedEmExecPolicyParams[enmPolicy] = fEnforce ? 1 : 0; 218 206 else … … 237 225 * @param a_fEnabled address of result variable 238 226 */ 239 STDMETHODIMP MachineDebugger::COMGETTER(RecompileUser) (BOOL *aEnabled)240 { 241 return getEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING3, aEnabled);227 HRESULT MachineDebugger::getRecompileUser(BOOL *aRecompileUser) 228 { 229 return i_getEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING3, aRecompileUser); 242 230 } 243 231 … … 248 236 * @param aEnable new user mode code recompile flag. 249 237 */ 250 STDMETHODIMP MachineDebugger::COMSETTER(RecompileUser)(BOOL aEnable)251 { 252 LogFlowThisFunc(("enable=%d\n", a Enable));253 return setEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING3, aEnable);238 HRESULT MachineDebugger::setRecompileUser(BOOL aRecompileUser) 239 { 240 LogFlowThisFunc(("enable=%d\n", aRecompileUser)); 241 return i_setEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING3, aRecompileUser); 254 242 } 255 243 … … 260 248 * @param aEnabled address of result variable 261 249 */ 262 STDMETHODIMP MachineDebugger::COMGETTER(RecompileSupervisor) (BOOL *aEnabled)263 { 264 return getEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING0, aEnabled);250 HRESULT MachineDebugger::getRecompileSupervisor(BOOL *aRecompileSupervisor) 251 { 252 return i_getEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING0, aRecompileSupervisor); 265 253 } 266 254 … … 271 259 * @param aEnable new recompile supervisor code flag 272 260 */ 273 STDMETHODIMP MachineDebugger::COMSETTER(RecompileSupervisor)(BOOL aEnable)274 { 275 LogFlowThisFunc(("enable=%d\n", a Enable));276 return setEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING0, aEnable);261 HRESULT MachineDebugger::setRecompileSupervisor(BOOL aRecompileSupervisor) 262 { 263 LogFlowThisFunc(("enable=%d\n", aRecompileSupervisor)); 264 return i_setEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING0, aRecompileSupervisor); 277 265 } 278 266 … … 283 271 * @param aEnabled Address of result variable. 284 272 */ 285 STDMETHODIMP MachineDebugger::COMGETTER(ExecuteAllInIEM) (BOOL *aEnabled)286 { 287 return getEmExecPolicyProperty(EMEXECPOLICY_IEM_ALL, aEnabled);273 HRESULT MachineDebugger::getExecuteAllInIEM(BOOL *aExecuteAllInIEM) 274 { 275 return i_getEmExecPolicyProperty(EMEXECPOLICY_IEM_ALL, aExecuteAllInIEM); 288 276 } 289 277 … … 294 282 * @param aEnable New setting. 295 283 */ 296 STDMETHODIMP MachineDebugger::COMSETTER(ExecuteAllInIEM)(BOOL aEnable)297 { 298 LogFlowThisFunc(("enable=%d\n", aE nable));299 return setEmExecPolicyProperty(EMEXECPOLICY_IEM_ALL, aEnable);284 HRESULT MachineDebugger::setExecuteAllInIEM(BOOL aExecuteAllInIEM) 285 { 286 LogFlowThisFunc(("enable=%d\n", aExecuteAllInIEM)); 287 return i_setEmExecPolicyProperty(EMEXECPOLICY_IEM_ALL, aExecuteAllInIEM); 300 288 } 301 289 … … 306 294 * @param aEnabled address of result variable 307 295 */ 308 STDMETHODIMP MachineDebugger::COMGETTER(PATMEnabled) (BOOL *aEnabled) 309 { 310 CheckComArgOutPointerValid(aEnabled); 311 312 AutoCaller autoCaller(this); 313 if (FAILED(autoCaller.rc())) 314 return autoCaller.rc(); 315 296 HRESULT MachineDebugger::getPATMEnabled(BOOL *aPATMEnabled) 297 { 316 298 #ifdef VBOX_WITH_RAW_MODE 317 299 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 319 301 Console::SafeVMPtrQuiet ptrVM(mParent); 320 302 if (ptrVM.isOk()) 321 *a Enabled = PATMR3IsEnabled (ptrVM.rawUVM());303 *aPATMEnabled = PATMR3IsEnabled (ptrVM.rawUVM()); 322 304 else 323 305 #endif 324 *a Enabled = false;306 *aPATMEnabled = false; 325 307 326 308 return S_OK; … … 333 315 * @param aEnable new patch manager enabled flag 334 316 */ 335 STDMETHODIMP MachineDebugger::COMSETTER(PATMEnabled) (BOOL aEnable) 336 { 337 LogFlowThisFunc(("enable=%d\n", aEnable)); 338 339 AutoCaller autoCaller(this); 340 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 317 HRESULT MachineDebugger::setPATMEnabled(BOOL aPATMEnabled) 318 { 319 LogFlowThisFunc(("enable=%d\n", aPATMEnabled)); 341 320 342 321 #ifdef VBOX_WITH_RAW_MODE 343 322 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 344 323 345 if ( queueSettings())324 if (i_queueSettings()) 346 325 { 347 326 // queue the request 348 mPatmEnabledQueued = a Enable;327 mPatmEnabledQueued = aPATMEnabled; 349 328 return S_OK; 350 329 } … … 354 333 return ptrVM.rc(); 355 334 356 int vrc = PATMR3AllowPatching(ptrVM.rawUVM(), RT_BOOL(a Enable));335 int vrc = PATMR3AllowPatching(ptrVM.rawUVM(), RT_BOOL(aPATMEnabled)); 357 336 if (RT_FAILURE(vrc)) 358 337 return setError(VBOX_E_VM_ERROR, tr("PATMR3AllowPatching returned %Rrc"), vrc); 359 338 360 339 #else /* !VBOX_WITH_RAW_MODE */ 361 if (a Enable)340 if (aPATMEnabled) 362 341 return setError(VBOX_E_VM_ERROR, tr("PATM not present"), VERR_NOT_SUPPORTED); 363 342 #endif /* !VBOX_WITH_RAW_MODE */ … … 371 350 * @param aEnabled address of result variable 372 351 */ 373 STDMETHODIMP MachineDebugger::COMGETTER(CSAMEnabled) (BOOL *aEnabled) 374 { 375 CheckComArgOutPointerValid(aEnabled); 376 377 AutoCaller autoCaller(this); 378 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 379 352 HRESULT MachineDebugger::getCSAMEnabled(BOOL *aCSAMEnabled) 353 { 380 354 #ifdef VBOX_WITH_RAW_MODE 381 355 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 384 358 385 359 if (ptrVM.isOk()) 386 *a Enabled = CSAMR3IsEnabled(ptrVM.rawUVM());360 *aCSAMEnabled = CSAMR3IsEnabled(ptrVM.rawUVM()); 387 361 else 388 362 #endif /* VBOX_WITH_RAW_MODE */ 389 *a Enabled = false;363 *aCSAMEnabled = false; 390 364 391 365 return S_OK; … … 398 372 * @param aEnable new code scanner enabled flag 399 373 */ 400 STDMETHODIMP MachineDebugger::COMSETTER(CSAMEnabled) (BOOL aEnable) 401 { 402 LogFlowThisFunc(("enable=%d\n", aEnable)); 403 404 AutoCaller autoCaller(this); 405 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 374 HRESULT MachineDebugger::setCSAMEnabled(BOOL aCSAMEnabled) 375 { 376 LogFlowThisFunc(("enable=%d\n", aCSAMEnabled)); 406 377 407 378 #ifdef VBOX_WITH_RAW_MODE 408 379 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 409 380 410 if ( queueSettings())381 if (i_queueSettings()) 411 382 { 412 383 // queue the request 413 mCsamEnabledQueued = a Enable;384 mCsamEnabledQueued = aCSAMEnabled; 414 385 return S_OK; 415 386 } … … 419 390 return ptrVM.rc(); 420 391 421 int vrc = CSAMR3SetScanningEnabled(ptrVM.rawUVM(), a Enable!= FALSE);392 int vrc = CSAMR3SetScanningEnabled(ptrVM.rawUVM(), aCSAMEnabled != FALSE); 422 393 if (RT_FAILURE(vrc)) 423 394 return setError(VBOX_E_VM_ERROR, tr("CSAMR3SetScanningEnabled returned %Rrc"), vrc); 424 395 425 396 #else /* !VBOX_WITH_RAW_MODE */ 426 if (a Enable)397 if (aCSAMEnabled) 427 398 return setError(VBOX_E_VM_ERROR, tr("CASM not present"), VERR_NOT_SUPPORTED); 428 399 #endif /* !VBOX_WITH_RAW_MODE */ … … 436 407 * @param aEnabled address of result variable 437 408 */ 438 STDMETHODIMP MachineDebugger::COMGETTER(LogEnabled) (BOOL *aEnabled) 439 { 440 CheckComArgOutPointerValid(aEnabled); 441 442 AutoCaller autoCaller(this); 443 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 444 409 HRESULT MachineDebugger::getLogEnabled(BOOL *aLogEnabled) 410 { 445 411 #ifdef LOG_ENABLED 446 412 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 447 413 448 414 const PRTLOGGER pLogInstance = RTLogDefaultInstance(); 449 *a Enabled = pLogInstance && !(pLogInstance->fFlags & RTLOGFLAGS_DISABLED);415 *aLogEnabled = pLogInstance && !(pLogInstance->fFlags & RTLOGFLAGS_DISABLED); 450 416 #else 451 *a Enabled = false;417 *aLogEnabled = false; 452 418 #endif 453 419 … … 461 427 * @param aEnabled The new code log state. 462 428 */ 463 STDMETHODIMP MachineDebugger::COMSETTER(LogEnabled) (BOOL aEnabled) 464 { 465 LogFlowThisFunc(("aEnabled=%d\n", aEnabled)); 466 467 AutoCaller autoCaller(this); 468 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 429 HRESULT MachineDebugger::setLogEnabled(BOOL aLogEnabled) 430 { 431 LogFlowThisFunc(("aLogEnabled=%d\n", aLogEnabled)); 469 432 470 433 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 471 434 472 if ( queueSettings())435 if (i_queueSettings()) 473 436 { 474 437 // queue the request 475 mLogEnabledQueued = a Enabled;438 mLogEnabledQueued = aLogEnabled; 476 439 return S_OK; 477 440 } … … 481 444 482 445 #ifdef LOG_ENABLED 483 int vrc = DBGFR3LogModifyFlags(ptrVM.rawUVM(), a Enabled ? "enabled" : "disabled");446 int vrc = DBGFR3LogModifyFlags(ptrVM.rawUVM(), aLogEnabled ? "enabled" : "disabled"); 484 447 if (RT_FAILURE(vrc)) 485 448 { … … 491 454 } 492 455 493 HRESULT MachineDebugger::logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGetStr, 494 const char *pszLogGetStr, BSTR *a_pbstrSettings) 495 { 456 HRESULT MachineDebugger::i_logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGetStr, 457 const char *pszLogGetStr, Utf8Str astrSettings) 458 { 459 BSTR *a_pbstrSettings = new BSTR; 460 astrSettings.cloneTo(a_pbstrSettings); 461 496 462 /* Make sure the VM is powered up. */ 497 463 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 541 507 } 542 508 543 544 STDMETHODIMP MachineDebugger::COMGETTER(LogDbgFlags)(BSTR *a_pbstrSettings) 545 { 546 CheckComArgOutPointerValid(a_pbstrSettings); 547 548 AutoCaller autoCaller(this); 549 HRESULT hrc = autoCaller.rc(); 550 if (SUCCEEDED(hrc)) 551 hrc = logStringProps(RTLogGetDefaultInstance(), RTLogGetFlags, "RTGetFlags", a_pbstrSettings); 552 553 return hrc; 554 } 555 556 STDMETHODIMP MachineDebugger::COMGETTER(LogDbgGroups)(BSTR *a_pbstrSettings) 557 { 558 CheckComArgOutPointerValid(a_pbstrSettings); 559 560 AutoCaller autoCaller(this); 561 HRESULT hrc = autoCaller.rc(); 562 if (SUCCEEDED(hrc)) 563 hrc = logStringProps(RTLogGetDefaultInstance(), RTLogGetGroupSettings, "RTLogGetGroupSettings", a_pbstrSettings); 564 565 return hrc; 566 } 567 568 STDMETHODIMP MachineDebugger::COMGETTER(LogDbgDestinations)(BSTR *a_pbstrSettings) 569 { 570 CheckComArgOutPointerValid(a_pbstrSettings); 571 572 AutoCaller autoCaller(this); 573 HRESULT hrc = autoCaller.rc(); 574 if (SUCCEEDED(hrc)) 575 hrc = logStringProps(RTLogGetDefaultInstance(), RTLogGetDestinations, "RTLogGetDestinations", a_pbstrSettings); 576 577 return hrc; 578 } 579 580 581 STDMETHODIMP MachineDebugger::COMGETTER(LogRelFlags)(BSTR *a_pbstrSettings) 582 { 583 CheckComArgOutPointerValid(a_pbstrSettings); 584 585 AutoCaller autoCaller(this); 586 HRESULT hrc = autoCaller.rc(); 587 if (SUCCEEDED(hrc)) 588 hrc = logStringProps(RTLogRelDefaultInstance(), RTLogGetFlags, "RTGetFlags", a_pbstrSettings); 589 590 return hrc; 591 } 592 593 STDMETHODIMP MachineDebugger::COMGETTER(LogRelGroups)(BSTR *a_pbstrSettings) 594 { 595 CheckComArgOutPointerValid(a_pbstrSettings); 596 597 AutoCaller autoCaller(this); 598 HRESULT hrc = autoCaller.rc(); 599 if (SUCCEEDED(hrc)) 600 hrc = logStringProps(RTLogRelDefaultInstance(), RTLogGetGroupSettings, "RTLogGetGroupSettings", a_pbstrSettings); 601 602 return hrc; 603 } 604 605 STDMETHODIMP MachineDebugger::COMGETTER(LogRelDestinations)(BSTR *a_pbstrSettings) 606 { 607 CheckComArgOutPointerValid(a_pbstrSettings); 608 609 AutoCaller autoCaller(this); 610 HRESULT hrc = autoCaller.rc(); 611 if (SUCCEEDED(hrc)) 612 hrc = logStringProps(RTLogRelDefaultInstance(), RTLogGetDestinations, "RTLogGetDestinations", a_pbstrSettings); 509 HRESULT MachineDebugger::getLogDbgFlags(com::Utf8Str &aLogDbgFlags) 510 { 511 HRESULT hrc = i_logStringProps(RTLogGetDefaultInstance(), RTLogGetFlags, "RTGetFlags", aLogDbgFlags); 512 513 return hrc; 514 } 515 516 HRESULT MachineDebugger::getLogDbgGroups(com::Utf8Str &aLogDbgGroups) 517 { 518 HRESULT hrc = i_logStringProps(RTLogGetDefaultInstance(), RTLogGetGroupSettings, "RTLogGetGroupSettings", aLogDbgGroups); 519 520 return hrc; 521 } 522 523 HRESULT MachineDebugger::getLogDbgDestinations(com::Utf8Str &aLogDbgDestinations) 524 { 525 HRESULT hrc = i_logStringProps(RTLogGetDefaultInstance(), RTLogGetDestinations, "RTLogGetDestinations", aLogDbgDestinations); 526 return hrc; 527 } 528 529 HRESULT MachineDebugger::getLogRelFlags(com::Utf8Str &aLogRelFlags) 530 { 531 HRESULT hrc = i_logStringProps(RTLogRelDefaultInstance(), RTLogGetFlags, "RTGetFlags", aLogRelFlags); 532 533 return hrc; 534 } 535 536 HRESULT MachineDebugger::getLogRelGroups(com::Utf8Str &aLogRelGroups) 537 { 538 HRESULT hrc = i_logStringProps(RTLogRelDefaultInstance(), RTLogGetGroupSettings, "RTLogGetGroupSettings", aLogRelGroups); 539 540 return hrc; 541 } 542 543 HRESULT MachineDebugger::getLogRelDestinations(com::Utf8Str &aLogRelDestinations) 544 { 545 HRESULT hrc = i_logStringProps(RTLogRelDefaultInstance(), RTLogGetDestinations, "RTLogGetDestinations", aLogRelDestinations); 613 546 614 547 return hrc; … … 621 554 * @param aEnabled address of result variable 622 555 */ 623 STDMETHODIMP MachineDebugger::COMGETTER(HWVirtExEnabled) (BOOL *aEnabled) 624 { 625 CheckComArgOutPointerValid(aEnabled); 626 627 AutoCaller autoCaller(this); 628 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 629 556 HRESULT MachineDebugger::getHWVirtExEnabled(BOOL *aHWVirtExEnabled) 557 { 630 558 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 631 559 … … 633 561 634 562 if (ptrVM.isOk()) 635 *a Enabled = HMR3IsEnabled(ptrVM.rawUVM());563 *aHWVirtExEnabled = HMR3IsEnabled(ptrVM.rawUVM()); 636 564 else 637 *a Enabled = false;565 *aHWVirtExEnabled = false; 638 566 639 567 return S_OK; … … 646 574 * @param aEnabled address of result variable 647 575 */ 648 STDMETHODIMP MachineDebugger::COMGETTER(HWVirtExNestedPagingEnabled)(BOOL *aEnabled) 649 { 650 CheckComArgOutPointerValid(aEnabled); 651 652 AutoCaller autoCaller(this); 653 if (FAILED(autoCaller.rc())) 654 return autoCaller.rc(); 655 576 HRESULT MachineDebugger::getHWVirtExNestedPagingEnabled(BOOL *aHWVirtExNestedPagingEnabled) 577 { 656 578 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 657 579 … … 659 581 660 582 if (ptrVM.isOk()) 661 *a Enabled = HMR3IsNestedPagingActive(ptrVM.rawUVM());583 *aHWVirtExNestedPagingEnabled = HMR3IsNestedPagingActive(ptrVM.rawUVM()); 662 584 else 663 *a Enabled = false;585 *aHWVirtExNestedPagingEnabled = false; 664 586 665 587 return S_OK; … … 672 594 * @param aEnabled address of result variable 673 595 */ 674 STDMETHODIMP MachineDebugger::COMGETTER(HWVirtExVPIDEnabled) (BOOL *aEnabled) 675 { 676 CheckComArgOutPointerValid(aEnabled); 677 678 AutoCaller autoCaller(this); 679 if (FAILED(autoCaller.rc())) 680 return autoCaller.rc(); 681 596 HRESULT MachineDebugger::getHWVirtExVPIDEnabled(BOOL *aHWVirtExVPIDEnabled) 597 { 682 598 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 683 599 … … 685 601 686 602 if (ptrVM.isOk()) 687 *a Enabled = HMR3IsVpidActive(ptrVM.rawUVM());603 *aHWVirtExVPIDEnabled = HMR3IsVpidActive(ptrVM.rawUVM()); 688 604 else 689 *a Enabled = false;605 *aHWVirtExVPIDEnabled = false; 690 606 691 607 return S_OK; … … 698 614 * @param aEnabled address of result variable 699 615 */ 700 STDMETHODIMP MachineDebugger::COMGETTER(HWVirtExUXEnabled) (BOOL *aEnabled) 701 { 702 CheckComArgOutPointerValid(aEnabled); 703 704 AutoCaller autoCaller(this); 705 if (FAILED(autoCaller.rc())) 706 return autoCaller.rc(); 707 616 HRESULT MachineDebugger::getHWVirtExUXEnabled(BOOL *aHWVirtExUXEnabled) 617 { 708 618 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 709 619 … … 711 621 712 622 if (ptrVM.isOk()) 713 *a Enabled = HMR3IsUXActive(ptrVM.rawUVM());623 *aHWVirtExUXEnabled = HMR3IsUXActive(ptrVM.rawUVM()); 714 624 else 715 *a Enabled = false;716 717 return S_OK; 718 } 719 720 STDMETHODIMP MachineDebugger::COMGETTER(OSName)(BSTR *a_pbstrName)625 *aHWVirtExUXEnabled = false; 626 627 return S_OK; 628 } 629 630 HRESULT MachineDebugger::getOSName(com::Utf8Str &aOSName) 721 631 { 722 632 LogFlowThisFunc(("\n")); 723 CheckComArgNotNull(a_pbstrName); 724 AutoCaller autoCaller(this); 725 HRESULT hrc = autoCaller.rc(); 726 if (SUCCEEDED(hrc)) 727 { 728 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 633 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 634 Console::SafeVMPtr ptrVM(mParent); 635 HRESULT hrc = ptrVM.rc(); 636 if (SUCCEEDED(hrc)) 637 { 638 /* 639 * Do the job and try convert the name. 640 */ 641 char szName[64]; 642 int vrc = DBGFR3OSQueryNameAndVersion(ptrVM.rawUVM(), szName, sizeof(szName), NULL, 0); 643 if (RT_SUCCESS(vrc)) 644 { 645 try 646 { 647 Bstr bstrName(szName); 648 aOSName = Utf8Str(bstrName); 649 } 650 catch (std::bad_alloc) 651 { 652 hrc = E_OUTOFMEMORY; 653 } 654 } 655 else 656 hrc = setError(VBOX_E_VM_ERROR, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc); 657 } 658 return hrc; 659 } 660 661 HRESULT MachineDebugger::getOSVersion(com::Utf8Str &aOSVersion) 662 { 663 LogFlowThisFunc(("\n")); 664 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 665 Console::SafeVMPtr ptrVM(mParent); 666 HRESULT hrc = ptrVM.rc(); 667 if (SUCCEEDED(hrc)) 668 { 669 /* 670 * Do the job and try convert the name. 671 */ 672 char szVersion[256]; 673 int vrc = DBGFR3OSQueryNameAndVersion(ptrVM.rawUVM(), NULL, 0, szVersion, sizeof(szVersion)); 674 if (RT_SUCCESS(vrc)) 675 { 676 try 677 { 678 Bstr bstrVersion(szVersion); 679 aOSVersion = Utf8Str(bstrVersion); 680 } 681 catch (std::bad_alloc) 682 { 683 hrc = E_OUTOFMEMORY; 684 } 685 } 686 else 687 hrc = setError(VBOX_E_VM_ERROR, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc); 688 } 689 return hrc; 690 } 691 692 /** 693 * Returns the current PAE flag. 694 * 695 * @returns COM status code 696 * @param aEnabled address of result variable 697 */ 698 HRESULT MachineDebugger::getPAEEnabled(BOOL *aPAEEnabled) 699 { 700 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 701 702 Console::SafeVMPtrQuiet ptrVM(mParent); 703 704 if (ptrVM.isOk()) 705 { 706 uint32_t cr4; 707 int rc = DBGFR3RegCpuQueryU32(ptrVM.rawUVM(), 0 /*idCpu*/, DBGFREG_CR4, &cr4); AssertRC(rc); 708 *aPAEEnabled = RT_BOOL(cr4 & X86_CR4_PAE); 709 } 710 else 711 *aPAEEnabled = false; 712 713 return S_OK; 714 } 715 716 /** 717 * Returns the current virtual time rate. 718 * 719 * @returns COM status code. 720 * @param a_puPct Where to store the rate. 721 */ 722 HRESULT MachineDebugger::getVirtualTimeRate(ULONG *aVirtualTimeRate) 723 { 724 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 725 726 Console::SafeVMPtr ptrVM(mParent); 727 HRESULT hrc = ptrVM.rc(); 728 if (SUCCEEDED(hrc)) 729 *aVirtualTimeRate = TMR3GetWarpDrive(ptrVM.rawUVM()); 730 731 return hrc; 732 } 733 734 /** 735 * Returns the current virtual time rate. 736 * 737 * @returns COM status code. 738 * @param aPct Where to store the rate. 739 */ 740 HRESULT MachineDebugger::setVirtualTimeRate(ULONG aVirtualTimeRate) 741 { 742 HRESULT hrc = S_OK; 743 744 if (aVirtualTimeRate < 2 || aVirtualTimeRate > 20000) 745 return setError(E_INVALIDARG, tr("%u is out of range [2..20000]"), aVirtualTimeRate); 746 747 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 748 if (i_queueSettings()) 749 mVirtualTimeRateQueued = aVirtualTimeRate; 750 else 751 { 729 752 Console::SafeVMPtr ptrVM(mParent); 730 753 hrc = ptrVM.rc(); 731 754 if (SUCCEEDED(hrc)) 732 755 { 733 /* 734 * Do the job and try convert the name. 735 */ 736 char szName[64]; 737 int vrc = DBGFR3OSQueryNameAndVersion(ptrVM.rawUVM(), szName, sizeof(szName), NULL, 0); 738 if (RT_SUCCESS(vrc)) 739 { 740 try 741 { 742 Bstr bstrName(szName); 743 bstrName.detachTo(a_pbstrName); 744 } 745 catch (std::bad_alloc) 746 { 747 hrc = E_OUTOFMEMORY; 748 } 749 } 750 else 751 hrc = setError(VBOX_E_VM_ERROR, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc); 752 } 753 } 754 return hrc; 755 } 756 757 STDMETHODIMP MachineDebugger::COMGETTER(OSVersion)(BSTR *a_pbstrVersion) 758 { 759 LogFlowThisFunc(("\n")); 760 CheckComArgNotNull(a_pbstrVersion); 761 AutoCaller autoCaller(this); 762 HRESULT hrc = autoCaller.rc(); 763 if (SUCCEEDED(hrc)) 764 { 765 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 766 Console::SafeVMPtr ptrVM(mParent); 767 hrc = ptrVM.rc(); 768 if (SUCCEEDED(hrc)) 769 { 770 /* 771 * Do the job and try convert the name. 772 */ 773 char szVersion[256]; 774 int vrc = DBGFR3OSQueryNameAndVersion(ptrVM.rawUVM(), NULL, 0, szVersion, sizeof(szVersion)); 775 if (RT_SUCCESS(vrc)) 776 { 777 try 778 { 779 Bstr bstrVersion(szVersion); 780 bstrVersion.detachTo(a_pbstrVersion); 781 } 782 catch (std::bad_alloc) 783 { 784 hrc = E_OUTOFMEMORY; 785 } 786 } 787 else 788 hrc = setError(VBOX_E_VM_ERROR, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc); 789 } 790 } 791 return hrc; 792 } 793 794 /** 795 * Returns the current PAE flag. 796 * 797 * @returns COM status code 798 * @param aEnabled address of result variable 799 */ 800 STDMETHODIMP MachineDebugger::COMGETTER(PAEEnabled) (BOOL *aEnabled) 801 { 802 CheckComArgOutPointerValid(aEnabled); 803 804 AutoCaller autoCaller(this); 805 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 806 807 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 808 809 Console::SafeVMPtrQuiet ptrVM(mParent); 810 811 if (ptrVM.isOk()) 812 { 813 uint32_t cr4; 814 int rc = DBGFR3RegCpuQueryU32(ptrVM.rawUVM(), 0 /*idCpu*/, DBGFREG_CR4, &cr4); AssertRC(rc); 815 *aEnabled = RT_BOOL(cr4 & X86_CR4_PAE); 816 } 817 else 818 *aEnabled = false; 819 820 return S_OK; 821 } 822 823 /** 824 * Returns the current virtual time rate. 825 * 826 * @returns COM status code. 827 * @param a_puPct Where to store the rate. 828 */ 829 STDMETHODIMP MachineDebugger::COMGETTER(VirtualTimeRate)(ULONG *a_puPct) 830 { 831 CheckComArgOutPointerValid(a_puPct); 832 833 AutoCaller autoCaller(this); 834 HRESULT hrc = autoCaller.rc(); 835 if (SUCCEEDED(hrc)) 836 { 837 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 838 839 Console::SafeVMPtr ptrVM(mParent); 840 hrc = ptrVM.rc(); 841 if (SUCCEEDED(hrc)) 842 *a_puPct = TMR3GetWarpDrive(ptrVM.rawUVM()); 843 } 844 845 return hrc; 846 } 847 848 /** 849 * Returns the current virtual time rate. 850 * 851 * @returns COM status code. 852 * @param aPct Where to store the rate. 853 */ 854 STDMETHODIMP MachineDebugger::COMSETTER(VirtualTimeRate)(ULONG a_uPct) 855 { 856 if (a_uPct < 2 || a_uPct > 20000) 857 return setError(E_INVALIDARG, tr("%u is out of range [2..20000]"), a_uPct); 858 859 AutoCaller autoCaller(this); 860 HRESULT hrc = autoCaller.rc(); 861 if (SUCCEEDED(hrc)) 862 { 863 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 864 if (queueSettings()) 865 mVirtualTimeRateQueued = a_uPct; 866 else 867 { 868 Console::SafeVMPtr ptrVM(mParent); 869 hrc = ptrVM.rc(); 870 if (SUCCEEDED(hrc)) 871 { 872 int vrc = TMR3SetWarpDrive(ptrVM.rawUVM(), a_uPct); 873 if (RT_FAILURE(vrc)) 874 hrc = setError(VBOX_E_VM_ERROR, tr("TMR3SetWarpDrive(, %u) failed with rc=%Rrc"), a_uPct, vrc); 875 } 756 int vrc = TMR3SetWarpDrive(ptrVM.rawUVM(), aVirtualTimeRate); 757 if (RT_FAILURE(vrc)) 758 hrc = setError(VBOX_E_VM_ERROR, tr("TMR3SetWarpDrive(, %u) failed with rc=%Rrc"), aVirtualTimeRate, vrc); 876 759 } 877 760 } … … 892 775 * @remarks Prior to 4.3 this returned PVM. 893 776 */ 894 STDMETHODIMP MachineDebugger::COMGETTER(VM)(LONG64 *a_i64Vm) 895 { 896 CheckComArgOutPointerValid(a_i64Vm); 897 898 AutoCaller autoCaller(this); 899 HRESULT hrc = autoCaller.rc(); 900 if (SUCCEEDED(hrc)) 901 { 902 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 903 904 Console::SafeVMPtr ptrVM(mParent); 905 hrc = ptrVM.rc(); 906 if (SUCCEEDED(hrc)) 907 { 908 VMR3RetainUVM(ptrVM.rawUVM()); 909 *a_i64Vm = (intptr_t)ptrVM.rawUVM(); 910 } 911 912 /* 913 * Note! ptrVM protection provided by SafeVMPtr is no long effective 914 * after we return from this method. 915 */ 916 } 917 777 HRESULT MachineDebugger::getVM(LONG64 *aVM) 778 { 779 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 780 781 Console::SafeVMPtr ptrVM(mParent); 782 HRESULT hrc = ptrVM.rc(); 783 if (SUCCEEDED(hrc)) 784 { 785 VMR3RetainUVM(ptrVM.rawUVM()); 786 *aVM = (intptr_t)ptrVM.rawUVM(); 787 } 788 789 /* 790 * Note! ptrVM protection provided by SafeVMPtr is no long effective 791 * after we return from this method. 792 */ 918 793 return hrc; 919 794 } … … 922 797 ///////////////////////////////////////////////////////////////////////////// 923 798 924 STDMETHODIMP MachineDebugger::DumpGuestCore(IN_BSTR a_bstrFilename, IN_BSTR a_bstrCompression) 925 { 926 CheckComArgStrNotEmptyOrNull(a_bstrFilename); 927 Utf8Str strFilename(a_bstrFilename); 928 if (a_bstrCompression && *a_bstrCompression) 799 HRESULT MachineDebugger::dumpGuestCore(const com::Utf8Str &aFilename, const com::Utf8Str &aCompression) 800 { 801 if (aCompression.length()) 929 802 return setError(E_INVALIDARG, tr("The compression parameter must be empty")); 930 803 931 AutoCaller autoCaller(this); 932 HRESULT hrc = autoCaller.rc(); 933 if (SUCCEEDED(hrc)) 934 { 935 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 936 Console::SafeVMPtr ptrVM(mParent); 937 hrc = ptrVM.rc(); 938 if (SUCCEEDED(hrc)) 939 { 940 int vrc = DBGFR3CoreWrite(ptrVM.rawUVM(), strFilename.c_str(), false /*fReplaceFile*/); 941 if (RT_SUCCESS(vrc)) 942 hrc = S_OK; 943 else 944 hrc = setError(E_FAIL, tr("DBGFR3CoreWrite failed with %Rrc"), vrc); 945 } 946 } 947 948 return hrc; 949 } 950 951 STDMETHODIMP MachineDebugger::DumpHostProcessCore(IN_BSTR a_bstrFilename, IN_BSTR a_bstrCompression) 804 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 805 Console::SafeVMPtr ptrVM(mParent); 806 HRESULT hrc = ptrVM.rc(); 807 if (SUCCEEDED(hrc)) 808 { 809 int vrc = DBGFR3CoreWrite(ptrVM.rawUVM(), aFilename.c_str(), false /*fReplaceFile*/); 810 if (RT_SUCCESS(vrc)) 811 hrc = S_OK; 812 else 813 hrc = setError(E_FAIL, tr("DBGFR3CoreWrite failed with %Rrc"), vrc); 814 } 815 816 return hrc; 817 } 818 819 HRESULT MachineDebugger::dumpHostProcessCore(const com::Utf8Str &aFilename, const com::Utf8Str &aCompression) 952 820 { 953 821 ReturnComNotImplemented(); … … 1062 930 } 1063 931 1064 STDMETHODIMP MachineDebugger::Info(IN_BSTR a_bstrName, IN_BSTR a_bstrArgs, BSTR *a_pbstrInfo)932 HRESULT MachineDebugger::info(const com::Utf8Str &aName, const com::Utf8Str &aArgs, com::Utf8Str &aInfo) 1065 933 { 1066 934 LogFlowThisFunc(("\n")); 1067 1068 /*1069 * Validate and convert input.1070 */1071 CheckComArgStrNotEmptyOrNull(a_bstrName);1072 Utf8Str strName, strArgs;1073 try1074 {1075 strName = a_bstrName;1076 strArgs = a_bstrArgs;1077 }1078 catch (std::bad_alloc)1079 {1080 return E_OUTOFMEMORY;1081 }1082 935 1083 936 /* … … 1098 951 MACHINEDEBUGGERINOFHLP Hlp; 1099 952 MachineDebuggerInfoInit(&Hlp); 1100 int vrc = DBGFR3Info(ptrVM.rawUVM(), strName.c_str(), strArgs.c_str(), &Hlp.Core);953 int vrc = DBGFR3Info(ptrVM.rawUVM(), aName.c_str(), aArgs.c_str(), &Hlp.Core); 1101 954 if (RT_SUCCESS(vrc)) 1102 955 { … … 1109 962 { 1110 963 Bstr bstrInfo(Hlp.pszBuf); 1111 bstrInfo.detachTo(a_pbstrInfo);964 aInfo = bstrInfo; 1112 965 } 1113 966 catch (std::bad_alloc) … … 1127 980 } 1128 981 1129 STDMETHODIMP MachineDebugger::InjectNMI()982 HRESULT MachineDebugger::injectNMI() 1130 983 { 1131 984 LogFlowThisFunc(("\n")); 1132 985 1133 AutoCaller autoCaller(this); 1134 HRESULT hrc = autoCaller.rc(); 1135 if (SUCCEEDED(hrc)) 1136 { 1137 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1138 Console::SafeVMPtr ptrVM(mParent); 1139 hrc = ptrVM.rc(); 1140 if (SUCCEEDED(hrc)) 1141 { 1142 int vrc = DBGFR3InjectNMI(ptrVM.rawUVM(), 0); 1143 if (RT_SUCCESS(vrc)) 1144 hrc = S_OK; 1145 else 1146 hrc = setError(E_FAIL, tr("DBGFR3InjectNMI failed with %Rrc"), vrc); 1147 } 1148 } 1149 return hrc; 1150 } 1151 1152 STDMETHODIMP MachineDebugger::ModifyLogFlags(IN_BSTR a_bstrSettings) 1153 { 1154 CheckComArgStrNotEmptyOrNull(a_bstrSettings); 1155 Utf8Str strSettings(a_bstrSettings); 1156 1157 LogFlowThisFunc(("a_bstrSettings=%s\n", strSettings.c_str())); 1158 AutoCaller autoCaller(this); 1159 HRESULT hrc = autoCaller.rc(); 1160 if (SUCCEEDED(hrc)) 1161 { 1162 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1163 Console::SafeVMPtr ptrVM(mParent); 1164 hrc = ptrVM.rc(); 1165 if (SUCCEEDED(hrc)) 1166 { 1167 int vrc = DBGFR3LogModifyFlags(ptrVM.rawUVM(), strSettings.c_str()); 1168 if (RT_SUCCESS(vrc)) 1169 hrc = S_OK; 1170 else 1171 hrc = setError(E_FAIL, tr("DBGFR3LogModifyFlags failed with %Rrc"), vrc); 1172 } 1173 } 1174 return hrc; 1175 } 1176 1177 STDMETHODIMP MachineDebugger::ModifyLogGroups(IN_BSTR a_bstrSettings) 1178 { 1179 CheckComArgStrNotEmptyOrNull(a_bstrSettings); 1180 Utf8Str strSettings(a_bstrSettings); 1181 1182 LogFlowThisFunc(("a_bstrSettings=%s\n", strSettings.c_str())); 1183 AutoCaller autoCaller(this); 1184 HRESULT hrc = autoCaller.rc(); 1185 if (SUCCEEDED(hrc)) 1186 { 1187 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1188 Console::SafeVMPtr ptrVM(mParent); 1189 hrc = ptrVM.rc(); 1190 if (SUCCEEDED(hrc)) 1191 { 1192 int vrc = DBGFR3LogModifyGroups(ptrVM.rawUVM(), strSettings.c_str()); 1193 if (RT_SUCCESS(vrc)) 1194 hrc = S_OK; 1195 else 1196 hrc = setError(E_FAIL, tr("DBGFR3LogModifyGroups failed with %Rrc"), vrc); 1197 } 1198 } 1199 return hrc; 1200 } 1201 1202 STDMETHODIMP MachineDebugger::ModifyLogDestinations(IN_BSTR a_bstrSettings) 1203 { 1204 CheckComArgStrNotEmptyOrNull(a_bstrSettings); 1205 Utf8Str strSettings(a_bstrSettings); 1206 1207 LogFlowThisFunc(("a_bstrSettings=%s\n", strSettings.c_str())); 1208 AutoCaller autoCaller(this); 1209 HRESULT hrc = autoCaller.rc(); 1210 if (SUCCEEDED(hrc)) 1211 { 1212 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1213 Console::SafeVMPtr ptrVM(mParent); 1214 hrc = ptrVM.rc(); 1215 if (SUCCEEDED(hrc)) 1216 { 1217 int vrc = DBGFR3LogModifyDestinations(ptrVM.rawUVM(), strSettings.c_str()); 1218 if (RT_SUCCESS(vrc)) 1219 hrc = S_OK; 1220 else 1221 hrc = setError(E_FAIL, tr("DBGFR3LogModifyDestinations failed with %Rrc"), vrc); 1222 } 1223 } 1224 return hrc; 1225 } 1226 1227 STDMETHODIMP MachineDebugger::ReadPhysicalMemory(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayOut(BYTE, a_abData)) 986 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 987 Console::SafeVMPtr ptrVM(mParent); 988 HRESULT hrc = ptrVM.rc(); 989 if (SUCCEEDED(hrc)) 990 { 991 int vrc = DBGFR3InjectNMI(ptrVM.rawUVM(), 0); 992 if (RT_SUCCESS(vrc)) 993 hrc = S_OK; 994 else 995 hrc = setError(E_FAIL, tr("DBGFR3InjectNMI failed with %Rrc"), vrc); 996 } 997 return hrc; 998 } 999 1000 HRESULT MachineDebugger::modifyLogFlags(const com::Utf8Str &aSettings) 1001 { 1002 LogFlowThisFunc(("aSettings=%s\n", aSettings.c_str())); 1003 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1004 Console::SafeVMPtr ptrVM(mParent); 1005 HRESULT hrc = ptrVM.rc(); 1006 if (SUCCEEDED(hrc)) 1007 { 1008 int vrc = DBGFR3LogModifyFlags(ptrVM.rawUVM(), aSettings.c_str()); 1009 if (RT_SUCCESS(vrc)) 1010 hrc = S_OK; 1011 else 1012 hrc = setError(E_FAIL, tr("DBGFR3LogModifyFlags failed with %Rrc"), vrc); 1013 } 1014 return hrc; 1015 } 1016 1017 HRESULT MachineDebugger::modifyLogGroups(const com::Utf8Str &aSettings) 1018 { 1019 LogFlowThisFunc(("aSettings=%s\n", aSettings.c_str())); 1020 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1021 Console::SafeVMPtr ptrVM(mParent); 1022 HRESULT hrc = ptrVM.rc(); 1023 if (SUCCEEDED(hrc)) 1024 { 1025 int vrc = DBGFR3LogModifyGroups(ptrVM.rawUVM(), aSettings.c_str()); 1026 if (RT_SUCCESS(vrc)) 1027 hrc = S_OK; 1028 else 1029 hrc = setError(E_FAIL, tr("DBGFR3LogModifyGroups failed with %Rrc"), vrc); 1030 } 1031 return hrc; 1032 } 1033 1034 HRESULT MachineDebugger::modifyLogDestinations(const com::Utf8Str &aSettings) 1035 { 1036 LogFlowThisFunc(("aSettings=%s\n", aSettings.c_str())); 1037 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1038 Console::SafeVMPtr ptrVM(mParent); 1039 HRESULT hrc = ptrVM.rc(); 1040 if (SUCCEEDED(hrc)) 1041 { 1042 int vrc = DBGFR3LogModifyDestinations(ptrVM.rawUVM(), aSettings.c_str()); 1043 if (RT_SUCCESS(vrc)) 1044 hrc = S_OK; 1045 else 1046 hrc = setError(E_FAIL, tr("DBGFR3LogModifyDestinations failed with %Rrc"), vrc); 1047 } 1048 return hrc; 1049 } 1050 1051 HRESULT MachineDebugger::readPhysicalMemory(LONG64 aAddress, ULONG aSize, std::vector<BYTE> &aBytes) 1228 1052 { 1229 1053 ReturnComNotImplemented(); 1230 1054 } 1231 1055 1232 STDMETHODIMP MachineDebugger::WritePhysicalMemory(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayIn(BYTE, a_abData))1056 HRESULT MachineDebugger::writePhysicalMemory(LONG64 aAddress, ULONG aSize, const std::vector<BYTE> &aBytes) 1233 1057 { 1234 1058 ReturnComNotImplemented(); 1235 1059 } 1236 1060 1237 STDMETHODIMP MachineDebugger::ReadVirtualMemory(ULONG a_idCpu, LONG64 a_Address, ULONG a_cbRead, ComSafeArrayOut(BYTE, a_abData))1061 HRESULT MachineDebugger::readVirtualMemory(ULONG aCpuId, LONG64 aAddress, ULONG aSize, std::vector<BYTE> &aBytes) 1238 1062 { 1239 1063 ReturnComNotImplemented(); 1240 1064 } 1241 1065 1242 STDMETHODIMP MachineDebugger::WriteVirtualMemory(ULONG a_idCpu, LONG64 a_Address, ULONG a_cbRead, ComSafeArrayIn(BYTE, a_abData))1066 HRESULT MachineDebugger::writeVirtualMemory(ULONG aCpuId, LONG64 aAddress, ULONG aSize, const std::vector<BYTE> &aBytes) 1243 1067 { 1244 1068 ReturnComNotImplemented(); 1245 1069 } 1246 1070 1247 STDMETHODIMP MachineDebugger::DetectOS(BSTR *a_pbstrName)1071 HRESULT MachineDebugger::detectOS(com::Utf8Str &aOs) 1248 1072 { 1249 1073 LogFlowThisFunc(("\n")); 1250 CheckComArgNotNull(a_pbstrName);1251 1074 1252 1075 /* 1253 1076 * Do the autocaller and lock bits. 1254 1077 */ 1255 AutoCaller autoCaller(this); 1256 HRESULT hrc = autoCaller.rc(); 1257 if (SUCCEEDED(hrc)) 1258 { 1259 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1260 Console::SafeVMPtr ptrVM(mParent); 1261 hrc = ptrVM.rc(); 1262 if (SUCCEEDED(hrc)) 1078 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1079 Console::SafeVMPtr ptrVM(mParent); 1080 HRESULT hrc = ptrVM.rc(); 1081 if (SUCCEEDED(hrc)) 1082 { 1083 /* 1084 * Do the job and try convert the name. 1085 */ 1086 /** @todo automatically load the DBGC plugins or this is a waste of time. */ 1087 char szName[64]; 1088 int vrc = DBGFR3OSDetect(ptrVM.rawUVM(), szName, sizeof(szName)); 1089 if (RT_SUCCESS(vrc) && vrc != VINF_DBGF_OS_NOT_DETCTED) 1263 1090 { 1264 /* 1265 * Do the job and try convert the name. 1266 */ 1267 /** @todo automatically load the DBGC plugins or this is a waste of time. */ 1268 char szName[64]; 1269 int vrc = DBGFR3OSDetect(ptrVM.rawUVM(), szName, sizeof(szName)); 1270 if (RT_SUCCESS(vrc) && vrc != VINF_DBGF_OS_NOT_DETCTED) 1091 try 1271 1092 { 1272 try 1273 { 1274 Bstr bstrName(szName); 1275 bstrName.detachTo(a_pbstrName); 1276 } 1277 catch (std::bad_alloc) 1278 { 1279 hrc = E_OUTOFMEMORY; 1280 } 1093 Bstr bstrName(szName); 1094 aOs = Utf8Str(bstrName); 1281 1095 } 1282 else 1283 hrc = setError(VBOX_E_VM_ERROR, tr("DBGFR3OSDetect failed with %Rrc"), vrc); 1096 catch (std::bad_alloc) 1097 { 1098 hrc = E_OUTOFMEMORY; 1099 } 1284 1100 } 1101 else 1102 hrc = setError(VBOX_E_VM_ERROR, tr("DBGFR3OSDetect failed with %Rrc"), vrc); 1285 1103 } 1286 1104 return hrc; … … 1307 1125 } 1308 1126 1309 STDMETHODIMP MachineDebugger::GetRegister(ULONG a_idCpu, IN_BSTR a_bstrName, BSTR *a_pbstrValue) 1310 { 1311 /* 1312 * Validate and convert input. 1313 */ 1314 CheckComArgStrNotEmptyOrNull(a_bstrName); 1315 CheckComArgNotNull(a_pbstrValue); 1316 Utf8Str strName; 1317 try 1318 { 1319 strName = a_bstrName; 1320 } 1321 catch (std::bad_alloc) 1322 { 1323 return E_OUTOFMEMORY; 1324 } 1325 1127 HRESULT MachineDebugger::getRegister(ULONG aCpuId, const com::Utf8Str &aName, com::Utf8Str &aValue) 1128 { 1326 1129 /* 1327 1130 * The prologue. 1328 1131 */ 1329 1132 LogFlowThisFunc(("\n")); 1330 AutoCaller autoCaller(this); 1331 HRESULT hrc = autoCaller.rc(); 1332 if (SUCCEEDED(hrc)) 1333 { 1334 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1335 Console::SafeVMPtr ptrVM(mParent); 1336 hrc = ptrVM.rc(); 1337 if (SUCCEEDED(hrc)) 1133 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1134 Console::SafeVMPtr ptrVM(mParent); 1135 HRESULT hrc = ptrVM.rc(); 1136 if (SUCCEEDED(hrc)) 1137 { 1138 /* 1139 * Real work. 1140 */ 1141 DBGFREGVAL Value; 1142 DBGFREGVALTYPE enmType; 1143 int vrc = DBGFR3RegNmQuery(ptrVM.rawUVM(), aCpuId, aName.c_str(), &Value, &enmType); 1144 if (RT_SUCCESS(vrc)) 1338 1145 { 1339 /* 1340 * Real work. 1341 */ 1342 DBGFREGVAL Value; 1343 DBGFREGVALTYPE enmType; 1344 int vrc = DBGFR3RegNmQuery(ptrVM.rawUVM(), a_idCpu, strName.c_str(), &Value, &enmType); 1345 if (RT_SUCCESS(vrc)) 1146 try 1346 1147 { 1347 try 1348 { 1349 Bstr bstrValue; 1350 hrc = formatRegisterValue(&bstrValue, &Value, enmType); 1351 if (SUCCEEDED(hrc)) 1352 bstrValue.detachTo(a_pbstrValue); 1353 } 1354 catch (std::bad_alloc) 1355 { 1356 hrc = E_OUTOFMEMORY; 1357 } 1148 Bstr bstrValue; 1149 hrc = formatRegisterValue(&bstrValue, &Value, enmType); 1150 if (SUCCEEDED(hrc)) 1151 aValue = Utf8Str(bstrValue); 1358 1152 } 1359 else if (vrc == VERR_DBGF_REGISTER_NOT_FOUND) 1360 hrc = setError(E_FAIL, tr("Register '%s' was not found"), strName.c_str()); 1361 else if (vrc == VERR_INVALID_CPU_ID) 1362 hrc = setError(E_FAIL, tr("Invalid CPU ID: %u"), a_idCpu); 1363 else 1364 hrc = setError(VBOX_E_VM_ERROR, 1365 tr("DBGFR3RegNmQuery failed with rc=%Rrc querying register '%s' with default cpu set to %u"), 1366 vrc, strName.c_str(), a_idCpu); 1153 catch (std::bad_alloc) 1154 { 1155 hrc = E_OUTOFMEMORY; 1156 } 1367 1157 } 1368 } 1369 1370 return hrc; 1371 } 1372 1373 STDMETHODIMP MachineDebugger::GetRegisters(ULONG a_idCpu, ComSafeArrayOut(BSTR, a_bstrNames), ComSafeArrayOut(BSTR, a_bstrValues)) 1158 else if (vrc == VERR_DBGF_REGISTER_NOT_FOUND) 1159 hrc = setError(E_FAIL, tr("Register '%s' was not found"), aName.c_str()); 1160 else if (vrc == VERR_INVALID_CPU_ID) 1161 hrc = setError(E_FAIL, tr("Invalid CPU ID: %u"), aCpuId); 1162 else 1163 hrc = setError(VBOX_E_VM_ERROR, 1164 tr("DBGFR3RegNmQuery failed with rc=%Rrc querying register '%s' with default cpu set to %u"), 1165 vrc, aName.c_str(), aCpuId); 1166 } 1167 1168 return hrc; 1169 } 1170 1171 HRESULT MachineDebugger::getRegisters(ULONG aCpuId, std::vector<com::Utf8Str> &aNames, std::vector<com::Utf8Str> &aValues) 1374 1172 { 1375 1173 /* … … 1377 1175 */ 1378 1176 LogFlowThisFunc(("\n")); 1379 AutoCaller autoCaller(this); 1380 HRESULT hrc = autoCaller.rc(); 1381 if (SUCCEEDED(hrc)) 1382 { 1383 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1384 Console::SafeVMPtr ptrVM(mParent); 1385 hrc = ptrVM.rc(); 1386 if (SUCCEEDED(hrc)) 1177 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1178 Console::SafeVMPtr ptrVM(mParent); 1179 HRESULT hrc = ptrVM.rc(); 1180 if (SUCCEEDED(hrc)) 1181 { 1182 /* 1183 * Real work. 1184 */ 1185 size_t cRegs; 1186 int vrc = DBGFR3RegNmQueryAllCount(ptrVM.rawUVM(), &cRegs); 1187 if (RT_SUCCESS(vrc)) 1387 1188 { 1388 /* 1389 * Real work. 1390 */ 1391 size_t cRegs; 1392 int vrc = DBGFR3RegNmQueryAllCount(ptrVM.rawUVM(), &cRegs); 1393 if (RT_SUCCESS(vrc)) 1189 PDBGFREGENTRYNM paRegs = (PDBGFREGENTRYNM)RTMemAllocZ(sizeof(paRegs[0]) * cRegs); 1190 if (paRegs) 1394 1191 { 1395 PDBGFREGENTRYNM paRegs = (PDBGFREGENTRYNM)RTMemAllocZ(sizeof(paRegs[0]) *cRegs);1396 if ( paRegs)1192 vrc = DBGFR3RegNmQueryAll(ptrVM.rawUVM(), paRegs, cRegs); 1193 if (RT_SUCCESS(vrc)) 1397 1194 { 1398 vrc = DBGFR3RegNmQueryAll(ptrVM.rawUVM(), paRegs, cRegs); 1399 if (RT_SUCCESS(vrc)) 1195 try 1400 1196 { 1401 try 1197 1198 for (uint32_t iReg = 0; iReg < cRegs; iReg++) 1402 1199 { 1403 com::SafeArray<BSTR> abstrNames(cRegs); 1404 com::SafeArray<BSTR> abstrValues(cRegs); 1405 1406 for (uint32_t iReg = 0; iReg < cRegs; iReg++) 1407 { 1408 Bstr bstrValue; 1409 1410 hrc = formatRegisterValue(&bstrValue, &paRegs[iReg].Val, paRegs[iReg].enmType); 1411 AssertComRC(hrc); 1412 bstrValue.detachTo(&abstrValues[iReg]); 1413 1414 Bstr bstrName(paRegs[iReg].pszName); 1415 bstrName.detachTo(&abstrNames[iReg]); 1416 } 1417 1418 abstrNames.detachTo(ComSafeArrayOutArg(a_bstrNames)); 1419 abstrValues.detachTo(ComSafeArrayOutArg(a_bstrValues)); 1420 } 1421 catch (std::bad_alloc) 1422 { 1423 hrc = E_OUTOFMEMORY; 1200 Bstr bstrValue; 1201 1202 hrc = formatRegisterValue(&bstrValue, &paRegs[iReg].Val, paRegs[iReg].enmType); 1203 AssertComRC(hrc); 1204 aNames[iReg] = Utf8Str(paRegs[iReg].pszName); 1205 aValues[iReg] = Utf8Str(bstrValue); 1424 1206 } 1425 1207 } 1426 else1427 hrc = setError(E_FAIL, tr("DBGFR3RegNmQueryAll failed with %Rrc"), vrc);1428 1429 RTMemFree(paRegs);1208 catch (std::bad_alloc) 1209 { 1210 hrc = E_OUTOFMEMORY; 1211 } 1430 1212 } 1431 1213 else 1432 hrc = E_OUTOFMEMORY; 1214 hrc = setError(E_FAIL, tr("DBGFR3RegNmQueryAll failed with %Rrc"), vrc); 1215 1216 RTMemFree(paRegs); 1433 1217 } 1434 1218 else 1435 hrc = setError(E_FAIL, tr("DBGFR3RegNmQueryAllCount failed with %Rrc"), vrc);1219 hrc = E_OUTOFMEMORY; 1436 1220 } 1437 } 1438 return hrc; 1439 } 1440 1441 STDMETHODIMP MachineDebugger::SetRegister(ULONG a_idCpu, IN_BSTR a_bstrName, IN_BSTR a_bstrValue) 1221 else 1222 hrc = setError(E_FAIL, tr("DBGFR3RegNmQueryAllCount failed with %Rrc"), vrc); 1223 } 1224 return hrc; 1225 } 1226 1227 HRESULT MachineDebugger::setRegister(ULONG aCpuId, const com::Utf8Str &aName, const com::Utf8Str &aValue) 1442 1228 { 1443 1229 ReturnComNotImplemented(); 1444 1230 } 1445 1231 1446 STDMETHODIMP MachineDebugger::SetRegisters(ULONG a_idCpu, ComSafeArrayIn(IN_BSTR, a_bstrNames), ComSafeArrayIn(IN_BSTR, a_bstrValues)) 1232 HRESULT MachineDebugger::setRegisters(ULONG aCpuId, const std::vector<com::Utf8Str> &aNames, 1233 const std::vector<com::Utf8Str> &aValues) 1447 1234 { 1448 1235 ReturnComNotImplemented(); 1449 1236 } 1450 1237 1451 STDMETHODIMP MachineDebugger::DumpGuestStack(ULONG a_idCpu, BSTR *a_pbstrStack)1238 HRESULT MachineDebugger::dumpGuestStack(ULONG aCpuId, com::Utf8Str &aStack) 1452 1239 { 1453 1240 ReturnComNotImplemented(); … … 1460 1247 * @param aPattern The selection pattern. A bit similar to filename globbing. 1461 1248 */ 1462 STDMETHODIMP MachineDebugger::ResetStats(IN_BSTRaPattern)1249 HRESULT MachineDebugger::resetStats(const com::Utf8Str &aPattern) 1463 1250 { 1464 1251 Console::SafeVMPtrQuiet ptrVM(mParent); … … 1467 1254 return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running"); 1468 1255 1469 STAMR3Reset(ptrVM.rawUVM(), Utf8Str(aPattern).c_str());1256 STAMR3Reset(ptrVM.rawUVM(), aPattern.c_str()); 1470 1257 1471 1258 return S_OK; … … 1478 1265 * @param aPattern The selection pattern. A bit similar to filename globbing. 1479 1266 */ 1480 STDMETHODIMP MachineDebugger::DumpStats(IN_BSTRaPattern)1267 HRESULT MachineDebugger::dumpStats(const com::Utf8Str &aPattern) 1481 1268 { 1482 1269 Console::SafeVMPtrQuiet ptrVM(mParent); … … 1485 1272 return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running"); 1486 1273 1487 STAMR3Dump(ptrVM.rawUVM(), Utf8Str(aPattern).c_str());1274 STAMR3Dump(ptrVM.rawUVM(), aPattern.c_str()); 1488 1275 1489 1276 return S_OK; … … 1498 1285 * @param aStats The XML document containing the statistics. 1499 1286 */ 1500 STDMETHODIMP MachineDebugger::GetStats (IN_BSTR aPattern, BOOL aWithDescriptions, BSTR *aStats)1287 HRESULT MachineDebugger::getStats(const com::Utf8Str &aPattern, BOOL aWithDescriptions, com::Utf8Str &aStats) 1501 1288 { 1502 1289 Console::SafeVMPtrQuiet ptrVM (mParent); … … 1506 1293 1507 1294 char *pszSnapshot; 1508 int vrc = STAMR3Snapshot(ptrVM.rawUVM(), Utf8Str(aPattern).c_str(), &pszSnapshot, NULL,1295 int vrc = STAMR3Snapshot(ptrVM.rawUVM(), aPattern.c_str(), &pszSnapshot, NULL, 1509 1296 !!aWithDescriptions); 1510 1297 if (RT_FAILURE(vrc)) … … 1515 1302 * Until that's done, this method is kind of useless for debugger statistics GUI because 1516 1303 * of the amount statistics in a debug build. */ 1517 Bstr(pszSnapshot).detachTo(aStats);1304 aStats = Utf8Str(pszSnapshot); 1518 1305 STAMR3SnapshotFree(ptrVM.rawUVM(), pszSnapshot); 1519 1306 … … 1525 1312 ///////////////////////////////////////////////////////////////////////////// 1526 1313 1527 void MachineDebugger:: flushQueuedSettings()1314 void MachineDebugger::i_flushQueuedSettings() 1528 1315 { 1529 1316 mFlushMode = true; … … 1536 1323 if (maiQueuedEmExecPolicyParams[i] != UINT8_MAX) 1537 1324 { 1538 setEmExecPolicyProperty((EMEXECPOLICY)i, RT_BOOL(maiQueuedEmExecPolicyParams[i]));1325 i_setEmExecPolicyProperty((EMEXECPOLICY)i, RT_BOOL(maiQueuedEmExecPolicyParams[i])); 1539 1326 maiQueuedEmExecPolicyParams[i] = UINT8_MAX; 1540 1327 } … … 1565 1352 ///////////////////////////////////////////////////////////////////////////// 1566 1353 1567 bool MachineDebugger:: queueSettings() const1354 bool MachineDebugger::i_queueSettings() const 1568 1355 { 1569 1356 if (!mFlushMode)
Note:
See TracChangeset
for help on using the changeset viewer.