Commit e5f0807f authored by hjk's avatar hjk

debugger: refactoring of AbstractGdbAdapter

remove shutdownInferior()
rename shutdownAdapter() into shutdown()
remove errorString()
rename isAdapter() into isTrkAdapter()
parent 252fd2e7
......@@ -74,13 +74,12 @@ public:
: QObject(parent), m_engine(engine), m_state(AdapterNotRunning)
{}
virtual QString errorString() const = 0;
virtual QByteArray readAllStandardError() = 0;
virtual QByteArray readAllStandardOutput() = 0;
virtual qint64 write(const char *data) = 0;
virtual void setWorkingDirectory(const QString &dir) = 0;
virtual void setEnvironment(const QStringList &env) = 0;
virtual bool isAdapter() const = 0;
virtual bool isTrkAdapter() const = 0;
virtual void startAdapter(const DebuggerStartParametersPtr &sp) = 0;
virtual void prepareInferior() = 0;
......
......@@ -1190,7 +1190,7 @@ void GdbEngine::reloadStack()
{
QString cmd = _("-stack-list-frames");
int stackDepth = theDebuggerAction(MaximalStackDepth)->value().toInt();
if (stackDepth && !m_gdbAdapter->isAdapter())
if (stackDepth && !m_gdbAdapter->isTrkAdapter())
cmd += _(" 0 ") + QString::number(stackDepth);
postCommand(cmd, WatchUpdate, CB(handleStackListFrames), false);
// FIXME: gdb 6.4 symbianelf likes to be asked twice. The first time it
......@@ -1199,7 +1199,7 @@ void GdbEngine::reloadStack()
// access the memory belonging to the lower frames. But as we know
// this always happens, ask the second time immediately instead
// of waiting for the first request to fail.
if (m_gdbAdapter->isAdapter())
if (m_gdbAdapter->isTrkAdapter())
postCommand(cmd, WatchUpdate, CB(handleStackListFrames), false);
}
......@@ -1291,7 +1291,7 @@ void GdbEngine::handleStop2(const GdbMi &data)
}
// FIXME: Hack, remove as soon as we get real stack traces.
if (m_gdbAdapter->isAdapter()) {
if (m_gdbAdapter->isTrkAdapter()) {
StackFrame f;
f.file = QString::fromLocal8Bit(fullName.data());
f.line = frame.findChild("line").data().toInt();
......@@ -1895,7 +1895,7 @@ void GdbEngine::sendInsertBreakpoint(int index)
// cmd += "-c " + data->condition + " ";
#else
QString cmd = _("-break-insert -f ");
if (m_gdbAdapter->isAdapter())
if (m_gdbAdapter->isTrkAdapter())
cmd = _("-break-insert ");
//if (!data->condition.isEmpty())
// cmd += _("-c ") + data->condition + ' ';
......@@ -2477,7 +2477,7 @@ void GdbEngine::handleStackListThreads(const GdbResultRecord &record, const QVar
void GdbEngine::reloadRegisters()
{
if (m_gdbAdapter->isAdapter()) {
if (m_gdbAdapter->isTrkAdapter()) {
// FIXME: remove that special case. This is only to prevent
// gdb from asking for the values of the fixed point registers
postCommand(_("-data-list-register-values x 0 1 2 3 4 5 6 7 8 9 "
......@@ -4224,7 +4224,7 @@ void GdbEngine::handleInferiorPrepared()
} else if (startMode() == StartInternal || startMode() == StartExternal) {
qq->breakHandler()->setAllPending();
m_gdbAdapter->attach();
if (m_gdbAdapter->isAdapter()) {
if (m_gdbAdapter->isTrkAdapter()) {
m_continuationAfterDone = true;
qq->notifyInferiorStopped();
attemptBreakpointSynchronization();
......
......@@ -54,15 +54,12 @@ class PlainGdbAdapter : public AbstractGdbAdapter
public:
PlainGdbAdapter(GdbEngine *engine, QObject *parent = 0);
//void kill() { m_gdbProc.kill(); }
//void terminate() { m_gdbProc.terminate(); }
QString errorString() const { return m_gdbProc.errorString(); }
QByteArray readAllStandardError() { return m_gdbProc.readAllStandardError(); }
QByteArray readAllStandardOutput() { return m_gdbProc.readAllStandardOutput(); }
qint64 write(const char *data) { return m_gdbProc.write(data); }
void setWorkingDirectory(const QString &dir) { m_gdbProc.setWorkingDirectory(dir); }
void setEnvironment(const QStringList &env) { m_gdbProc.setEnvironment(env); }
bool isAdapter() const { return false; }
bool isTrkAdapter() const { return false; }
void startAdapter(const DebuggerStartParametersPtr &sp);
void prepareInferior();
......
......@@ -52,13 +52,12 @@ class RemoteGdbAdapter : public AbstractGdbAdapter
public:
RemoteGdbAdapter(GdbEngine *engine, QObject *parent = 0);
QString errorString() const { return m_gdbProc.errorString(); }
QByteArray readAllStandardError() { return m_gdbProc.readAllStandardError(); }
QByteArray readAllStandardOutput() { return m_gdbProc.readAllStandardOutput(); }
qint64 write(const char *data) { return m_gdbProc.write(data); }
void setWorkingDirectory(const QString &dir) { m_gdbProc.setWorkingDirectory(dir); }
void setEnvironment(const QStringList &env) { m_gdbProc.setEnvironment(env); }
bool isAdapter() const { return false; }
bool isTrkAdapter() const { return false; }
void startAdapter(const DebuggerStartParametersPtr &sp);
void prepareInferior();
......
......@@ -1312,12 +1312,14 @@ void TrkGdbAdapter::interruptInferior()
void TrkGdbAdapter::handleGdbError(QProcess::ProcessError error)
{
logMessage(QString("GDB: Process Error %1: %2").arg(error).arg(errorString()));
logMessage(QString("GDB: Process Error %1: %2")
.arg(error).arg(m_gdbProc.errorString()));
}
void TrkGdbAdapter::handleGdbFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
logMessage(QString("GDB: ProcessFinished %1 %2").arg(exitCode).arg(exitStatus));
logMessage(QString("GDB: ProcessFinished %1 %2")
.arg(exitCode).arg(exitStatus));
//setState(AdapterNotRunning);
//emit adapterShutDown();
}
......@@ -1501,12 +1503,14 @@ void TrkGdbAdapter::handleRfcommReadyReadStandardOutput()
void TrkGdbAdapter::handleRfcommError(QProcess::ProcessError error)
{
logMessage(QString("RFCOMM: Process Error %1: %2").arg(error).arg(errorString()));
logMessage(QString("RFCOMM: Process Error %1: %2")
.arg(error).arg(m_rfcommProc.errorString()));
}
void TrkGdbAdapter::handleRfcommFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
logMessage(QString("RFCOMM: ProcessFinished %1 %2").arg(exitCode).arg(exitStatus));
logMessage(QString("RFCOMM: ProcessFinished %1 %2")
.arg(exitCode).arg(exitStatus));
}
void TrkGdbAdapter::handleRfcommStarted()
......@@ -1552,11 +1556,6 @@ bool TrkGdbAdapter::waitForFinished(int msecs)
}
*/
QString TrkGdbAdapter::errorString() const
{
return m_gdbProc.errorString();
}
QByteArray TrkGdbAdapter::readAllStandardError()
{
return m_gdbProc.readAllStandardError();
......
......@@ -109,13 +109,12 @@ public:
//
void start(const QString &program, const QStringList &args,
QIODevice::OpenMode mode = QIODevice::ReadWrite);
QString errorString() const;
QByteArray readAllStandardError();
QByteArray readAllStandardOutput();
qint64 write(const char *data);
void setWorkingDirectory(const QString &dir);
void setEnvironment(const QStringList &env);
bool isAdapter() const { return true; }
bool isTrkAdapter() const { return true; }
void startAdapter(const DebuggerStartParametersPtr &sp);
void prepareInferior();
......
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