From 60962303d1ff8d30dfb31cf86e2df009ed402155 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 13 Feb 2015 12:03:30 +0100 Subject: [PATCH] Debugger: Use base DebuggerCommand also in PdbEngine Change-Id: I92c2668353c05c00b1593439b55745d9b209a997 Reviewed-by: Christian Stenger --- src/plugins/debugger/debuggerprotocol.h | 3 +++ src/plugins/debugger/pdb/pdbengine.cpp | 16 ++++++++-------- src/plugins/debugger/pdb/pdbengine.h | 11 +---------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/plugins/debugger/debuggerprotocol.h b/src/plugins/debugger/debuggerprotocol.h index 943fe8b4424..5b12fcc6a0b 100644 --- a/src/plugins/debugger/debuggerprotocol.h +++ b/src/plugins/debugger/debuggerprotocol.h @@ -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); diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp index 6066d0ccd03..0365782849d 100644 --- a/src/plugins/debugger/pdb/pdbengine.cpp +++ b/src/plugins/debugger/pdb/pdbengine.cpp @@ -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; diff --git a/src/plugins/debugger/pdb/pdbengine.h b/src/plugins/debugger/pdb/pdbengine.h index c0309399222..b434cca6d38 100644 --- a/src/plugins/debugger/pdb/pdbengine.h +++ b/src/plugins/debugger/pdb/pdbengine.h @@ -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 m_commands; + QQueue m_commands; QByteArray m_inbuffer; QString m_scriptFileName;