VirtualBox

Ignore:
Timestamp:
Sep 12, 2008 2:45:16 PM (16 years ago)
Author:
vboxsync
Message:

DBGGui,VirtualBox4: dynamically load the debugger GUI (VBoxDBG).

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/Makefile.kmk

    r12397 r12424  
    152152VirtualBox4_DEFS.win       = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
    153153VirtualBox4_DEFS.win.amd64 = VBOX_WITHOUT_QHTTP
    154 #ifndef VBOX_OSE
    155154## @todo VBOX_WITH_HACKED_QT doesn't apply to Qt4, so why is this still here?
    156  VirtualBox4_DEFS.darwin  += VBOX_WITH_HACKED_QT
    157 #endif
     155VirtualBox4_DEFS.darwin  += VBOX_WITH_HACKED_QT
    158156ifdef VBOX_WITH_ICHAT_THEATER
    159157 VirtualBox4_DEFS.darwin += VBOX_WITH_ICHAT_THEATER
     
    225223 VirtualBox4_LIBS         += $(PATH_DLL)/VBoxKeyboard$(VBOX_SUFF_DLL)
    226224endif
    227 
    228 if "$(USER)" == "bird"
    229 ifdef VBOX_WITH_DEBUGGER_GUI ## @todo make this dynamically loadable and ship with release builds too.
    230  ifeq ($(KBUILD_TARGET),win)
    231   VirtualBox4_LIBS        += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
    232  else
    233   VirtualBox4_LIBS        += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
    234  endif
    235 endif
    236 endif
    237 
    238225
    239226# Headers containing definitions of classes that use the Q_OBJECT macro.
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleWnd.h

    r12171 r12424  
    3636#include <QDialog>
    3737
    38 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     38#ifdef VBOX_WITH_DEBUGGER_GUI
    3939# include <VBox/dbggui.h>
    4040#endif
     
    104104    void retranslateUi();
    105105
    106 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     106#ifdef VBOX_WITH_DEBUGGER_GUI
    107107    bool dbgCreated();
    108108    void dbgDestroy();
     
    193193    void dbgShowStatistics();
    194194    void dbgShowCommandLine();
     195    void dbgLoggingToggled(bool aBool);
    195196
    196197    void onExitFullscreen();
     
    234235    QAction *devicesInstallGuestToolsAction;
    235236
    236 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     237#ifdef VBOX_WITH_DEBUGGER_GUI
    237238    // Debugger actions
    238239    QAction *dbgStatisticsAction;
    239240    QAction *dbgCommandLineAction;
     241    QAction *dbgLoggingAction;
    240242#endif
    241243
     
    264266    VBoxUSBMenu *mDevicesUSBMenu;
    265267    /* VBoxSwitchMenu *mDevicesVRDPMenu; */
    266 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     268#ifdef VBOX_WITH_DEBUGGER_GUI
    267269    // Debugger popup menu
    268270    QMenu *mDbgMenu;
     
    324326    bool mIsAutoSaveMedia : 1;
    325327
    326 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
    327     // Debugger GUI
    328     PDBGGUI dbg_gui;
     328#ifdef VBOX_WITH_DEBUGGER_GUI
     329    /** The handle to the debugger gui. */
     330    PDBGGUI mDbgGui;
     331    /** The virtual method table for the debugger GUI. */
     332    PCDBGGUIVT mDbgGuiVT;
    329333#endif
    330334
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h

    r12331 r12424  
    237237    const char *vmRenderModeStr() const { return vm_render_mode_str; }
    238238
    239 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
    240     bool isDebuggerEnabled() const { return dbg_enabled; }
    241     bool isDebuggerVisibleAtStartup() const { return dbg_visible_at_startup; }
     239#ifdef VBOX_WITH_DEBUGGER_GUI
     240    bool isDebuggerEnabled() const { return mDbgEnabled; }
     241    bool isDebuggerAutoShowEnabled() const { return mDbgAutoShow; }
     242    RTLDRMOD getDebuggerModule() const { return mhVBoxDbg; }
    242243#endif
    243244
     
    716717    const char * vm_render_mode_str;
    717718
    718 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
    719     bool dbg_enabled;
    720     bool dbg_visible_at_startup;
     719#ifdef VBOX_WITH_DEBUGGER_GUI
     720    /** Whether the debugger should be accessible or not.
     721     * Use --dbg, the env.var. VBOX_GUI_DBG_ENABLED, --debug or the env.var.
     722     * VBOX_GUI_DBG_AUTO_SHOW to enable. */
     723    bool mDbgEnabled;
     724    /** Whether to show the debugger automatically with the console.
     725     * Use --debug or the env.var. VBOX_GUI_DBG_AUTO_SHOW to enable. */
     726    bool mDbgAutoShow;
     727    /** VBoxDbg module handle. */
     728    RTLDRMOD mhVBoxDbg;
    721729#endif
    722730
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleWnd.cpp

    r12201 r12424  
    6363#endif
    6464
    65 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
    66 #include <VBox/err.h>
     65#ifdef VBOX_WITH_DEBUGGER_GUI
     66# include <VBox/err.h>
     67# include <iprt/ldr.h>
    6768#endif
    6869
     
    115116    : QIWithRetranslateUI2<QMainWindow> (aParent, aFlags)
    116117    , mMainMenu (0)
    117 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     118#ifdef VBOX_WITH_DEBUGGER_GUI
    118119    , dbgStatisticsAction (NULL)
    119120    , dbgCommandLineAction (NULL)
     121    , dbgLoggingAction (NULL)
    120122    , mDbgMenu (NULL)
    121123#endif
     
    133135    , mIsFirstTimeStarted (false)
    134136    , mIsAutoSaveMedia (true)
    135 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
    136     , dbg_gui (NULL)
     137#ifdef VBOX_WITH_DEBUGGER_GUI
     138    , mDbgGui (NULL)
     139    , mDbgGuiVT (NULL)
    137140#endif
    138141#ifdef Q_WS_MAC
     
    262265                                                                     ":/guesttools_disabled_16px.png"));
    263266
    264 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     267#ifdef VBOX_WITH_DEBUGGER_GUI
    265268    if (vboxGlobal().isDebuggerEnabled())
    266269    {
    267270        dbgStatisticsAction = new QAction (this);
    268271        dbgCommandLineAction = new QAction (this);
     272        dbgLoggingAction = new QAction (this);
     273        dbgLoggingAction->setCheckable (true);
     274        dbgLoggingAction->setIcon (VBoxGlobal::iconSet (":/start_16px.png")); /// @todo find the default check boxes.
    269275    }
    270276    else
     
    272278        dbgStatisticsAction = NULL;
    273279        dbgCommandLineAction = NULL;
     280        dbgLoggingAction = NULL;
    274281    }
    275282#endif
     
    355362    mDevicesUSBMenu->menuAction()->setData (false);
    356363
    357 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     364#ifdef VBOX_WITH_DEBUGGER_GUI
    358365    /* Debug popup menu */
    359366    if (vboxGlobal().isDebuggerEnabled())
     
    363370        mDbgMenu->addAction (dbgStatisticsAction);
    364371        mDbgMenu->addAction (dbgCommandLineAction);
     372        mDbgMenu->addAction (dbgLoggingAction);
    365373    }
    366374    else
     
    555563             this, SLOT (processGlobalSettingChange (const char *, const char *)));
    556564
    557 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     565#ifdef VBOX_WITH_DEBUGGER_GUI
    558566    if (dbgStatisticsAction)
    559567        connect (dbgStatisticsAction, SIGNAL (triggered()),
     
    562570        connect (dbgCommandLineAction, SIGNAL (triggered()),
    563571                 this, SLOT (dbgShowCommandLine()));
     572    if (dbgLoggingAction)
     573        connect (dbgLoggingAction, SIGNAL (toggled (bool)),
     574                 this, SLOT (dbgLoggingToggled (bool)));
    564575#endif
    565576
     
    852863    console->onViewOpened();
    853864
     865#ifdef VBOX_WITH_DEBUGGER_GUI
     866    /* open debugger windows if requested */
     867    if (vboxGlobal().isDebuggerAutoShowEnabled())
     868    {
     869        move (QPoint (0, 0));
     870        dbgShowStatistics();
     871        dbgShowCommandLine();
     872    }
     873#endif
     874
    854875    bool saved = machine_state == KMachineState_Saved;
    855876
     
    918939        return;
    919940    }
    920 
    921 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
    922     /* open debugger windows if requested */
    923     if (vboxGlobal().isDebuggerVisibleAtStartup())
    924     {
    925         move (QPoint (0, 0));
    926         dbgShowStatistics();
    927         dbgShowCommandLine();
    928     }
    929 #endif
    930941
    931942    /* Currently the machine is started and the guest API could be used...
     
    11001111            {
    11011112                mNormalGeo.setSize (re->size());
    1102 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     1113#ifdef VBOX_WITH_DEBUGGER_GUI
    11031114                dbgAdjustRelativePos();
    11041115#endif
     
    11201131            {
    11211132                mNormalGeo.moveTo (geometry().x(), geometry().y());
    1122 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     1133#ifdef VBOX_WITH_DEBUGGER_GUI
    11231134                dbgAdjustRelativePos();
    11241135#endif
     
    15391550        tr ("Mount the Guest Additions installation image"));
    15401551
    1541 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     1552#ifdef VBOX_WITH_DEBUGGER_GUI
    15421553    /* Debug actions */
    15431554
     
    15461557    if (dbgCommandLineAction)
    15471558        dbgCommandLineAction->setText (tr ("&Command Line...", "debug action"));
     1559    if (dbgLoggingAction)
     1560        dbgLoggingAction->setText (tr ("&Logging...", "debug action"));
    15481561#endif
    15491562
     
    15671580//    mDevicesMenu->setIcon (VBoxGlobal::iconSet (":/settings_16px.png"));
    15681581
    1569 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     1582#ifdef VBOX_WITH_DEBUGGER_GUI
    15701583    if (vboxGlobal().isDebuggerEnabled())
    15711584        mDbgMenu->setTitle (tr ("De&bug"));
     
    33913404void VBoxConsoleWnd::dbgShowStatistics()
    33923405{
    3393 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     3406#ifdef VBOX_WITH_DEBUGGER_GUI
    33943407    if (dbgCreated())
    3395         DBGGuiShowStatistics (dbg_gui);
     3408        mDbgGuiVT->pfnShowStatistics (mDbgGui);
    33963409#endif
    33973410}
     
    34023415void VBoxConsoleWnd::dbgShowCommandLine()
    34033416{
    3404 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     3417#ifdef VBOX_WITH_DEBUGGER_GUI
    34053418    if (dbgCreated())
    3406         DBGGuiShowCommandLine (dbg_gui);
    3407 #endif
    3408 }
    3409 
    3410 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
     3419        mDbgGuiVT->pfnShowCommandLine (mDbgGui);
     3420#endif
     3421}
     3422
     3423/**
     3424 * Called when the Debug->Logging menu item is selected.
     3425 */
     3426void VBoxConsoleWnd::dbgLoggingToggled(bool aState)
     3427{
     3428    NOREF(aState);
     3429#ifdef VBOX_WITH_DEBUGGER_GUI
     3430    CConsole cconsole = csession.GetConsole();
     3431    if (cconsole.isOk())
     3432    {
     3433        CMachineDebugger cdebugger = cconsole.GetDebugger();
     3434        if (cconsole.isOk())
     3435            cdebugger.SetLogEnabled(aState);
     3436    }
     3437#endif
     3438}
     3439
     3440#ifdef VBOX_WITH_DEBUGGER_GUI
    34113441
    34123442/**
     
    34183448bool VBoxConsoleWnd::dbgCreated()
    34193449{
    3420     if (dbg_gui)
     3450    if (mDbgGui)
    34213451        return true;
    3422     int rc = DBGGuiCreate (csession.iface(), &dbg_gui);
    3423     if (VBOX_SUCCESS (rc))
    3424     {
    3425         dbgAdjustRelativePos();
    3426         return true;
    3427     }
     3452
     3453    RTLDRMOD hLdrMod = vboxGlobal().getDebuggerModule();
     3454    if (hLdrMod == NIL_RTLDRMOD)
     3455        return false;
     3456
     3457    PFNDBGGUICREATE pfnGuiCreate;
     3458    int rc = RTLdrGetSymbol (hLdrMod, "DBGGuiCreate", (void **)&pfnGuiCreate);
     3459    if (RT_SUCCESS (rc))
     3460    {
     3461        rc = pfnGuiCreate (csession.iface(), &mDbgGui, &mDbgGuiVT);
     3462        if (RT_SUCCESS (rc))
     3463        {
     3464            dbgAdjustRelativePos();
     3465            return true;
     3466        }
     3467        LogRel(("DBGGuiCreate failed, rc=%Rrc\n", rc));
     3468    }
     3469    else
     3470        LogRel(("RTLdrGetSymbol(,\"DBGGuiCreate\",) -> %Rrc\n", rc));
     3471
     3472    mDbgGui = NULL;
     3473    mDbgGuiVT = NULL;
    34283474    return false;
    34293475}
     
    34343480void VBoxConsoleWnd::dbgDestroy()
    34353481{
    3436     if (dbg_gui)
    3437     {
    3438         DBGGuiDestroy (dbg_gui);
    3439         dbg_gui = NULL;
     3482    if (mDbgGui)
     3483    {
     3484        mDbgGuiVT->pfnDestroy (mDbgGui);
     3485        mDbgGui = NULL;
     3486        mDbgGuiVT = NULL;
    34403487    }
    34413488}
     
    34463493void VBoxConsoleWnd::dbgAdjustRelativePos()
    34473494{
    3448     if (dbg_gui)
     3495    if (mDbgGui)
    34493496    {
    34503497        QRect rct = frameGeometry();
    3451         DBGGuiAdjustRelativePos (dbg_gui, rct.x(), rct.y(), rct.width(), rct.height());
    3452     }
    3453 }
    3454 
    3455 #endif
     3498        mDbgGuiVT->pfnAdjustRelativePos (mDbgGui, rct.x(), rct.y(), rct.width(), rct.height());
     3499    }
     3500}
     3501
     3502#endif /* VBOX_WITH_DEBUGGER_GUI */
    34563503
    34573504VBoxSFDialog::VBoxSFDialog (QWidget *aParent, CSession &aSession)
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r12373 r12424  
    8585#include <iprt/env.h>
    8686#include <iprt/file.h>
     87#include <iprt/ldr.h>
    8788
    8889#if defined (Q_WS_X11)
     
    40004001/**
    40014002 * Automatically figure out which hdd backends are currently support by vbox.
    4002  * Returned is a list of pairs with the form 
     4003 * Returned is a list of pairs with the form
    40034004 * <"Backend Name", "*.suffix1 *.suffix2 ...">.
    40044005 */
     
    45104511
    45114512    vm_render_mode_str = 0;
    4512 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
    4513 #ifdef VBOX_WITH_DEBUGGER_GUI_MENU
    4514     dbg_enabled = true;
    4515 #else
    4516     dbg_enabled = false;
    4517 #endif
    4518     dbg_visible_at_startup = false;
     4513#ifdef VBOX_WITH_DEBUGGER_GUI
     4514# ifdef VBOX_WITH_DEBUGGER_GUI_MENU
     4515    mDbgEnabled = true;
     4516# else
     4517    mDbgEnabled = RTEnvExist("VBOX_GUI_DBG_ENABLED");
     4518# endif
     4519    mDbgAutoShow = RTEnvExist("VBOX_GUI_DBG_AUTO_SHOW");
    45194520#endif
    45204521
     
    45554556                vm_render_mode_str = qApp->argv() [i];
    45564557        }
    4557 #if defined(VBOX_WITH_DEBUGGER_GUI) && 0
    4558         else if (!::strcmp (arg, "-dbg"))
    4559         {
    4560             dbg_enabled = true;
    4561         }
    4562 #ifdef DEBUG
    4563         else if (!::strcmp (arg, "-nodebug"))
    4564         {
    4565             dbg_enabled = false;
    4566             dbg_visible_at_startup = false;
    4567         }
    4568 #else
    4569         else if (!::strcmp( arg, "-debug"))
    4570         {
    4571             dbg_enabled = true;
    4572             dbg_visible_at_startup = true;
     4558#ifdef VBOX_WITH_DEBUGGER_GUI
     4559        else if (!::strcmp (arg, "-dbg") || !::strcmp (arg, "--dbg"))
     4560        {
     4561            mDbgEnabled = true;
     4562        }
     4563        else if (!::strcmp( arg, "-debug") || !::strcmp( arg, "--debug"))
     4564        {
     4565            mDbgEnabled = true;
     4566            mDbgAutoShow = true;
     4567        }
     4568        else if (!::strcmp (arg, "-no-debug") || !::strcmp (arg, "--no-debug"))
     4569        {
     4570            mDbgEnabled = false;
     4571            mDbgAutoShow = false;
    45734572        }
    45744573#endif
    4575 #endif
     4574        /** @todo add an else { msgbox(syntax error); exit(1); } here, pretty please... */
    45764575        i++;
    45774576    }
     
    45854584    if (!mVBox.isOk())
    45864585        return;
     4586
     4587#ifdef VBOX_WITH_DEBUGGER_GUI
     4588    /* setup the debugger gui. */
     4589    if (RTEnvExist("VBOX_GUI_NO_DEBUGGER"))
     4590        mDbgEnabled = mDbgAutoShow = false;
     4591    if (mDbgEnabled)
     4592    {
     4593        int rc = SUPR3HardenedLdrLoadAppPriv("VBoxDbg", &mhVBoxDbg);
     4594        if (RT_FAILURE(rc))
     4595        {
     4596            mhVBoxDbg = NIL_RTLDRMOD;
     4597            mDbgAutoShow = false;
     4598            LogRel(("Failed to load VBoxDbg, rc=%Rrc\n", rc));
     4599        }
     4600    }
     4601#endif
    45874602
    45884603    mValid = true;
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