Commit 60962303 authored by hjk's avatar hjk

Debugger: Use base DebuggerCommand also in PdbEngine

Change-Id: I92c2668353c05c00b1593439b55745d9b209a997
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent fae20871
......@@ -51,6 +51,9 @@ public:
DebuggerCommand(const char *f, int flags = 0, Callback cb = Callback())
: function(f), callback(cb), flags(flags)
{}
DebuggerCommand(const char *f, Callback cb)
: function(f), callback(cb), flags(0)
{}
DebuggerCommand(const QByteArray &f) : function(f), flags(0) {}
void arg(const char *name);
......
......@@ -123,13 +123,13 @@ void PdbEngine::postDirectCommand(const QByteArray &command)
void PdbEngine::postCommand(const QByteArray &command, DebuggerCommand::Callback callback)
{
QTC_ASSERT(m_pdbProc.state() == QProcess::Running, notifyEngineIll());
PdbCommand cmd;
cmd.command = command;
DebuggerCommand cmd;
cmd.function = command;
cmd.callback = callback;
m_commands.enqueue(cmd);
qDebug() << "ENQUEUE: " << command;
showMessage(_(cmd.command), LogInput);
m_pdbProc.write(cmd.command + '\n');
qDebug() << "ENQUEUE: " << cmd.function;
showMessage(_(cmd.function), LogInput);
m_pdbProc.write(cmd.function + '\n');
}
void PdbEngine::shutdownInferior()
......@@ -164,7 +164,7 @@ void PdbEngine::setupEngine()
this, &PdbEngine::handleOutput2, Qt::QueuedConnection);
// We will stop immediately, so setup a proper callback.
PdbCommand cmd;
DebuggerCommand cmd;
cmd.callback = CB(handleFirstCommand);
m_commands.enqueue(cmd);
......@@ -630,8 +630,8 @@ void PdbEngine::handleOutput2(const QByteArray &data)
response.logStreamOutput = data;
showMessage(_(data));
QTC_ASSERT(!m_commands.isEmpty(), qDebug() << "RESPONSE: " << data; return);
PdbCommand cmd = m_commands.dequeue();
qDebug() << "DEQUE: " << cmd.command;
DebuggerCommand cmd = m_commands.dequeue();
qDebug() << "DEQUE: " << cmd.function;
if (cmd.callback) {
//qDebug() << "EXECUTING CALLBACK " << cmd.callbackName
// << " RESPONSE: " << response.data;
......
......@@ -121,15 +121,6 @@ private:
void handleUpdateAll(const DebuggerResponse &response);
void handleFirstCommand(const DebuggerResponse &response);
void handleExecuteDebuggerCommand(const DebuggerResponse &response);
struct PdbCommand
{
PdbCommand() : callback(0) {}
DebuggerCommand::Callback callback;
QByteArray command;
};
void handleStop(const DebuggerResponse &response);
void handleBacktrace(const DebuggerResponse &response);
void handleListLocals(const DebuggerResponse &response);
......@@ -143,7 +134,7 @@ private:
DebuggerCommand::Callback callback = 0);
void postDirectCommand(const QByteArray &command);
QQueue<PdbCommand> m_commands;
QQueue<DebuggerCommand> m_commands;
QByteArray m_inbuffer;
QString m_scriptFileName;
......
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