Commit 1d6da504 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

move the output collector to the plain gdb adapter

doesn't make sense anywhere else
parent ba47987e
...@@ -183,10 +183,6 @@ GdbEngine::GdbEngine(DebuggerManager *manager) : ...@@ -183,10 +183,6 @@ GdbEngine::GdbEngine(DebuggerManager *manager) :
m_trkOptions->fromSettings(Core::ICore::instance()->settings()); m_trkOptions->fromSettings(Core::ICore::instance()->settings());
m_gdbAdapter = 0; m_gdbAdapter = 0;
// Output
connect(&m_outputCollector, SIGNAL(byteDelivery(QByteArray)),
this, SLOT(readDebugeeOutput(QByteArray)));
connect(this, SIGNAL(gdbOutputAvailable(int,QString)), connect(this, SIGNAL(gdbOutputAvailable(int,QString)),
m_manager, SLOT(showDebuggerOutput(int,QString)), m_manager, SLOT(showDebuggerOutput(int,QString)),
Qt::QueuedConnection); Qt::QueuedConnection);
...@@ -1392,7 +1388,6 @@ QString GdbEngine::fullName(const QStringList &candidates) ...@@ -1392,7 +1388,6 @@ QString GdbEngine::fullName(const QStringList &candidates)
void GdbEngine::shutdown() void GdbEngine::shutdown()
{ {
debugMessage(_("INITIATE GDBENGINE SHUTDOWN")); debugMessage(_("INITIATE GDBENGINE SHUTDOWN"));
m_outputCollector.shutdown();
initializeVariables(); initializeVariables();
m_gdbAdapter->shutdown(); m_gdbAdapter->shutdown();
} }
...@@ -1410,7 +1405,6 @@ void GdbEngine::detachDebugger() ...@@ -1410,7 +1405,6 @@ void GdbEngine::detachDebugger()
void GdbEngine::exitDebugger() // called from the manager void GdbEngine::exitDebugger() // called from the manager
{ {
disconnectDebuggingHelperActions(); disconnectDebuggingHelperActions();
m_outputCollector.shutdown();
initializeVariables(); initializeVariables();
m_gdbAdapter->shutdown(); m_gdbAdapter->shutdown();
} }
...@@ -1467,43 +1461,6 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp) ...@@ -1467,43 +1461,6 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
connectAdapter(); connectAdapter();
m_gdbAdapter->startAdapter(); m_gdbAdapter->startAdapter();
/*
QStringList gdbArgs;
gdbArgs.prepend(_("mi"));
gdbArgs.prepend(_("-i"));
if (startMode() == AttachCore || startMode() == AttachExternal
|| startMode() == AttachCrashedExternal) {
// nothing to do
} else if (m_startParameters->useTerminal) {
m_stubProc.stop(); // We leave the console open, so recycle it now.
m_stubProc.setWorkingDirectory(m_startParameters->workingDir);
m_stubProc.setEnvironment(m_startParameters->environment);
if (!m_stubProc.start(m_startParameters->executable,
m_startParameters->processArgs)) {
// Error message for user is delivered via a signal.
emitStartFailed();
return;
}
} else {
if (!m_outputCollector.listen()) {
showMessageBox(QMessageBox::Critical, tr("Debugger Startup Failure"),
tr("Cannot set up communication with child process: %1")
.arg(m_outputCollector.errorString()));
emitStartFailed();
return;
}
gdbArgs.prepend(_("--tty=") + m_outputCollector.serverName());
if (!m_startParameters->workingDir.isEmpty())
m_gdbAdapter->setWorkingDirectory(m_startParameters->workingDir);
if (!m_startParameters->environment.isEmpty())
m_gdbAdapter->setEnvironment(m_startParameters->environment);
}
m_gdbAdapter->start(loc, gdbArgs);
*/
} }
void GdbEngine::continueInferior() void GdbEngine::continueInferior()
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include "debuggermanager.h" // only for StartParameters #include "debuggermanager.h" // only for StartParameters
#include "gdbmi.h" #include "gdbmi.h"
#include "watchutils.h" #include "watchutils.h"
#include "outputcollector.h"
#include <QtCore/QByteArray> #include <QtCore/QByteArray>
#include <QtCore/QHash> #include <QtCore/QHash>
...@@ -434,8 +433,6 @@ public: ...@@ -434,8 +433,6 @@ public:
void addOptionPages(QList<Core::IOptionsPage*> *opts) const; void addOptionPages(QList<Core::IOptionsPage*> *opts) const;
const DebuggerStartParameters &startParameters() const const DebuggerStartParameters &startParameters() const
{ return *m_startParameters; } { return *m_startParameters; }
OutputCollector m_outputCollector;
}; };
} // namespace Internal } // namespace Internal
......
...@@ -82,6 +82,10 @@ PlainGdbAdapter::PlainGdbAdapter(GdbEngine *engine, QObject *parent) ...@@ -82,6 +82,10 @@ PlainGdbAdapter::PlainGdbAdapter(GdbEngine *engine, QObject *parent)
// FIXME: // FIXME:
// connect(&m_stubProc, SIGNAL(wrapperStopped()), // connect(&m_stubProc, SIGNAL(wrapperStopped()),
// m_manager, SLOT(exitDebugger())); // m_manager, SLOT(exitDebugger()));
// Output
connect(&m_outputCollector, SIGNAL(byteDelivery(QByteArray)),
engine, SLOT(readDebugeeOutput(QByteArray)));
} }
void PlainGdbAdapter::startAdapter() void PlainGdbAdapter::startAdapter()
...@@ -106,12 +110,12 @@ void PlainGdbAdapter::startAdapter() ...@@ -106,12 +110,12 @@ void PlainGdbAdapter::startAdapter()
return; return;
} }
} else { } else {
if (!m_engine->m_outputCollector.listen()) { if (!m_outputCollector.listen()) {
emitAdapterStartFailed(tr("Cannot set up communication with child process: %1") emitAdapterStartFailed(tr("Cannot set up communication with child process: %1")
.arg(m_engine->m_outputCollector.errorString())); .arg(m_outputCollector.errorString()));
return; return;
} }
gdbArgs.prepend(_("--tty=") + m_engine->m_outputCollector.serverName()); gdbArgs.prepend(_("--tty=") + m_outputCollector.serverName());
if (!startParameters().workingDir.isEmpty()) if (!startParameters().workingDir.isEmpty())
m_gdbProc.setWorkingDirectory(startParameters().workingDir); m_gdbProc.setWorkingDirectory(startParameters().workingDir);
...@@ -202,6 +206,7 @@ void PlainGdbAdapter::interruptInferior() ...@@ -202,6 +206,7 @@ void PlainGdbAdapter::interruptInferior()
void PlainGdbAdapter::shutdown() void PlainGdbAdapter::shutdown()
{ {
debugMessage(_("PLAIN ADAPTER SHUTDOWN %1").arg(state())); debugMessage(_("PLAIN ADAPTER SHUTDOWN %1").arg(state()));
m_outputCollector.shutdown();
switch (state()) { switch (state()) {
case InferiorRunningRequested: case InferiorRunningRequested:
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "abstractgdbadapter.h" #include "abstractgdbadapter.h"
#include "gdbengine.h" #include "gdbengine.h"
#include "outputcollector.h"
#include <consoleprocess.h> #include <consoleprocess.h>
...@@ -82,6 +83,7 @@ private: ...@@ -82,6 +83,7 @@ private:
QProcess m_gdbProc; QProcess m_gdbProc;
Utils::ConsoleProcess m_stubProc; Utils::ConsoleProcess m_stubProc;
OutputCollector m_outputCollector;
}; };
} // namespace Internal } // namespace Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment