Cdb: Improve command logging

For easier copy pasting comands from the log.

Change-Id: I60e2737540d403454cd36f42e7b1ac3cf203df07
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2016-09-27 14:07:04 +02:00
parent ed12120bf2
commit 530be10612

View File

@@ -1142,25 +1142,28 @@ void CdbEngine::runCommand(const DebuggerCommand &dbgCmd)
}
QString fullCmd;
if (dbgCmd.flags == NoFlags) {
fullCmd = cmd;
} else {
const int token = m_nextCommandToken++;
StringInputStream str(fullCmd);
if (dbgCmd.flags & BuiltinCommand) {
if (dbgCmd.flags == BuiltinCommand) {
// Post a built-in-command producing free-format output with a callback.
// In order to catch the output, it is enclosed in 'echo' commands
// printing a specially formatted token to be identifiable in the output.
const int token = m_nextCommandToken++;
str << ".echo \"" << m_tokenPrefix << token << "<\"\n"
<< cmd << "\n.echo \"" << m_tokenPrefix << token << ">\"";
m_commandForToken.insert(token, dbgCmd);
} else if (dbgCmd.flags & ExtensionCommand) {
<< cmd << "\n"
<< ".echo \"" << m_tokenPrefix << token << ">\"";
} else if (dbgCmd.flags == ExtensionCommand) {
// Post an extension command producing one-line output with a callback,
// pass along token for identification in hash.
const int token = m_nextCommandToken++;
str << m_extensionCommandPrefix << dbgCmd.function << " -t " << token;
str << m_extensionCommandPrefix << dbgCmd.function << "%1%2";
if (dbgCmd.args.isString())
str << ' ' << dbgCmd.argsToString();
cmd = fullCmd.arg("", "");
fullCmd = fullCmd.arg(" -t ").arg(token);
}
m_commandForToken.insert(token, dbgCmd);
} else {
str << cmd;
}
if (debug) {
qDebug("CdbEngine::postCommand %dms '%s' %s, pending=%d",