VirtualBox

Ignore:
Timestamp:
Sep 15, 2008 1:22:28 PM (16 years ago)
Author:
vboxsync
Message:

Debugger: made tstVBoxDbg useful again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Debugger/VBoxDbg.cpp

    r12424 r12462  
    6868
    6969
    70 
    71 /**
    72  * Creates the debugger GUI.
    73  *
    74  * @returns VBox status code.
    75  * @param   pSession    The Virtual Box session.
    76  * @param   ppGui       Where to store the pointer to the debugger instance.
    77  * @param   ppGuiVT     Where to store the virtual method table pointer.
    78  *                      Optional.
    79  */
    80 DBGDECL(int) DBGGuiCreate(ISession *pSession, PDBGGUI *ppGui, PCDBGGUIVT *ppGuiVT)
    81 {
     70/**
     71 * Internal worker for DBGGuiCreate and DBGGuiCreateForVM.
     72 *
     73 * @returns VBox status code.
     74 * @param   pSession    The ISession interface. (DBGGuiCreate)
     75 * @param   pVM         The VM handle. (DBGGuiCreateForVM)
     76 * @param   ppGui       See DBGGuiCreate.
     77 * @param   ppGuiVT     See DBGGuiCreate.
     78 */
     79static int dbgGuiCreate(ISession *pSession, PVM pVM, PDBGGUI *ppGui, PCDBGGUIVT *ppGuiVT)
     80{
     81    /*
     82     * Allocate and initialize the Debugger GUI handle.
     83     */
    8284    PDBGGUI pGui = (PDBGGUI)RTMemAlloc(sizeof(*pGui));
    8385    if (!pGui)
     
    8688    pGui->pVBoxDbgGui = new VBoxDbgGui();
    8789
    88     int rc = pGui->pVBoxDbgGui->init(pSession);
     90    int rc;
     91    if (pSession)
     92        rc = pGui->pVBoxDbgGui->init(pSession);
     93    else
     94        rc = pGui->pVBoxDbgGui->init(pVM);
    8995    if (VBOX_SUCCESS(rc))
    9096    {
     97        /*
     98         * Successfully initialized.
     99         */
    91100        *ppGui = pGui;
    92101        if (ppGuiVT)
     
    95104    }
    96105
     106    /*
     107     * Failed, cleanup.
     108     */
    97109    delete pGui->pVBoxDbgGui;
    98110    RTMemFree(pGui);
     
    105117
    106118/**
     119 * Creates the debugger GUI.
     120 *
     121 * @returns VBox status code.
     122 * @param   pSession    The Virtual Box session.
     123 * @param   ppGui       Where to store the pointer to the debugger instance.
     124 * @param   ppGuiVT     Where to store the virtual method table pointer.
     125 *                      Optional.
     126 */
     127DBGDECL(int) DBGGuiCreate(ISession *pSession, PDBGGUI *ppGui, PCDBGGUIVT *ppGuiVT)
     128{
     129    AssertPtrReturn(pSession, VERR_INVALID_POINTER);
     130    return dbgGuiCreate(pSession, NULL, ppGui, ppGuiVT);
     131}
     132
     133
     134/**
     135 * Creates the debugger GUI given a VM handle.
     136 *
     137 * @returns VBox status code.
     138 * @param   pVM         The VM handle.
     139 * @param   ppGui       Where to store the pointer to the debugger instance.
     140 * @param   ppGuiVT     Where to store the virtual method table pointer.
     141 *                      Optional.
     142 */
     143DBGDECL(int) DBGGuiCreateForVM(PVM pVM, PDBGGUI *ppGui, PCDBGGUIVT *ppGuiVT)
     144{
     145    AssertPtrReturn(pVM, VERR_INVALID_POINTER);
     146    return dbgGuiCreate(NULL, pVM, ppGui, ppGuiVT);
     147}
     148
     149
     150/**
    107151 * Destroys the debugger GUI.
    108152 *
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