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