Commit 84dd8dd6 authored by Peter Kümmel's avatar Peter Kümmel Committed by hjk

gdb version string: ignore (...) content when using rubenvb's build

The often used rubenvb mingw-w64 build reports a GDB version string with
the GCC version in parentheses:
  GNU gdb (rubenvb-4.7.2-release) 7.5.50.20120920-cvs
With his patch the content within the parentheses is ignored, and is not
wrongly interpreted as GDB version.

Change-Id: I1a3c54acc81cb6d649d11ebf38dea96fc2685aa1
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 61681725
......@@ -392,12 +392,25 @@ void extractGdbVersion(const QString &msg,
{
const QChar dot(QLatin1Char('.'));
const bool ignoreParenthesisContent = msg.contains(QLatin1String("rubenvb"));
const QChar parOpen(QLatin1Char('('));
const QChar parClose(QLatin1Char(')'));
QString cleaned;
QString build;
bool inClean = true;
bool inParenthesis = false;
foreach (QChar c, msg) {
if (inClean && !cleaned.isEmpty() && c != dot && (c.isPunct() || c.isSpace()))
inClean = false;
if (ignoreParenthesisContent) {
if (!inParenthesis && c == parOpen)
inParenthesis = true;
if (inParenthesis && c == parClose)
inParenthesis = false;
if (inParenthesis)
continue;
}
if (inClean) {
if (c.isDigit())
cleaned.append(c);
......
......@@ -113,6 +113,10 @@ void tst_gdb::version_data()
QTest::newRow("QNX")
<< "GNU gdb (GDB) 7.3 qnx (rev. 613)"
<< 70300 << 613 << false << true;
QTest::newRow("rubenvb")
<< "GNU gdb (rubenvb-4.7.2-release) 7.5.50.20120920-cvs"
<< 70550 << 20120920 << false << false;
}
static QString chopConst(QString type)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment