forked from qt-creator/qt-creator
Debugger: Cleanup
Change-Id: Iaf7a3d69d920f8096763e2d8033df2d6371683a7 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -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())));
|
||||
}
|
||||
|
@@ -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());
|
||||
|
@@ -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
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user