diff options
author | Orgad Shaneh <[email protected]> | 2014-09-11 22:22:51 +0300 |
---|---|---|
committer | hjk <[email protected]> | 2014-09-12 13:58:47 +0200 |
commit | ad957282c84d74919cf63565f44966b1c4b1157d (patch) | |
tree | 26403dd36b4f2d6d1ae26d88d7c12a549354cd2c /src/plugins/debugger | |
parent | 50ad2a4d99928a1cc8f1ac957ba734324a65b464 (diff) |
Debugger: Cleanup
Change-Id: Iaf7a3d69d920f8096763e2d8033df2d6371683a7
Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r-- | src/plugins/debugger/cdb/cdbengine.cpp | 9 | ||||
-rw-r--r-- | src/plugins/debugger/debuggeractions.cpp | 5 | ||||
-rw-r--r-- | src/plugins/debugger/debuggeractions.h | 4 | ||||
-rw-r--r-- | src/plugins/debugger/gdb/gdbengine.cpp | 19 |
4 files changed, 17 insertions, 20 deletions
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 421cd3387bc..56f278fb961 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -394,11 +394,10 @@ void CdbEngine::init() // Create local list of mappings in native separators m_sourcePathMappings.clear(); const QSharedPointer<GlobalDebuggerOptions> globalOptions = debuggerCore()->globalDebuggerOptions(); - if (!globalOptions->sourcePathMap.isEmpty()) { - typedef GlobalDebuggerOptions::SourcePathMap::const_iterator SourcePathMapIterator; - m_sourcePathMappings.reserve(globalOptions->sourcePathMap.size()); - const SourcePathMapIterator cend = globalOptions->sourcePathMap.constEnd(); - for (SourcePathMapIterator it = globalOptions->sourcePathMap.constBegin(); it != cend; ++it) { + SourcePathMap sourcePathMap = globalOptions->sourcePathMap; + if (!sourcePathMap.isEmpty()) { + m_sourcePathMappings.reserve(sourcePathMap.size()); + for (auto it = sourcePathMap.constBegin(), cend = sourcePathMap.constEnd(); it != cend; ++it) { m_sourcePathMappings.push_back(SourcePathMapping(QDir::toNativeSeparators(it.key()), QDir::toNativeSeparators(it.value()))); } diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 4c06e717658..d39f3117113 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -59,8 +59,9 @@ void GlobalDebuggerOptions::toSettings() const const QString sourcePathMappingSourceKey = QLatin1String(sourcePathMappingSourceKeyC); const QString sourcePathMappingTargetKey = QLatin1String(sourcePathMappingTargetKeyC); int i = 0; - const SourcePathMap::const_iterator cend = sourcePathMap.constEnd(); - for (SourcePathMap::const_iterator it = sourcePathMap.constBegin(); it != cend; ++it, ++i) { + for (auto it = sourcePathMap.constBegin(), cend = sourcePathMap.constEnd(); + it != cend; + ++it, ++i) { s->setArrayIndex(i); s->setValue(sourcePathMappingSourceKey, it.key()); s->setValue(sourcePathMappingTargetKey, it.value()); diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index 23156f7b52b..9a33116a36a 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -39,12 +39,12 @@ namespace Utils { class SavedAction; } namespace Debugger { namespace Internal { +typedef QMap<QString, QString> SourcePathMap; + // Global debugger options that are not stored as saved action. class GlobalDebuggerOptions { public: - typedef QMap<QString, QString> SourcePathMap; - void toSettings() const; void fromSettings(); bool operator==(const GlobalDebuggerOptions &rhs) const diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 07ec32a8a9c..a6cfb17e87e 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4106,13 +4106,12 @@ static QString gdbBinary(const DebuggerStartParameters &sp) return sp.debuggerCommand; } -static GlobalDebuggerOptions::SourcePathMap mergeStartParametersSourcePathMap( - const DebuggerStartParameters &sp, const GlobalDebuggerOptions::SourcePathMap &in) +static SourcePathMap mergeStartParametersSourcePathMap(const DebuggerStartParameters &sp, + const SourcePathMap &in) { // Do not overwrite user settings. - GlobalDebuggerOptions::SourcePathMap rc = sp.sourcePathMap; - QMap<QString, QString>::const_iterator end = in.end(); - for (QMap<QString, QString>::const_iterator it = in.begin(); it != end; ++it) + SourcePathMap rc = sp.sourcePathMap; + for (auto it = in.constBegin(), end = in.constEnd(); it != end; ++it) rc.insert(it.key(), it.value()); return rc; } @@ -4233,9 +4232,6 @@ void GdbEngine::startGdb(const QStringList &args) //postCommand("set remotecache on", ConsoleCommand); //postCommand("set non-stop on", ConsoleCommand); - typedef GlobalDebuggerOptions::SourcePathMap SourcePathMap; - typedef SourcePathMap::const_iterator SourcePathMapIterator; - showStatusMessage(tr("Setting up inferior...")); // Addint executable to modules list. @@ -4253,11 +4249,12 @@ void GdbEngine::startGdb(const QStringList &args) debuggerCore()->globalDebuggerOptions()->sourcePathMap); const SourcePathMap completeSourcePathMap = mergeStartParametersSourcePathMap(sp, sourcePathMap); - const SourcePathMapIterator cend = completeSourcePathMap.constEnd(); - SourcePathMapIterator it = completeSourcePathMap.constBegin(); - for ( ; it != cend; ++it) + for (auto it = completeSourcePathMap.constBegin(), cend = completeSourcePathMap.constEnd(); + it != cend; + ++it) { postCommand("set substitute-path " + it.key().toLocal8Bit() + " " + it.value().toLocal8Bit()); + } // Spaces just will not work. foreach (const QString &src, sp.debugSourceLocation) { |