OSDN Git Service

debugger: some simplification after engine objects are no more re-used
authorhjk <qtc-committer@nokia.com>
Tue, 16 Nov 2010 11:52:02 +0000 (12:52 +0100)
committerhjk <qtc-committer@nokia.com>
Tue, 16 Nov 2010 11:52:02 +0000 (12:52 +0100)
src/plugins/debugger/gdb/gdbengine.cpp
src/plugins/debugger/gdb/gdbengine.h

index 47167d8..e9f9c60 100644 (file)
@@ -182,14 +182,28 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters)
     setObjectName(QLatin1String("GdbEngine"));
     qRegisterMetaType<WatchData>("WatchData");
 
-    m_commandTimer.setSingleShot(true);
-    connect(&m_commandTimer, SIGNAL(timeout()), SLOT(commandTimeout()));
-
-    // Needs no resetting in initializeVariables()
     m_busy = false;
-    initializeVariables();
+    m_gdbAdapter = 0;
+    m_debuggingHelperState = DebuggingHelperUninitialized;
+    m_gdbVersion = 100;
+    m_gdbBuildVersion = -1;
+    m_isMacGdb = false;
+    m_hasPython = false;
+    m_registerNamesListed = false;
+    m_hasInferiorThreadList = false;
+    m_sourcesListUpdating = false;
+    m_oldestAcceptableToken = -1;
+    m_outputCodec = QTextCodec::codecForLocale();
+    m_pendingWatchRequests = 0;
+    m_pendingBreakpointRequests = 0;
+    m_commandsDoneCallback = 0;
+    invalidateSourcesList();
+
     m_gdbAdapter = createAdapter();
 
+    m_commandTimer.setSingleShot(true);
+    connect(&m_commandTimer, SIGNAL(timeout()), SLOT(commandTimeout()));
+
     connect(debuggerCore()->action(AutoDerefPointers), SIGNAL(valueChanged(QVariant)),
             SLOT(reloadLocals()));
     connect(debuggerCore()->action(SortStructMembers), SIGNAL(valueChanged(QVariant)),
@@ -217,49 +231,6 @@ GdbEngine::~GdbEngine()
     m_gdbAdapter = 0;
 }
 
-void GdbEngine::initializeVariables()
-{
-    m_debuggingHelperState = DebuggingHelperUninitialized;
-    m_gdbVersion = 100;
-    m_gdbBuildVersion = -1;
-    m_isMacGdb = false;
-    m_hasPython = false;
-    m_registerNamesListed = false;
-    m_hasInferiorThreadList = false;
-
-    m_fullToShortName.clear();
-    m_shortToFullName.clear();
-
-    invalidateSourcesList();
-    m_sourcesListUpdating = false;
-    m_oldestAcceptableToken = -1;
-    m_outputCodec = QTextCodec::codecForLocale();
-    m_pendingWatchRequests = 0;
-    m_pendingBreakpointRequests = 0;
-    m_commandsDoneCallback = 0;
-    m_commandsToRunOnTemporaryBreak.clear();
-    m_cookieForToken.clear();
-
-    m_pendingConsoleStreamOutput.clear();
-    m_pendingLogStreamOutput.clear();
-
-    m_inbuffer.clear();
-    m_resultVarName.clear();
-
-    m_commandTimer.stop();
-
-    // ConverterState has no reset() function.
-    m_outputCodecState.~ConverterState();
-    new (&m_outputCodecState) QTextCodec::ConverterState();
-
-    m_currentFunctionArgs.clear();
-    m_currentFrame.clear();
-    m_dumperHelper.clear();
-#ifdef Q_OS_LINUX
-    m_entryPoint.clear();
-#endif
-}
-
 QString GdbEngine::errorMessage(QProcess::ProcessError error)
 {
     switch (error) {
@@ -4313,7 +4284,6 @@ void GdbEngine::handleGdbFinished(int code, QProcess::ExitStatus type)
         showStatusMessage(msg);
         //m_gdbAdapter->shutdownEngine();
     }
-    initializeVariables();
 */
     switch (state()) {
     case EngineShutdownRequested:
@@ -4332,9 +4302,9 @@ void GdbEngine::handleGdbFinished(int code, QProcess::ExitStatus type)
                     tr("The gdb process crashed.") :
                     tr("The gdb process exited unexpectedly (code %1)").arg(code);
         showMessageBox(QMessageBox::Critical, tr("Unexpected Gdb Exit"), msg);
-    }
         break;
     }
+    }
 }
 
 void GdbEngine::handleAdapterStartFailed(const QString &msg, const QString &settingsIdHint)
index 01aaeec..ebb8aac 100644 (file)
@@ -113,7 +113,6 @@ private: ////////// General Interface //////////
 
 private: ////////// General State //////////
 
-    void initializeVariables();
     DebuggerStartMode startMode() const;
     Q_SLOT void reloadLocals();