diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 840d640430f..db278945c68 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -1843,21 +1843,21 @@ void DebuggerEngine::validateExecutable(DebuggerStartParameters *sp) if (QSharedPointer mapper = reader.readSection(".debug_str")) { const char *str = mapper->start; const char *limit = str + mapper->fdlen; + bool found = false; while (str < limit) { - QString string = QString::fromUtf8(str); - auto itExp = globalRegExpSourceMap.begin(); - auto itEnd = globalRegExpSourceMap.end(); - while (itExp != itEnd) { + const QString string = QString::fromUtf8(str); + for (auto itExp = globalRegExpSourceMap.begin(), itEnd = globalRegExpSourceMap.end(); + itExp != itEnd; + ++itExp) { QRegExp exp = itExp->first; int index = exp.indexIn(string); if (index != -1) { sp->sourcePathMap.insert(string.left(index) + exp.cap(1), itExp->second); - itExp = globalRegExpSourceMap.erase(itExp); - } else { - ++itExp; + found = true; + break; } } - if (globalRegExpSourceMap.isEmpty()) + if (found) break; const int len = strlen(str);