VirtualBox

Ignore:
Timestamp:
Feb 16, 2023 3:04:55 PM (2 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: Move debug related debugger stuff from UIMachineLogic to UISession; That ends CSession presence in UIMachineLogic as well.

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  
    619619    return uisession()->acquireEffectiveCPULoad(uLoad);
    620620}
     621
     622#ifdef VBOX_WITH_DEBUGGER_GUI
     623bool UIMachine::dbgCreated(void *pActionDebug)
     624{
     625    return uisession()->dbgCreated(pActionDebug);
     626}
     627
     628void UIMachine::dbgDestroy()
     629{
     630    return uisession()->dbgDestroy();
     631}
     632
     633void UIMachine::dbgShowStatistics()
     634{
     635    return uisession()->dbgShowStatistics();
     636}
     637
     638void UIMachine::dbgShowCommandLine()
     639{
     640    return uisession()->dbgShowCommandLine();
     641}
     642
     643void UIMachine::dbgAdjustRelativePos()
     644{
     645    return uisession()->dbgAdjustRelativePos();
     646}
     647#endif /* VBOX_WITH_DEBUGGER_GUI */
    621648
    622649void UIMachine::detachUi()
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98602 r98605  
    459459        /** Acquires effective CPU @a uLoad. */
    460460        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 */
    461476    /** @} */
    462477
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r98602 r98605  
    107107#include <iprt/path.h>
    108108#include <iprt/thread.h>
    109 #ifdef VBOX_WITH_DEBUGGER_GUI
    110 # include <VBox/dbggui.h>
    111 # include <iprt/ldr.h>
    112 #endif
    113109
    114110/* VirtualBox interface declarations: */
     
    217213#endif /* VBOX_WS_MAC */
    218214
    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_GUI
    221     /* Prepare debugger: */
    222     prepareDebugger();
    223 #endif /* VBOX_WITH_DEBUGGER_GUI */
    224 #endif
    225 
    226215    /* Load settings: */
    227216    loadSettings();
     
    265254#ifdef VBOX_WITH_DEBUGGER_GUI
    266255    prepareDebugger();
    267 #endif
     256#endif /* VBOX_WITH_DEBUGGER_GUI */
    268257    sltMachineStateChanged();
    269258    sltAdditionsStateChanged();
     
    279268{
    280269    return uimachine()->actionPool();
    281 }
    282 
    283 CSession& UIMachineLogic::session() const
    284 {
    285     return uisession()->session();
    286270}
    287271
     
    758742    , m_pDragAndDropActions(0)
    759743    , m_fIsWindowsCreated(false)
    760 #ifdef VBOX_WITH_DEBUGGER_GUI
    761     , m_pDbgGui(0)
    762     , m_pDbgGuiVT(0)
    763 #endif /* VBOX_WITH_DEBUGGER_GUI */
    764744#ifdef VBOX_WS_MAC
    765745    , m_fIsDockIconEnabled(true)
     
    13881368{
    13891369    /* Close debugger: */
    1390     dbgDestroy();
     1370    uimachine()->dbgDestroy();
    13911371}
    13921372#endif /* VBOX_WITH_DEBUGGER_GUI */
     
    24712451void UIMachineLogic::sltShowDebugStatistics()
    24722452{
    2473     if (dbgCreated())
     2453    if (uimachine()->dbgCreated(actionPool()->action(UIActionIndexRT_M_Debug)))
    24742454    {
    24752455        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();
    24792457    }
    24802458}
     
    24822460void UIMachineLogic::sltShowDebugCommandLine()
    24832461{
    2484     if (dbgCreated())
     2462    if (uimachine()->dbgCreated(actionPool()->action(UIActionIndexRT_M_Debug)))
    24852463    {
    24862464        keyboardHandler()->setDebuggerActive();
    2487         m_pDbgGuiVT->pfnShowCommandLine(m_pDbgGui);
     2465        uimachine()->dbgShowCommandLine();
    24882466    }
    24892467}
     
    27112689{
    27122690#ifdef VBOX_WITH_DEBUGGER_GUI
    2713     /* Cleanup debugger before VBoxDbg module handle cleaned up: */
    27142691    cleanupDebugger();
     2692    sltCloseGuestControlConsoleDialog();
     2693#endif /* VBOX_WITH_DEBUGGER_GUI */
    27152694    sltCloseLogDialog();
    2716     sltCloseGuestControlConsoleDialog();
    2717 #endif
    27182695    activateScreenSaver();
    27192696    sltCloseFileManagerDialog();
     
    27352712    pHostKeyAction->toggle();
    27362713}
    2737 
    2738 #ifdef VBOX_WITH_DEBUGGER_GUI
    2739 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 */
    27482714
    27492715void UIMachineLogic::updateMenuDevicesStorage(QMenu *pMenu)
     
    32653231}
    32663232
    3267 #ifdef VBOX_WITH_DEBUGGER_GUI
    3268 
    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         else
    3299             LogRel(("GUI: DBGGuiCreate failed, rc=%Rrc\n", rc));
    3300     }
    3301     else
    3302         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 
    33203233void UIMachineLogic::reset(bool fShowConfirmation)
    33213234{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r98582 r98605  
    5454class UISoftKeyboard;
    5555class UIVMInformationDialog;
    56 class CSession;
    5756class CMachine;
    5857class CConsole;
     
    6564#endif
    6665
    67 #ifdef VBOX_WITH_DEBUGGER_GUI
    68 typedef struct DBGGUIVT const *PCDBGGUIVT;
    69 typedef struct DBGGUI *PDBGGUI;
    70 #endif /* VBOX_WITH_DEBUGGER_GUI */
    71 
    7266/* Machine logic interface: */
    7367class UIMachineLogic : public QIWithRetranslateUI3<QObject>
     
    115109    UIActionPool *actionPool() const;
    116110
    117     /** Returns the session reference. */
    118     CSession& session() const;
    119111    /** Returns the session's machine reference. */
    120112    CMachine& machine() const;
     
    148140    /** An public interface to sltTypeHostKeyComboPressRelease. */
    149141    void typeHostKeyComboPressRelease(bool fToggleSequence);
    150 
    151 #ifdef VBOX_WITH_DEBUGGER_GUI
    152     /** Adjusts relative position for debugger window. */
    153     void dbgAdjustRelativePos();
    154 #endif /* VBOX_WITH_DEBUGGER_GUI */
    155142
    156143protected slots:
     
    415402    bool m_fIsWindowsCreated : 1;
    416403
    417 #ifdef VBOX_WITH_DEBUGGER_GUI
    418     /* 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 
    427404#ifdef VBOX_WS_MAC
    428405    bool m_fIsDockIconEnabled;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp

    r98524 r98605  
    464464                        /* We are going to show close-dialog only
    465465                         * 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;
    469469                    }
    470470                }
     
    646646    /* The debugger windows are bind to the main VM window. */
    647647    if (m_uScreenId == 0)
    648         machineLogic()->dbgAdjustRelativePos();
     648        uimachine()->dbgAdjustRelativePos();
    649649}
    650650#endif /* VBOX_WITH_DEBUGGER_GUI */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98602 r98605  
    7272#endif
    7373
     74/* Other VBox includes: */
     75#ifdef VBOX_WITH_DEBUGGER_GUI
     76# include <VBox/dbggui.h>
     77# include <iprt/ldr.h>
     78#endif
     79
    7480/* External includes: */
    7581#ifdef VBOX_WS_X11
     
    712718    return fSuccess;
    713719}
     720
     721#ifdef VBOX_WITH_DEBUGGER_GUI
     722bool 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
     762void 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
     772void 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
     779void UISession::dbgShowCommandLine()
     780{
     781    m_pDbgGuiVT->pfnShowCommandLine(m_pDbgGui);
     782}
     783
     784void 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 */
    714793
    715794bool UISession::prepareToBeSaved()
     
    811890    , m_fIsGuestSupportsGraphics(false)
    812891    , 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 */
    813897{
    814898}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98602 r98605  
    6565class CNetworkAdapter;
    6666class CMediumAttachment;
     67
     68#ifdef VBOX_WITH_DEBUGGER_GUI
     69typedef struct DBGGUIVT const *PCDBGGUIVT;
     70typedef struct DBGGUI *PDBGGUI;
     71#endif /* VBOX_WITH_DEBUGGER_GUI */
    6772
    6873/** QObject subclass implementing
     
    368373        /** Acquires effective CPU @a uLoad. */
    369374        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 */
    370390    /** @} */
    371391
     
    524544        QVector<UIFrameBuffer*>  m_frameBufferVector;
    525545    /** @} */
     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    /** @} */
    526556};
    527557
Note: See TracChangeset for help on using the changeset viewer.

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