Commit c717c1f9 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Debugger: Suppress inconsistencies in gdb binary settings.

caused by the merging of global settings.
Terminate list of binaries by an empty element to prevent
accidental reading of consecutive keys.
Add Linux-ICC to list of toolchains for gdb.

Acked-by: hjk
Reviewed-by: default avatarDaniel Molkentin <>
Task-number: QTCREATORBUG-2848
parent 387180b0
......@@ -101,14 +101,28 @@ void DebuggerSettings::readSettings(QSettings *settings)
const QString binary = tokens.front();
foreach(const QString &t, tokens)
m_gdbBinaryToolChainMap.insert(binary, t.toInt());
foreach(const QString &t, tokens) {
// Paranoia: Check if the there is already a binary configured for the toolchain.
const int toolChain = t.toInt();
const QString predefinedGdb = m_gdbBinaryToolChainMap.key(toolChain);
if (predefinedGdb.isEmpty()) {
m_gdbBinaryToolChainMap.insert(binary, toolChain);
} else {
const QString toolChainName = ProjectExplorer::ToolChain::toolChainName(static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChain));
const QString msg =
QString::fromLatin1("An inconsistency has been encountered in the Ini-file '%1':\n"
"Skipping gdb binary '%2' for toolchain '%3' as '%4' is already configured for it.").
arg(settings->fileName(), binary, toolChainName, predefinedGdb);
qWarning("%s", qPrintable(msg));
// Linux defaults
#ifdef Q_OS_UNIX
if (m_gdbBinaryToolChainMap.isEmpty()) {
const QString gdb = QLatin1String("gdb");
m_gdbBinaryToolChainMap.insert(gdb, ProjectExplorer::ToolChain::GCC);
m_gdbBinaryToolChainMap.insert(gdb, ProjectExplorer::ToolChain::LINUX_ICC);
m_gdbBinaryToolChainMap.insert(gdb, ProjectExplorer::ToolChain::OTHER);
m_gdbBinaryToolChainMap.insert(gdb, ProjectExplorer::ToolChain::UNKNOWN);
......@@ -133,6 +147,10 @@ void DebuggerSettings::writeSettings(QSettings *settings) const
settingsList.back().append(separator); // Append toolchain to last binary
// Terminate settings list by an empty element such that consecutive keys resulting
// from ini-file merging are suppressed while reading.
// Write out list
settings->remove(QString()); // remove all keys in group.
const int count = settingsList.size();
......@@ -68,6 +68,7 @@ static QList<int> allGdbToolChains()
#ifdef Q_OS_UNIX
<< ProjectExplorer::ToolChain::GCC
<< ProjectExplorer::ToolChain::LINUX_ICC
#ifdef Q_OS_WIN
<< ProjectExplorer::ToolChain::MinGW
......@@ -424,6 +425,7 @@ ToolChainSelectorWidget::ToolChainSelectorWidget(QWidget *parent) :
foreach(int tc, allGdbToolChains()) {
switch (tc) {
case ProjectExplorer::ToolChain::GCC:
case ProjectExplorer::ToolChain::LINUX_ICC:
case ProjectExplorer::ToolChain::MinGW:
case ProjectExplorer::ToolChain::OTHER:
case ProjectExplorer::ToolChain::UNKNOWN:
Supports Markdown
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