Cdb: Unify posting commands to the cdb process.

Change-Id: I8e3bd400efa6fd12fd098a53d9e991aea658a743
Reviewed-by: hjk <hjk@theqtcompany.com>
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
This commit is contained in:
David Schulz
2015-08-12 15:35:58 +02:00
parent 90b0d561b6
commit d26fe608de

View File

@@ -1209,7 +1209,7 @@ void CdbEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages
postCommand(command.toLocal8Bit()); postCommand(command.toLocal8Bit());
} }
// Post command without callback // Post command to the cdb process
void CdbEngine::postCommand(const QByteArray &cmd) void CdbEngine::postCommand(const QByteArray &cmd)
{ {
if (debug) if (debug)
@@ -1232,8 +1232,6 @@ void CdbEngine::postBuiltinCommand(const QByteArray &cmd,
showMessage(msg, LogError); showMessage(msg, LogError);
return; return;
} }
showMessage(QString::fromLocal8Bit(cmd), LogInput);
const int token = m_nextCommandToken++; const int token = m_nextCommandToken++;
CdbCommandPtr pendingCommand(new CdbCommand(cmd, token, handler, nextCommandFlag)); CdbCommandPtr pendingCommand(new CdbCommand(cmd, token, handler, nextCommandFlag));
@@ -1242,7 +1240,7 @@ void CdbEngine::postBuiltinCommand(const QByteArray &cmd,
QByteArray fullCmd; QByteArray fullCmd;
ByteArrayInputStream str(fullCmd); ByteArrayInputStream str(fullCmd);
str << ".echo \"" << m_tokenPrefix << token << "<\"\n" str << ".echo \"" << m_tokenPrefix << token << "<\"\n"
<< cmd << "\n.echo \"" << m_tokenPrefix << token << ">\"\n"; << cmd << "\n.echo \"" << m_tokenPrefix << token << ">\"";
if (debug) if (debug)
qDebug("CdbEngine::postBuiltinCommand %dms '%s' token=%d %s next=%u, pending=%d, sequence=0x%x", qDebug("CdbEngine::postBuiltinCommand %dms '%s' token=%d %s next=%u, pending=%d, sequence=0x%x",
elapsedLogTime(), cmd.constData(), token, stateName(state()), nextCommandFlag, elapsedLogTime(), cmd.constData(), token, stateName(state()), nextCommandFlag,
@@ -1250,7 +1248,7 @@ void CdbEngine::postBuiltinCommand(const QByteArray &cmd,
if (debug > 1) if (debug > 1)
qDebug("CdbEngine::postBuiltinCommand: resulting command '%s'\n", qDebug("CdbEngine::postBuiltinCommand: resulting command '%s'\n",
fullCmd.constData()); fullCmd.constData());
m_process.write(fullCmd); postCommand(fullCmd);
} }
// Post an extension command producing one-line output with a callback, // Post an extension command producing one-line output with a callback,
@@ -1276,8 +1274,6 @@ void CdbEngine::postExtensionCommand(const QByteArray &cmd,
if (!arguments.isEmpty()) if (!arguments.isEmpty())
str << ' ' << arguments; str << ' ' << arguments;
showMessage(QString::fromLocal8Bit(fullCmd), LogInput);
CdbCommandPtr pendingCommand(new CdbCommand(fullCmd, token, handler, nextCommandFlag)); CdbCommandPtr pendingCommand(new CdbCommand(fullCmd, token, handler, nextCommandFlag));
m_extensionCommandQueue.push_back(pendingCommand); m_extensionCommandQueue.push_back(pendingCommand);
@@ -1286,7 +1282,7 @@ void CdbEngine::postExtensionCommand(const QByteArray &cmd,
qDebug("CdbEngine::postExtensionCommand %dms '%s' token=%d %s next=%u, pending=%d, sequence=0x%x", qDebug("CdbEngine::postExtensionCommand %dms '%s' token=%d %s next=%u, pending=%d, sequence=0x%x",
elapsedLogTime(), fullCmd.constData(), token, stateName(state()), nextCommandFlag, elapsedLogTime(), fullCmd.constData(), token, stateName(state()), nextCommandFlag,
m_extensionCommandQueue.size(), nextCommandFlag); m_extensionCommandQueue.size(), nextCommandFlag);
m_process.write(fullCmd + '\n'); postCommand(fullCmd);
} }
void CdbEngine::activateFrame(int index) void CdbEngine::activateFrame(int index)