diff options
author | David Schulz <david.schulz@qt.io> | 2023-02-24 09:25:15 +0100 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2023-02-27 11:09:40 +0000 |
commit | efe5735452cdf8c847f2b00105f4c962da3828a9 (patch) | |
tree | b73504ac67c127bf2f5205db27f2570c087f702d /src | |
parent | 4de07bf444797348d9acde457a36fe7bd11f8ea4 (diff) | |
download | qt-creator-efe5735452cdf8c847f2b00105f4c962da3828a9.tar.gz |
Debugger: optimize logging script messages
Avoid parsing the gdbmi output twice just for printing out messages to
the debugger log.
Change-Id: I928fc3a7d55c318056afff09cfbc25d115932bc0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/debugger/cdb/cdbengine.cpp | 16 | ||||
-rw-r--r-- | src/plugins/debugger/cdb/cdbengine.h | 1 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 253cf3f6e0..0ecdbf8d1a 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -1274,9 +1274,15 @@ void CdbEngine::showScriptMessages(const QString &message) const { GdbMi gdmiMessage; gdmiMessage.fromString(message); - if (!gdmiMessage.isValid()) + if (gdmiMessage.isValid()) + showScriptMessages(gdmiMessage); + else showMessage(message, LogMisc); - for (const GdbMi &msg : gdmiMessage["msg"]) { +} + +void CdbEngine::showScriptMessages(const GdbMi &message) const +{ + for (const GdbMi &msg : message["msg"]) { if (msg.name() == "bridgemessage") showMessage(msg["msg"].data(), LogMisc); else @@ -2085,11 +2091,11 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QString &what, c if (t == 'R') { response.resultClass = ResultDone; response.data.fromString(message); - if (!response.data.isValid()) { + if (response.data.isValid()) { + showScriptMessages(response.data); + } else { response.data.m_data = message; response.data.m_type = GdbMi::Tuple; - } else { - showScriptMessages(message); } } else { response.resultClass = ResultError; diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h index 2055183018..3bea692d5b 100644 --- a/src/plugins/debugger/cdb/cdbengine.h +++ b/src/plugins/debugger/cdb/cdbengine.h @@ -137,6 +137,7 @@ private: void postResolveSymbol(const QString &module, const QString &function, DisassemblerAgent *agent); void showScriptMessages(const QString &message) const; + void showScriptMessages(const GdbMi &message) const; void handleInitialSessionIdle(); // Builtin commands void handleStackTrace(const DebuggerResponse &); |