forked from qt-creator/qt-creator
Cdb: Remove the command from the response.
It was just used for diagnostic messages. The commands can still be identified via the token in the messages. Change-Id: If1c6f9e66bd65d9d3a16cb403d297c83b0c52d0e Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
This commit is contained in:
@@ -215,17 +215,13 @@ public:
|
|||||||
: token(0)
|
: token(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CdbCommand(const QByteArray &cmd, int token, CdbEngine::CommandHandler h)
|
CdbCommand(int token, CdbEngine::CommandHandler h)
|
||||||
: token(token), handler(h)
|
: token(token), handler(h)
|
||||||
{
|
{}
|
||||||
response.command = cmd;
|
|
||||||
}
|
|
||||||
|
|
||||||
int token;
|
int token;
|
||||||
|
|
||||||
CdbEngine::CommandHandler handler;
|
CdbEngine::CommandHandler handler;
|
||||||
|
|
||||||
CdbResponse response; // FIXME: remove.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class CommandPtrType>
|
template <class CommandPtrType>
|
||||||
@@ -1212,7 +1208,7 @@ void CdbEngine::postBuiltinCommand(const QByteArray &cmd,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const int token = m_nextCommandToken++;
|
const int token = m_nextCommandToken++;
|
||||||
CdbCommandPtr pendingCommand(new CdbCommand(cmd, token, handler));
|
CdbCommandPtr pendingCommand(new CdbCommand(token, handler));
|
||||||
|
|
||||||
m_builtinCommandQueue.push_back(pendingCommand);
|
m_builtinCommandQueue.push_back(pendingCommand);
|
||||||
// Enclose command in echo-commands for token
|
// Enclose command in echo-commands for token
|
||||||
@@ -1252,7 +1248,7 @@ void CdbEngine::postExtensionCommand(const QByteArray &cmd,
|
|||||||
if (!arguments.isEmpty())
|
if (!arguments.isEmpty())
|
||||||
str << ' ' << arguments;
|
str << ' ' << arguments;
|
||||||
|
|
||||||
CdbCommandPtr pendingCommand(new CdbCommand(fullCmd, token, handler));
|
CdbCommandPtr pendingCommand(new CdbCommand(token, handler));
|
||||||
|
|
||||||
m_extensionCommandQueue.push_back(pendingCommand);
|
m_extensionCommandQueue.push_back(pendingCommand);
|
||||||
// Enclose command in echo-commands for token
|
// Enclose command in echo-commands for token
|
||||||
@@ -2286,19 +2282,21 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QByteArray &what
|
|||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
// Did the command finish? Take off queue and complete, invoke CB
|
// Did the command finish? Take off queue and complete, invoke CB
|
||||||
const CdbCommandPtr command = m_extensionCommandQueue.takeAt(index);
|
const CdbCommandPtr command = m_extensionCommandQueue.takeAt(index);
|
||||||
if (t == 'R') {
|
|
||||||
command->response.success = true;
|
|
||||||
command->response.reply = message;
|
|
||||||
} else {
|
|
||||||
command->response.success = false;
|
|
||||||
command->response.errorMessage = message;
|
|
||||||
}
|
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug("### Completed extension command '%s', token=%d, pending=%d",
|
qDebug("### Completed extension command for token=%d, pending=%d",
|
||||||
command->response.command.constData(), command->token, m_extensionCommandQueue.size());
|
command->token, m_extensionCommandQueue.size());
|
||||||
if (command->handler) {
|
|
||||||
command->handler(command->response);
|
if (!command->handler)
|
||||||
|
return;
|
||||||
|
CdbResponse response;
|
||||||
|
if (t == 'R') {
|
||||||
|
response.success = true;
|
||||||
|
response.reply = message;
|
||||||
|
} else {
|
||||||
|
response.success = false;
|
||||||
|
response.errorMessage = message;
|
||||||
}
|
}
|
||||||
|
command->handler(response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2456,22 +2454,24 @@ void CdbEngine::parseOutputLine(QByteArray line)
|
|||||||
if (isCommandToken) {
|
if (isCommandToken) {
|
||||||
// Did the command finish? Invoke callback and remove from queue.
|
// Did the command finish? Invoke callback and remove from queue.
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug("### Completed builtin command '%s', token=%d, %d lines, pending=%d",
|
qDebug("### Completed builtin command for token=%d, %d lines, pending=%d",
|
||||||
currentCommand->response.command.constData(), currentCommand->token,
|
currentCommand->token,
|
||||||
currentCommand->response.reply.count('\n'), m_builtinCommandQueue.size() - 1);
|
m_currentBuiltinCommandReply.count('\n'), m_builtinCommandQueue.size() - 1);
|
||||||
QTC_ASSERT(token == currentCommand->token, return; );
|
QTC_ASSERT(token == currentCommand->token, return; );
|
||||||
if (boolSetting(VerboseLog))
|
if (boolSetting(VerboseLog))
|
||||||
showMessage(QLatin1String(currentCommand->response.reply), LogMisc);
|
showMessage(QLatin1String(m_currentBuiltinCommandReply), LogMisc);
|
||||||
if (currentCommand->handler) {
|
CdbResponse response;
|
||||||
currentCommand->handler(currentCommand->response);
|
response.reply = m_currentBuiltinCommandReply;
|
||||||
}
|
if (currentCommand->handler)
|
||||||
|
currentCommand->handler(response);
|
||||||
m_builtinCommandQueue.removeAt(m_currentBuiltinCommandIndex);
|
m_builtinCommandQueue.removeAt(m_currentBuiltinCommandIndex);
|
||||||
m_currentBuiltinCommandIndex = -1;
|
m_currentBuiltinCommandIndex = -1;
|
||||||
|
m_currentBuiltinCommandReply.clear();
|
||||||
} else {
|
} else {
|
||||||
// Record output of current command
|
// Record output of current command
|
||||||
if (!currentCommand->response.reply.isEmpty())
|
if (!m_currentBuiltinCommandReply.isEmpty())
|
||||||
currentCommand->response.reply.push_back('\n');
|
m_currentBuiltinCommandReply.push_back('\n');
|
||||||
currentCommand->response.reply.push_back(line);
|
m_currentBuiltinCommandReply.push_back(line);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} // m_currentCommandIndex
|
} // m_currentCommandIndex
|
||||||
@@ -2482,8 +2482,7 @@ void CdbEngine::parseOutputLine(QByteArray line)
|
|||||||
m_currentBuiltinCommandIndex = index;
|
m_currentBuiltinCommandIndex = index;
|
||||||
const CdbCommandPtr ¤tCommand = m_builtinCommandQueue.at(m_currentBuiltinCommandIndex);
|
const CdbCommandPtr ¤tCommand = m_builtinCommandQueue.at(m_currentBuiltinCommandIndex);
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug("### Gathering output for '%s' token %d",
|
qDebug("### Gathering output for token %d", currentCommand->token);
|
||||||
currentCommand->response.command.constData(), currentCommand->token);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const char versionString[] = "Microsoft (R) Windows Debugger Version";
|
const char versionString[] = "Microsoft (R) Windows Debugger Version";
|
||||||
|
|||||||
@@ -249,6 +249,7 @@ private:
|
|||||||
int m_nextCommandToken;
|
int m_nextCommandToken;
|
||||||
QList<CdbCommandPtr> m_builtinCommandQueue;
|
QList<CdbCommandPtr> m_builtinCommandQueue;
|
||||||
int m_currentBuiltinCommandIndex; //!< Current command whose output is recorded.
|
int m_currentBuiltinCommandIndex; //!< Current command whose output is recorded.
|
||||||
|
QByteArray m_currentBuiltinCommandReply;
|
||||||
QList<CdbCommandPtr> m_extensionCommandQueue;
|
QList<CdbCommandPtr> m_extensionCommandQueue;
|
||||||
QMap<QString, NormalizedSourceFileName> m_normalizedFileCache;
|
QMap<QString, NormalizedSourceFileName> m_normalizedFileCache;
|
||||||
const QByteArray m_extensionCommandPrefixBA; //!< Library name used as prefix
|
const QByteArray m_extensionCommandPrefixBA; //!< Library name used as prefix
|
||||||
|
|||||||
Reference in New Issue
Block a user