forked from qt-creator/qt-creator
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:
@@ -1142,25 +1142,28 @@ void CdbEngine::runCommand(const DebuggerCommand &dbgCmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString fullCmd;
|
QString fullCmd;
|
||||||
StringInputStream str(fullCmd);
|
if (dbgCmd.flags == NoFlags) {
|
||||||
if (dbgCmd.flags & BuiltinCommand) {
|
fullCmd = cmd;
|
||||||
// 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) {
|
|
||||||
// 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;
|
|
||||||
if (dbgCmd.args.isString())
|
|
||||||
str << ' ' << dbgCmd.argsToString();
|
|
||||||
m_commandForToken.insert(token, dbgCmd);
|
|
||||||
} else {
|
} else {
|
||||||
str << cmd;
|
const int token = m_nextCommandToken++;
|
||||||
|
StringInputStream str(fullCmd);
|
||||||
|
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.
|
||||||
|
str << ".echo \"" << m_tokenPrefix << token << "<\"\n"
|
||||||
|
<< 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.
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
if (debug) {
|
if (debug) {
|
||||||
qDebug("CdbEngine::postCommand %dms '%s' %s, pending=%d",
|
qDebug("CdbEngine::postCommand %dms '%s' %s, pending=%d",
|
||||||
|
Reference in New Issue
Block a user