Commit 7195c6b5 authored by hjk's avatar hjk

debugger: re-do state transitions in combined C++/Qml engine

This still needs a lot of work and sanitizing.
parent adf74394
......@@ -114,9 +114,12 @@ enum DebuggerState
InferiorSetupRequested,
InferiorSetupFailed,
InferiorSetupOk,
EngineRunRequested,
EngineRunFailed,
EngineRunOk,
InferiorUnrunnable, // Used in the core dump adapter
InferiorRunRequested, // Debuggee requested to run
......@@ -124,16 +127,19 @@ enum DebuggerState
InferiorRunFailed, // Debuggee running
InferiorStopRequested, // Debuggee running, stop requested
InferiorStopSpontaneous, // Debuggee stopped spontaneously
InferiorStopOk, // Debuggee stopped
InferiorStopFailed, // Debuggee not stopped, will kill debugger
InferiorExitOk,
InferiorShutdownRequested,
InferiorShutdownOk,
InferiorShutdownFailed,
InferiorShutdownOk,
EngineShutdownRequested,
EngineShutdownOk,
EngineShutdownFailed,
EngineShutdownOk,
DebuggerFinished
};
......
This diff is collapsed.
......@@ -241,6 +241,7 @@ public:
virtual void updateViews();
bool isSlaveEngine() const;
bool isMasterEngine() const;
DebuggerEngine *masterEngine() const;
signals:
......@@ -320,7 +321,7 @@ protected:
virtual void frameUp();
virtual void frameDown();
DebuggerRunControl *runControl() const; // FIXME: Protect.
DebuggerRunControl *runControl() const;
static QString msgWatchpointTriggered(BreakpointId id,
int number, quint64 address);
......@@ -338,12 +339,18 @@ protected:
static bool isCppBreakpoint(const Internal::BreakpointParameters &p);
bool isStateDebugging() const;
void setStateDebugging(bool on);
private:
// Wrapper engine needs access to state of its subengines.
friend class Internal::QmlCppEngine;
friend class Internal::DebuggerPluginPrivate;
void setState(DebuggerState state, bool forced = false);
virtual void setState(DebuggerState state, bool forced = false);
virtual void setSilentState(DebuggerState state);
virtual void slaveEngineStateChanged(DebuggerEngine *engine,
DebuggerState state);
friend class DebuggerEnginePrivate;
DebuggerEnginePrivate *d;
......
......@@ -141,7 +141,10 @@ static bool stateAcceptsGdbCommands(DebuggerState state)
return true;
case DebuggerNotReady:
case InferiorStopFailed:
case InferiorStopSpontaneous:
case InferiorSetupOk:
case EngineRunFailed:
case EngineRunOk:
case InferiorRunFailed:
case EngineShutdownOk:
case EngineShutdownFailed:
......
This diff is collapsed.
......@@ -16,86 +16,83 @@ class DEBUGGER_EXPORT QmlCppEngine : public DebuggerEngine
public:
explicit QmlCppEngine(const DebuggerStartParameters &sp);
virtual ~QmlCppEngine();
~QmlCppEngine();
virtual void setToolTipExpression(const QPoint &mousePos,
void setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor * editor, int cursorPos);
virtual void updateWatchData(const WatchData &data,
void updateWatchData(const WatchData &data,
const WatchUpdateFlags &flags);
virtual void watchPoint(const QPoint &);
virtual void fetchMemory(MemoryAgent *, QObject *,
quint64 addr, quint64 length);
virtual void fetchDisassembler(DisassemblerAgent *);
virtual void activateFrame(int index);
void watchPoint(const QPoint &);
void fetchMemory(MemoryAgent *, QObject *, quint64 addr, quint64 length);
void fetchDisassembler(DisassemblerAgent *);
void activateFrame(int index);
virtual void reloadModules();
virtual void examineModules();
virtual void loadSymbols(const QString &moduleName);
virtual void loadAllSymbols();
virtual void requestModuleSymbols(const QString &moduleName);
void reloadModules();
void examineModules();
void loadSymbols(const QString &moduleName);
void loadAllSymbols();
void requestModuleSymbols(const QString &moduleName);
virtual void reloadRegisters();
virtual void reloadSourceFiles();
virtual void reloadFullStack();
void reloadRegisters();
void reloadSourceFiles();
void reloadFullStack();
virtual void setRegisterValue(int regnr, const QString &value);
virtual unsigned debuggerCapabilities() const;
void setRegisterValue(int regnr, const QString &value);
unsigned debuggerCapabilities() const;
virtual bool isSynchronous() const;
virtual QByteArray qtNamespace() const;
bool isSynchronous() const;
QByteArray qtNamespace() const;
virtual void createSnapshot();
virtual void updateAll();
void createSnapshot();
void updateAll();
virtual void attemptBreakpointSynchronization();
virtual bool acceptsBreakpoint(BreakpointId id) const;
virtual void selectThread(int index);
void attemptBreakpointSynchronization();
bool acceptsBreakpoint(BreakpointId id) const;
void selectThread(int index);
virtual void assignValueInDebugger(const WatchData *data,
void assignValueInDebugger(const WatchData *data,
const QString &expr, const QVariant &value);
DebuggerEngine *cppEngine() const;
virtual void handleRemoteSetupDone(int gdbServerPort, int qmlPort);
virtual void handleRemoteSetupFailed(const QString &message);
void handleRemoteSetupDone(int gdbServerPort, int qmlPort);
void handleRemoteSetupFailed(const QString &message);
protected:
virtual void detachDebugger();
virtual void executeStep();
virtual void executeStepOut();
virtual void executeNext();
virtual void executeStepI();
virtual void executeNextI();
virtual void executeReturn();
virtual void continueInferior();
virtual void interruptInferior();
virtual void requestInterruptInferior();
virtual void executeRunToLine(const QString &fileName, int lineNumber);
virtual void executeRunToFunction(const QString &functionName);
virtual void executeJumpToLine(const QString &fileName, int lineNumber);
virtual void executeDebuggerCommand(const QString &command);
virtual void frameUp();
virtual void frameDown();
virtual void notifyInferiorRunOk();
protected:
virtual void setupEngine();
virtual void setupInferior();
virtual void runEngine();
virtual void shutdownInferior();
virtual void shutdownEngine();
private slots:
void slaveEngineStateChanged(DebuggerState state);
void setupSlaveEngine();
void detachDebugger();
void executeStep();
void executeStepOut();
void executeNext();
void executeStepI();
void executeNextI();
void executeReturn();
void continueInferior();
void interruptInferior();
void requestInterruptInferior();
void executeRunToLine(const QString &fileName, int lineNumber);
void executeRunToFunction(const QString &functionName);
void executeJumpToLine(const QString &fileName, int lineNumber);
void executeDebuggerCommand(const QString &command);
void frameUp();
void frameDown();
void setupEngine();
void setupInferior();
void runEngine();
void shutdownInferior();
void shutdownEngine();
void notifyInferiorRunOk();
void notifyInferiorSpontaneousStop();
void notifyEngineRunAndInferiorRunOk();
void notifyInferiorShutdownOk();
private:
void initEngineShutdown();
bool checkErrorState(DebuggerState stateToCheck);
void engineStateChanged(DebuggerState newState);
void setState(DebuggerState newState, bool forced = false);
void slaveEngineStateChanged(DebuggerEngine *slaveEngine, DebuggerState state);
private:
QScopedPointer<QmlCppEnginePrivate> d;
......
......@@ -208,7 +208,7 @@ void QmlEngine::setupInferior()
connect(&d->m_applicationLauncher,
SIGNAL(bringToForegroundRequested(qint64)),
runControl(),
SLOT(bringApplicationToForeground(qint64)));
SLOT(bringApplicationToForeground(qint64)));
d->m_applicationLauncher.setEnvironment(startParameters().environment);
d->m_applicationLauncher.setWorkingDirectory(startParameters().workingDirectory);
......@@ -675,7 +675,8 @@ void QmlEngine::messageReceived(const QByteArray &message)
stream >> command;
if (command == "STOPPED") {
if (state() == InferiorRunOk)
qDebug() << command << this << state();
if (state() == InferiorRunOk || state() == EngineRunOk)
notifyInferiorSpontaneousStop();
QString logString = QString(command);
......
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