From 84dd8dd66903c9c221416f4b32a87a96a264a1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Tue, 4 Jun 2013 08:44:10 +0200 Subject: [PATCH] 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: hjk --- src/plugins/debugger/debuggerprotocol.cpp | 13 +++++++++++++ tests/auto/debugger/tst_gdb.cpp | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/plugins/debugger/debuggerprotocol.cpp b/src/plugins/debugger/debuggerprotocol.cpp index 53d787a9d70..c5c418a22e2 100644 --- a/src/plugins/debugger/debuggerprotocol.cpp +++ b/src/plugins/debugger/debuggerprotocol.cpp @@ -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); diff --git a/tests/auto/debugger/tst_gdb.cpp b/tests/auto/debugger/tst_gdb.cpp index fb44a01e48f..78f72cc3fa2 100644 --- a/tests/auto/debugger/tst_gdb.cpp +++ b/tests/auto/debugger/tst_gdb.cpp @@ -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)