Changeset 98605 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 16, 2023 3:04:55 PM (2 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r98602 r98605 619 619 return uisession()->acquireEffectiveCPULoad(uLoad); 620 620 } 621 622 #ifdef VBOX_WITH_DEBUGGER_GUI 623 bool UIMachine::dbgCreated(void *pActionDebug) 624 { 625 return uisession()->dbgCreated(pActionDebug); 626 } 627 628 void UIMachine::dbgDestroy() 629 { 630 return uisession()->dbgDestroy(); 631 } 632 633 void UIMachine::dbgShowStatistics() 634 { 635 return uisession()->dbgShowStatistics(); 636 } 637 638 void UIMachine::dbgShowCommandLine() 639 { 640 return uisession()->dbgShowCommandLine(); 641 } 642 643 void UIMachine::dbgAdjustRelativePos() 644 { 645 return uisession()->dbgAdjustRelativePos(); 646 } 647 #endif /* VBOX_WITH_DEBUGGER_GUI */ 621 648 622 649 void UIMachine::detachUi() -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r98602 r98605 459 459 /** Acquires effective CPU @a uLoad. */ 460 460 bool acquireEffectiveCPULoad(ulong &uLoad); 461 462 #ifdef VBOX_WITH_DEBUGGER_GUI 463 /** Makes sure debugger GUI is created. */ 464 bool dbgCreated(void *pActionDebug); 465 /** Makes sure debugger GUI is destroyed. */ 466 void dbgDestroy(); 467 468 /** Shows debugger UI statistics window. */ 469 void dbgShowStatistics(); 470 /** Shows debugger UI command line window. */ 471 void dbgShowCommandLine(); 472 473 /** Adjusts relative position for debugger window. */ 474 void dbgAdjustRelativePos(); 475 #endif /* VBOX_WITH_DEBUGGER_GUI */ 461 476 /** @} */ 462 477 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r98602 r98605 107 107 #include <iprt/path.h> 108 108 #include <iprt/thread.h> 109 #ifdef VBOX_WITH_DEBUGGER_GUI110 # include <VBox/dbggui.h>111 # include <iprt/ldr.h>112 #endif113 109 114 110 /* VirtualBox interface declarations: */ … … 217 213 #endif /* VBOX_WS_MAC */ 218 214 219 #if 0 /* To early! The debugger needs a VM handle to work. So, must be done after power on. Moved to initializePostPowerUp. */220 #ifdef VBOX_WITH_DEBUGGER_GUI221 /* Prepare debugger: */222 prepareDebugger();223 #endif /* VBOX_WITH_DEBUGGER_GUI */224 #endif225 226 215 /* Load settings: */ 227 216 loadSettings(); … … 265 254 #ifdef VBOX_WITH_DEBUGGER_GUI 266 255 prepareDebugger(); 267 #endif 256 #endif /* VBOX_WITH_DEBUGGER_GUI */ 268 257 sltMachineStateChanged(); 269 258 sltAdditionsStateChanged(); … … 279 268 { 280 269 return uimachine()->actionPool(); 281 }282 283 CSession& UIMachineLogic::session() const284 {285 return uisession()->session();286 270 } 287 271 … … 758 742 , m_pDragAndDropActions(0) 759 743 , m_fIsWindowsCreated(false) 760 #ifdef VBOX_WITH_DEBUGGER_GUI761 , m_pDbgGui(0)762 , m_pDbgGuiVT(0)763 #endif /* VBOX_WITH_DEBUGGER_GUI */764 744 #ifdef VBOX_WS_MAC 765 745 , m_fIsDockIconEnabled(true) … … 1388 1368 { 1389 1369 /* Close debugger: */ 1390 dbgDestroy();1370 uimachine()->dbgDestroy(); 1391 1371 } 1392 1372 #endif /* VBOX_WITH_DEBUGGER_GUI */ … … 2471 2451 void UIMachineLogic::sltShowDebugStatistics() 2472 2452 { 2473 if ( dbgCreated())2453 if (uimachine()->dbgCreated(actionPool()->action(UIActionIndexRT_M_Debug))) 2474 2454 { 2475 2455 keyboardHandler()->setDebuggerActive(); 2476 const QByteArray &expandBytes = uiCommon().getDebuggerStatisticsExpand().toUtf8(); 2477 const QByteArray &filterBytes = uiCommon().getDebuggerStatisticsFilter().toUtf8(); 2478 m_pDbgGuiVT->pfnShowStatistics(m_pDbgGui, filterBytes.constData(), expandBytes.constData()); 2456 uimachine()->dbgShowStatistics(); 2479 2457 } 2480 2458 } … … 2482 2460 void UIMachineLogic::sltShowDebugCommandLine() 2483 2461 { 2484 if ( dbgCreated())2462 if (uimachine()->dbgCreated(actionPool()->action(UIActionIndexRT_M_Debug))) 2485 2463 { 2486 2464 keyboardHandler()->setDebuggerActive(); 2487 m_pDbgGuiVT->pfnShowCommandLine(m_pDbgGui);2465 uimachine()->dbgShowCommandLine(); 2488 2466 } 2489 2467 } … … 2711 2689 { 2712 2690 #ifdef VBOX_WITH_DEBUGGER_GUI 2713 /* Cleanup debugger before VBoxDbg module handle cleaned up: */2714 2691 cleanupDebugger(); 2692 sltCloseGuestControlConsoleDialog(); 2693 #endif /* VBOX_WITH_DEBUGGER_GUI */ 2715 2694 sltCloseLogDialog(); 2716 sltCloseGuestControlConsoleDialog();2717 #endif2718 2695 activateScreenSaver(); 2719 2696 sltCloseFileManagerDialog(); … … 2735 2712 pHostKeyAction->toggle(); 2736 2713 } 2737 2738 #ifdef VBOX_WITH_DEBUGGER_GUI2739 void UIMachineLogic::dbgAdjustRelativePos()2740 {2741 if (m_pDbgGui)2742 {2743 const QRect rct = activeMachineWindow()->frameGeometry();2744 m_pDbgGuiVT->pfnAdjustRelativePos(m_pDbgGui, rct.x(), rct.y(), rct.width(), rct.height());2745 }2746 }2747 #endif /* VBOX_WITH_DEBUGGER_GUI */2748 2714 2749 2715 void UIMachineLogic::updateMenuDevicesStorage(QMenu *pMenu) … … 3265 3231 } 3266 3232 3267 #ifdef VBOX_WITH_DEBUGGER_GUI3268 3269 bool UIMachineLogic::dbgCreated()3270 {3271 if (m_pDbgGui)3272 return true;3273 3274 RTLDRMOD hLdrMod = uiCommon().getDebuggerModule();3275 if (hLdrMod == NIL_RTLDRMOD)3276 return false;3277 3278 PFNDBGGUICREATE pfnGuiCreate;3279 int rc = RTLdrGetSymbol(hLdrMod, "DBGGuiCreate", (void**)&pfnGuiCreate);3280 if (RT_SUCCESS(rc))3281 {3282 ISession *pISession = session().raw();3283 rc = pfnGuiCreate(pISession, &m_pDbgGui, &m_pDbgGuiVT);3284 if (RT_SUCCESS(rc))3285 {3286 if ( DBGGUIVT_ARE_VERSIONS_COMPATIBLE(m_pDbgGuiVT->u32Version, DBGGUIVT_VERSION)3287 || m_pDbgGuiVT->u32EndVersion == m_pDbgGuiVT->u32Version)3288 {3289 m_pDbgGuiVT->pfnSetParent(m_pDbgGui, activeMachineWindow());3290 m_pDbgGuiVT->pfnSetMenu(m_pDbgGui, actionPool()->action(UIActionIndexRT_M_Debug));3291 dbgAdjustRelativePos();3292 return true;3293 }3294 3295 LogRel(("GUI: DBGGuiCreate failed, incompatible versions (loaded %#x/%#x, expected %#x)\n",3296 m_pDbgGuiVT->u32Version, m_pDbgGuiVT->u32EndVersion, DBGGUIVT_VERSION));3297 }3298 else3299 LogRel(("GUI: DBGGuiCreate failed, rc=%Rrc\n", rc));3300 }3301 else3302 LogRel(("GUI: RTLdrGetSymbol(,\"DBGGuiCreate\",) -> %Rrc\n", rc));3303 3304 m_pDbgGui = 0;3305 m_pDbgGuiVT = 0;3306 return false;3307 }3308 3309 void UIMachineLogic::dbgDestroy()3310 {3311 if (m_pDbgGui)3312 {3313 m_pDbgGuiVT->pfnDestroy(m_pDbgGui);3314 m_pDbgGui = 0;3315 m_pDbgGuiVT = 0;3316 }3317 }3318 #endif /* VBOX_WITH_DEBUGGER_GUI */3319 3320 3233 void UIMachineLogic::reset(bool fShowConfirmation) 3321 3234 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r98582 r98605 54 54 class UISoftKeyboard; 55 55 class UIVMInformationDialog; 56 class CSession;57 56 class CMachine; 58 57 class CConsole; … … 65 64 #endif 66 65 67 #ifdef VBOX_WITH_DEBUGGER_GUI68 typedef struct DBGGUIVT const *PCDBGGUIVT;69 typedef struct DBGGUI *PDBGGUI;70 #endif /* VBOX_WITH_DEBUGGER_GUI */71 72 66 /* Machine logic interface: */ 73 67 class UIMachineLogic : public QIWithRetranslateUI3<QObject> … … 115 109 UIActionPool *actionPool() const; 116 110 117 /** Returns the session reference. */118 CSession& session() const;119 111 /** Returns the session's machine reference. */ 120 112 CMachine& machine() const; … … 148 140 /** An public interface to sltTypeHostKeyComboPressRelease. */ 149 141 void typeHostKeyComboPressRelease(bool fToggleSequence); 150 151 #ifdef VBOX_WITH_DEBUGGER_GUI152 /** Adjusts relative position for debugger window. */153 void dbgAdjustRelativePos();154 #endif /* VBOX_WITH_DEBUGGER_GUI */155 142 156 143 protected slots: … … 415 402 bool m_fIsWindowsCreated : 1; 416 403 417 #ifdef VBOX_WITH_DEBUGGER_GUI418 /* Debugger functionality: */419 bool dbgCreated();420 void dbgDestroy();421 /* The handle to the debugger GUI: */422 PDBGGUI m_pDbgGui;423 /* The virtual method table for the debugger GUI: */424 PCDBGGUIVT m_pDbgGuiVT;425 #endif /* VBOX_WITH_DEBUGGER_GUI */426 427 404 #ifdef VBOX_WS_MAC 428 405 bool m_fIsDockIconEnabled; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r98524 r98605 464 464 /* We are going to show close-dialog only 465 465 * if headless frontend stopped/killed already: */ 466 CMachine machine = uisession()->machine();467 KMachineState machineState = machine.GetState();468 fShowCloseDialog = ! machine.isOk() || machineState == KMachineState_Null;466 CMachine comMachine = machine(); 467 KMachineState enmMachineState = comMachine.GetState(); 468 fShowCloseDialog = !comMachine.isOk() || enmMachineState == KMachineState_Null; 469 469 } 470 470 } … … 646 646 /* The debugger windows are bind to the main VM window. */ 647 647 if (m_uScreenId == 0) 648 machineLogic()->dbgAdjustRelativePos();648 uimachine()->dbgAdjustRelativePos(); 649 649 } 650 650 #endif /* VBOX_WITH_DEBUGGER_GUI */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r98602 r98605 72 72 #endif 73 73 74 /* Other VBox includes: */ 75 #ifdef VBOX_WITH_DEBUGGER_GUI 76 # include <VBox/dbggui.h> 77 # include <iprt/ldr.h> 78 #endif 79 74 80 /* External includes: */ 75 81 #ifdef VBOX_WS_X11 … … 712 718 return fSuccess; 713 719 } 720 721 #ifdef VBOX_WITH_DEBUGGER_GUI 722 bool UISession::dbgCreated(void *pActionDebug) 723 { 724 if (m_pDbgGui) 725 return true; 726 727 RTLDRMOD hLdrMod = uiCommon().getDebuggerModule(); 728 if (hLdrMod == NIL_RTLDRMOD) 729 return false; 730 731 PFNDBGGUICREATE pfnGuiCreate; 732 int rc = RTLdrGetSymbol(hLdrMod, "DBGGuiCreate", (void**)&pfnGuiCreate); 733 if (RT_SUCCESS(rc)) 734 { 735 ISession *pISession = session().raw(); 736 rc = pfnGuiCreate(pISession, &m_pDbgGui, &m_pDbgGuiVT); 737 if (RT_SUCCESS(rc)) 738 { 739 if ( DBGGUIVT_ARE_VERSIONS_COMPATIBLE(m_pDbgGuiVT->u32Version, DBGGUIVT_VERSION) 740 || m_pDbgGuiVT->u32EndVersion == m_pDbgGuiVT->u32Version) 741 { 742 m_pDbgGuiVT->pfnSetParent(m_pDbgGui, activeMachineWindow()); 743 m_pDbgGuiVT->pfnSetMenu(m_pDbgGui, pActionDebug); 744 dbgAdjustRelativePos(); 745 return true; 746 } 747 748 LogRel(("GUI: DBGGuiCreate failed, incompatible versions (loaded %#x/%#x, expected %#x)\n", 749 m_pDbgGuiVT->u32Version, m_pDbgGuiVT->u32EndVersion, DBGGUIVT_VERSION)); 750 } 751 else 752 LogRel(("GUI: DBGGuiCreate failed, rc=%Rrc\n", rc)); 753 } 754 else 755 LogRel(("GUI: RTLdrGetSymbol(,\"DBGGuiCreate\",) -> %Rrc\n", rc)); 756 757 m_pDbgGui = 0; 758 m_pDbgGuiVT = 0; 759 return false; 760 } 761 762 void UISession::dbgDestroy() 763 { 764 if (m_pDbgGui) 765 { 766 m_pDbgGuiVT->pfnDestroy(m_pDbgGui); 767 m_pDbgGui = 0; 768 m_pDbgGuiVT = 0; 769 } 770 } 771 772 void UISession::dbgShowStatistics() 773 { 774 const QByteArray &expandBytes = uiCommon().getDebuggerStatisticsExpand().toUtf8(); 775 const QByteArray &filterBytes = uiCommon().getDebuggerStatisticsFilter().toUtf8(); 776 m_pDbgGuiVT->pfnShowStatistics(m_pDbgGui, filterBytes.constData(), expandBytes.constData()); 777 } 778 779 void UISession::dbgShowCommandLine() 780 { 781 m_pDbgGuiVT->pfnShowCommandLine(m_pDbgGui); 782 } 783 784 void UISession::dbgAdjustRelativePos() 785 { 786 if (m_pDbgGui) 787 { 788 const QRect rct = activeMachineWindow()->frameGeometry(); 789 m_pDbgGuiVT->pfnAdjustRelativePos(m_pDbgGui, rct.x(), rct.y(), rct.width(), rct.height()); 790 } 791 } 792 #endif /* VBOX_WITH_DEBUGGER_GUI */ 714 793 715 794 bool UISession::prepareToBeSaved() … … 811 890 , m_fIsGuestSupportsGraphics(false) 812 891 , m_fIsGuestSupportsSeamless(false) 892 #ifdef VBOX_WITH_DEBUGGER_GUI 893 /* Debug UI stuff: */ 894 , m_pDbgGui(0) 895 , m_pDbgGuiVT(0) 896 #endif /* VBOX_WITH_DEBUGGER_GUI */ 813 897 { 814 898 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r98602 r98605 65 65 class CNetworkAdapter; 66 66 class CMediumAttachment; 67 68 #ifdef VBOX_WITH_DEBUGGER_GUI 69 typedef struct DBGGUIVT const *PCDBGGUIVT; 70 typedef struct DBGGUI *PDBGGUI; 71 #endif /* VBOX_WITH_DEBUGGER_GUI */ 67 72 68 73 /** QObject subclass implementing … … 368 373 /** Acquires effective CPU @a uLoad. */ 369 374 bool acquireEffectiveCPULoad(ulong &uLoad); 375 376 #ifdef VBOX_WITH_DEBUGGER_GUI 377 /** Makes sure debugger GUI is created. */ 378 bool dbgCreated(void *pActionDebug); 379 /** Makes sure debugger GUI is destroyed. */ 380 void dbgDestroy(); 381 382 /** Shows debugger UI statistics window. */ 383 void dbgShowStatistics(); 384 /** Shows debugger UI command line window. */ 385 void dbgShowCommandLine(); 386 387 /** Adjusts relative position for debugger window. */ 388 void dbgAdjustRelativePos(); 389 #endif /* VBOX_WITH_DEBUGGER_GUI */ 370 390 /** @} */ 371 391 … … 524 544 QVector<UIFrameBuffer*> m_frameBufferVector; 525 545 /** @} */ 546 547 /** @name Debugger stuff. 548 ** @{ */ 549 #ifdef VBOX_WITH_DEBUGGER_GUI 550 /** Holds the handle to the debugger GUI. */ 551 PDBGGUI m_pDbgGui; 552 /** Holds the virtual method table for the debugger GUI. */ 553 PCDBGGUIVT m_pDbgGuiVT; 554 #endif /* VBOX_WITH_DEBUGGER_GUI */ 555 /** @} */ 526 556 }; 527 557
Note:
See TracChangeset
for help on using the changeset viewer.