Filter leading GDB messages during version detection

When using GDB through a script, additional messages can be printed
before the line reporting the version number, and some digits of those
messages could be interpreted as a version value, leading to wrong
version detection.

This patch searches for the "GNU gdb" tag first, so the correct
line is evaluated.

Change-Id: Ief64a056a20a963ad01c44941777361abcce00fc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Antonio Di Monaco
2019-07-10 09:20:40 +02:00
parent 545b0537ae
commit a10a35d9eb

View File

@@ -457,7 +457,13 @@ void extractGdbVersion(const QString &msg,
QString build;
bool inClean = true;
bool inParenthesis = false;
for (QChar c : msg) {
int gdbMsgBegin = msg.indexOf("GNU gdb");
if (gdbMsgBegin == -1)
gdbMsgBegin = 0;
for (int i = gdbMsgBegin, gdbMsgSize = msg.size(); i < gdbMsgSize; ++i) {
QChar c = msg.at(i);
if (inClean && !cleaned.isEmpty() && c != dot && (c.isPunct() || c.isSpace()))
inClean = false;
if (ignoreParenthesisContent) {