Commit d9cf3a87 authored by hjk's avatar hjk

debugger: more trk/gdbengine refactoring

parent 0915342d
......@@ -271,14 +271,14 @@ public:
QLabel *statusLabel() const { return m_statusLabel; }
IDebuggerEngine *currentEngine() const { return m_engine; }
virtual QSharedPointer<DebuggerStartParameters> startParameters() const;
virtual qint64 inferiorPid() const;
public slots:
void startNewDebugger(DebuggerRunControl *runControl,
const QSharedPointer<DebuggerStartParameters> &startParameters);
void exitDebugger();
virtual QSharedPointer<DebuggerStartParameters> startParameters() const;
virtual qint64 inferiorPid() const;
void setQtDumperLibraryName(const QString &dl); // Run Control
void setQtDumperLibraryLocations(const QStringList &dl);
......@@ -397,6 +397,7 @@ public:
// one of the interfaces
QAbstractItemModel *threadsModel();
int status() const { return m_status; }
// FIXME: hide this in the engines?
DebuggerStartMode startMode() const;
DebuggerRunControl *runControl() const { return m_runControl; }
......
......@@ -50,6 +50,7 @@ class AbstractGdbAdapter : public QObject
public:
AbstractGdbAdapter(QObject *parent = 0) : QObject(parent) {}
virtual void setEngine(GdbEngine *engine) { m_engine = engine; }
virtual void start(const QString &program, const QStringList &args,
QIODevice::OpenMode mode = QIODevice::ReadWrite) = 0;
virtual void kill() = 0;
......@@ -65,7 +66,8 @@ public:
virtual void setEnvironment(const QStringList &env) = 0;
virtual bool isAdapter() const = 0;
virtual void attach(GdbEngine *engine) const = 0;
virtual void attach() = 0;
virtual void interruptInferior() = 0;
signals:
void error(QProcess::ProcessError);
......@@ -73,6 +75,9 @@ signals:
void readyReadStandardOutput();
void readyReadStandardError();
void finished(int, QProcess::ExitStatus);
protected:
GdbEngine *m_engine;
};
} // namespace Internal
......
This diff is collapsed.
......@@ -107,7 +107,8 @@ public:
void setWorkingDirectory(const QString &dir) { m_proc.setWorkingDirectory(dir); }
void setEnvironment(const QStringList &env) { m_proc.setEnvironment(env); }
bool isAdapter() const { return false; }
void attach(GdbEngine *engine) const;
void attach();
void interruptInferior();
private:
QProcess m_proc;
......@@ -289,6 +290,15 @@ private:
void debugMessage(const QString &msg);
bool showToolTip();
// Convenience
DebuggerManager *manager() { return m_manager; }
void showStatusMessage(const QString &msg, int timeout = -1)
{ m_manager->showStatusMessage(msg, timeout); }
int status() const { return m_manager->status(); }
QMainWindow *mainWindow() const { return m_manager->mainWindow(); }
DebuggerStartMode startMode() const { return m_manager->startMode(); }
qint64 inferiorPid() const { return m_manager->inferiorPid(); }
void handleChildren(const WatchData &parent, const GdbMi &child,
QList<WatchData> *insertions);
const bool m_dumperInjectionLoad;
......@@ -441,7 +451,7 @@ private:
QList<GdbCommand> m_commandsToRunOnTemporaryBreak;
DebuggerManager * const q;
DebuggerManager * const m_manager;
IDebuggerManagerAccessForEngines * const qq;
DebuggerStartParameters m_startParameters;
// make sure to re-initialize new members in initializeVariables();
......
......@@ -1416,16 +1416,16 @@ void TrkGdbAdapter::setEnvironment(const QStringList &env)
m_gdbProc.setEnvironment(env);
}
void TrkGdbAdapter::attach(GdbEngine *engine) const
void TrkGdbAdapter::attach()
{
#ifdef STANDALONE_RUNNER
#else
QString fileName = engine->startParameters().executable;
engine->postCommand(_("add-symbol-file \"%1\" %2").arg(fileName)
QString fileName = m_engine->startParameters().executable;
m_engine->postCommand(_("add-symbol-file \"%1\" %2").arg(fileName)
.arg(m_session.codeseg));
engine->postCommand(_("symbol-file \"%1\"").arg(fileName));
engine->postCommand(_("target remote ") + gdbServerName());
engine->attemptBreakpointSynchronization();
m_engine->postCommand(_("symbol-file \"%1\"").arg(fileName));
m_engine->postCommand(_("target remote ") + gdbServerName());
m_engine->attemptBreakpointSynchronization();
#endif
}
......
......@@ -132,7 +132,8 @@ public:
void setWorkingDirectory(const QString &dir);
void setEnvironment(const QStringList &env);
bool isAdapter() const { return true; }
void attach(GdbEngine *engine) const;
void attach();
void interruptInferior();
//
// TRK
......@@ -177,7 +178,6 @@ public:
void reportToGdb(const TrkResult &result);
void readMemory(uint addr, uint len);
void interruptInferior();
trk::TrkDevice m_trkDevice;
......
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