- Timestamp:
- Sep 15, 2008 1:22:28 PM (16 years ago)
- Location:
- trunk/src/VBox/Debugger
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/VBoxDbg.cpp
r12424 r12462 68 68 69 69 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 */ 79 static int dbgGuiCreate(ISession *pSession, PVM pVM, PDBGGUI *ppGui, PCDBGGUIVT *ppGuiVT) 80 { 81 /* 82 * Allocate and initialize the Debugger GUI handle. 83 */ 82 84 PDBGGUI pGui = (PDBGGUI)RTMemAlloc(sizeof(*pGui)); 83 85 if (!pGui) … … 86 88 pGui->pVBoxDbgGui = new VBoxDbgGui(); 87 89 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); 89 95 if (VBOX_SUCCESS(rc)) 90 96 { 97 /* 98 * Successfully initialized. 99 */ 91 100 *ppGui = pGui; 92 101 if (ppGuiVT) … … 95 104 } 96 105 106 /* 107 * Failed, cleanup. 108 */ 97 109 delete pGui->pVBoxDbgGui; 98 110 RTMemFree(pGui); … … 105 117 106 118 /** 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 */ 127 DBGDECL(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 */ 143 DBGDECL(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 /** 107 151 * Destroys the debugger GUI. 108 152 * -
trunk/src/VBox/Debugger/VBoxDbgGui.cpp
r12183 r12462 33 33 # include <qdesktopwidget.h> 34 34 # include <qapplication.h> 35 #endif 35 #endif 36 36 37 37 … … 45 45 46 46 47 int VBoxDbgGui::init(PVM pVM) 48 { 49 /* 50 * Set the VM handle and update the desktop size. 51 */ 52 m_pVM = pVM; 53 updateDesktopSize(); 54 55 return VINF_SUCCESS; 56 } 57 58 47 59 int VBoxDbgGui::init(ISession *pSession) 48 60 { 49 /* 50 * Update the desktop size first. 51 */ 52 updateDesktopSize(); 61 int rc = VERR_GENERAL_FAILURE; 53 62 54 63 /* … … 74 83 if (SUCCEEDED(hrc)) 75 84 { 76 m_pVM = (PVM)(uintptr_t)ullVM; 77 return VINF_SUCCESS; 85 rc = init((PVM)(uintptr_t)ullVM); 86 if (RT_SUCCESS(rc)) 87 return rc; 78 88 } 79 89 … … 86 96 } 87 97 88 return VERR_GENERAL_FAILURE;98 return rc; 89 99 } 90 100 … … 143 153 #else 144 154 m_pDbgStats = new VBoxDbgStats(m_pVM); 145 #endif 155 #endif 146 156 connect(m_pDbgStats, SIGNAL(destroyed(QObject *)), this, SLOT(notifyChildDestroyed(QObject *))); 147 157 repositionStatistics(); … … 185 195 if (fResize) 186 196 /* Resize it to cover the space down to the bottom of the desktop. */ 187 resizeWidget(m_pDbgConsole, m_cx, m_cyDesktop - m_cy - m_y + m_yDesktop);197 resizeWidget(m_pDbgConsole, RT_MAX(m_cx, 32), m_cyDesktop - m_cy - m_y + m_yDesktop); 188 198 } 189 199 } -
trunk/src/VBox/Debugger/VBoxDbgGui.h
r12180 r12462 51 51 52 52 /** 53 * Initializes a VBoxDbgGui object .53 * Initializes a VBoxDbgGui object by ISession. 54 54 * 55 55 * @returns VBox status code. … … 57 57 */ 58 58 int init(ISession *pSession); 59 60 /** 61 * Initializes a VBoxDbgGui object by VM handle. 62 * 63 * @returns VBox status code. 64 * @param pVM The VM handle. 65 */ 66 int init(PVM pVM); 59 67 60 68 /** -
trunk/src/VBox/Debugger/testcase/tstVBoxDbg.cpp
r11822 r12462 25 25 *******************************************************************************/ 26 26 #include <qapplication.h> 27 #include <VBox/dbg .h>27 #include <VBox/dbggui.h> 28 28 #include <VBox/vm.h> 29 29 #include <VBox/err.h> … … 57 57 */ 58 58 QApplication App(argc, argv); 59 // DBGGuiCreate(pVM, true, NULL); 60 App.exec(); 59 PDBGGUI pGui; 60 PCDBGGUIVT pGuiVT; 61 rc = DBGGuiCreateForVM(pVM, &pGui, &pGuiVT); 62 if (RT_SUCCESS(rc)) 63 { 64 RTPrintf(TESTCASE ": calling pfnShowCommandLine...\n"); 65 rc = pGuiVT->pfnShowCommandLine(pGui); 66 if (RT_FAILURE(rc)) 67 { 68 RTPrintf(TESTCASE ": error: pfnShowCommandLine failed! rc=%Rrc\n", rc); 69 cErrors++; 70 } 71 72 #if 0 73 RTPrintf(TESTCASE ": calling pfnShowStatistics...\n"); 74 pGuiVT->pfnShowStatistics(pGui); 75 if (RT_FAILURE(rc)) 76 { 77 RTPrintf(TESTCASE ": error: pfnShowStatistics failed! rc=%Rrc\n", rc); 78 cErrors++; 79 } 80 #endif 81 82 RTPrintf(TESTCASE ": calling App.exec()...\n"); 83 App.exec(); 84 } 85 else 86 { 87 RTPrintf(TESTCASE ": error: DBGGuiCreateForVM failed! rc=%Rrc\n", rc); 88 cErrors++; 89 } 61 90 62 91 /* … … 66 95 if (!VBOX_SUCCESS(rc)) 67 96 { 68 RTPrintf(TESTCASE ": error: failed to destroy vm! rc=% d\n", rc);97 RTPrintf(TESTCASE ": error: failed to destroy vm! rc=%Rrc\n", rc); 69 98 cErrors++; 70 99 } … … 72 101 else 73 102 { 74 RTPrintf(TESTCASE ": fatal error: failed to create vm! rc=% d\n", rc);103 RTPrintf(TESTCASE ": fatal error: failed to create vm! rc=%Rrc\n", rc); 75 104 cErrors++; 76 105 }
Note:
See TracChangeset
for help on using the changeset viewer.