forked from qt-creator/qt-creator
LD: Improve parsing of linker error messages
Task-number: QTCREATORBUG-3107 Change-Id: Idc6a815d32b410e747a1a0e944a01cd34b087a87 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -669,7 +669,16 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
|
|||||||
QLatin1String("file.h"), 21,
|
QLatin1String("file.h"), 21,
|
||||||
Constants::TASK_CATEGORY_COMPILE))
|
Constants::TASK_CATEGORY_COMPILE))
|
||||||
<< QString();
|
<< QString();
|
||||||
|
QTest::newRow("linker error") // QTCREATORBUG-3107
|
||||||
|
<< QString::fromLatin1("cns5k_ins_parser_tests.cpp:(.text._ZN20CNS5kINSParserEngine21DropBytesUntilStartedEP14CircularBufferIhE[CNS5kINSParserEngine::DropBytesUntilStarted(CircularBuffer<unsigned char>*)]+0x6d): undefined reference to `CNS5kINSPacket::SOH_BYTE'")
|
||||||
|
<< OutputParserTester::STDERR
|
||||||
|
<< QString() << QString()
|
||||||
|
<< ( QList<ProjectExplorer::Task>()
|
||||||
|
<< Task(Task::Error,
|
||||||
|
QLatin1String("undefined reference to `CNS5kINSPacket::SOH_BYTE'"),
|
||||||
|
QLatin1String("cns5k_ins_parser_tests.cpp"), -1,
|
||||||
|
Constants::TASK_CATEGORY_COMPILE))
|
||||||
|
<< QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::testGccOutputParsers()
|
void ProjectExplorerPlugin::testGccOutputParsers()
|
||||||
|
|||||||
@@ -39,8 +39,9 @@ using namespace ProjectExplorer;
|
|||||||
namespace {
|
namespace {
|
||||||
// opt. drive letter + filename: (2 brackets)
|
// opt. drive letter + filename: (2 brackets)
|
||||||
const char * const FILE_PATTERN = "(([A-Za-z]:)?[^:]+\\.[^:]+):";
|
const char * const FILE_PATTERN = "(([A-Za-z]:)?[^:]+\\.[^:]+):";
|
||||||
// line no. or elf segment + offset: (1 bracket)
|
// line no. or elf segment + offset (1 bracket)
|
||||||
const char * const POSITION_PATTERN = "(\\d+|\\(\\.[a-zA-Z0-9]*.0x[a-fA-F0-9]+\\)):";
|
// const char * const POSITION_PATTERN = "(\\d+|\\(\\.[^:]+[+-]0x[a-fA-F0-9]+\\):)";
|
||||||
|
const char * const POSITION_PATTERN = "(\\d|\\(\\..+[+-]0x[a-fA-F0-9]+\\):)";
|
||||||
const char * const COMMAND_PATTERN = "^(.*[\\\\/])?([a-z0-9]+-[a-z0-9]+-[a-z0-9]+-)?(ld|gold)(-[0-9\\.]+)?(\\.exe)?: ";
|
const char * const COMMAND_PATTERN = "^(.*[\\\\/])?([a-z0-9]+-[a-z0-9]+-[a-z0-9]+-)?(ld|gold)(-[0-9\\.]+)?(\\.exe)?: ";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,9 +56,6 @@ LdParser::LdParser()
|
|||||||
|
|
||||||
m_regExpGccNames.setPattern(COMMAND_PATTERN);
|
m_regExpGccNames.setPattern(COMMAND_PATTERN);
|
||||||
m_regExpGccNames.setMinimal(true);
|
m_regExpGccNames.setMinimal(true);
|
||||||
|
|
||||||
m_regExpInFunction.setPattern("^In (static |member )*function ");
|
|
||||||
m_regExpInFunction.setMinimal(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LdParser::stdError(const QString &line)
|
void LdParser::stdError(const QString &line)
|
||||||
@@ -98,13 +96,12 @@ void LdParser::stdError(const QString &line)
|
|||||||
lineno = -1;
|
lineno = -1;
|
||||||
QString filename = m_regExpLinker.cap(1);
|
QString filename = m_regExpLinker.cap(1);
|
||||||
if (!m_regExpLinker.cap(4).isEmpty()
|
if (!m_regExpLinker.cap(4).isEmpty()
|
||||||
&& !m_regExpLinker.cap(4).startsWith(QLatin1String("(.text+0x")))
|
&& !m_regExpLinker.cap(4).startsWith(QLatin1String("(.text")))
|
||||||
filename = m_regExpLinker.cap(4);
|
filename = m_regExpLinker.cap(4);
|
||||||
QString description = m_regExpLinker.cap(8).trimmed();
|
QString description = m_regExpLinker.cap(8).trimmed();
|
||||||
Task task(Task::Error, description, filename, lineno,
|
Task task(Task::Error, description, filename, lineno,
|
||||||
Constants::TASK_CATEGORY_COMPILE);
|
Constants::TASK_CATEGORY_COMPILE);
|
||||||
if (m_regExpInFunction.indexIn(description) > -1 ||
|
if (description.startsWith(QLatin1String("At global scope")) ||
|
||||||
description.startsWith(QLatin1String("At global scope")) ||
|
|
||||||
description.startsWith(QLatin1String("At top level")) ||
|
description.startsWith(QLatin1String("At top level")) ||
|
||||||
description.startsWith(QLatin1String("instantiated from ")) ||
|
description.startsWith(QLatin1String("instantiated from ")) ||
|
||||||
description.startsWith(QLatin1String("In ")))
|
description.startsWith(QLatin1String("In ")))
|
||||||
@@ -113,5 +110,6 @@ void LdParser::stdError(const QString &line)
|
|||||||
emit addTask(task);
|
emit addTask(task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::stdError(line);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
QRegExp m_regExpLinker;
|
QRegExp m_regExpLinker;
|
||||||
QRegExp m_regExpGccNames;
|
QRegExp m_regExpGccNames;
|
||||||
QRegExp m_regExpInFunction;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|||||||
Reference in New Issue
Block a user