forked from qt-creator/qt-creator
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 <hjk121@nokiamail.com>
This commit is contained in:
@@ -392,12 +392,25 @@ void extractGdbVersion(const QString &msg,
|
|||||||
{
|
{
|
||||||
const QChar dot(QLatin1Char('.'));
|
const QChar dot(QLatin1Char('.'));
|
||||||
|
|
||||||
|
const bool ignoreParenthesisContent = msg.contains(QLatin1String("rubenvb"));
|
||||||
|
const QChar parOpen(QLatin1Char('('));
|
||||||
|
const QChar parClose(QLatin1Char(')'));
|
||||||
|
|
||||||
QString cleaned;
|
QString cleaned;
|
||||||
QString build;
|
QString build;
|
||||||
bool inClean = true;
|
bool inClean = true;
|
||||||
|
bool inParenthesis = false;
|
||||||
foreach (QChar c, msg) {
|
foreach (QChar c, msg) {
|
||||||
if (inClean && !cleaned.isEmpty() && c != dot && (c.isPunct() || c.isSpace()))
|
if (inClean && !cleaned.isEmpty() && c != dot && (c.isPunct() || c.isSpace()))
|
||||||
inClean = false;
|
inClean = false;
|
||||||
|
if (ignoreParenthesisContent) {
|
||||||
|
if (!inParenthesis && c == parOpen)
|
||||||
|
inParenthesis = true;
|
||||||
|
if (inParenthesis && c == parClose)
|
||||||
|
inParenthesis = false;
|
||||||
|
if (inParenthesis)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (inClean) {
|
if (inClean) {
|
||||||
if (c.isDigit())
|
if (c.isDigit())
|
||||||
cleaned.append(c);
|
cleaned.append(c);
|
||||||
|
@@ -113,6 +113,10 @@ void tst_gdb::version_data()
|
|||||||
QTest::newRow("QNX")
|
QTest::newRow("QNX")
|
||||||
<< "GNU gdb (GDB) 7.3 qnx (rev. 613)"
|
<< "GNU gdb (GDB) 7.3 qnx (rev. 613)"
|
||||||
<< 70300 << 613 << false << true;
|
<< 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)
|
static QString chopConst(QString type)
|
||||||
|
Reference in New Issue
Block a user