Commit 677edc30 authored by Aurindam Jana's avatar Aurindam Jana
Browse files

Debugger: Add a field for source path map in DebuggerStartParameters



Change-Id: Ie79cdcd5c32a2204ac4b701c253d6d76bd271272
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
parent efb68b09
......@@ -431,6 +431,8 @@ void CdbEngine::init()
QDir::toNativeSeparators(it.value())));
}
}
// update source path maps from debugger start params
mergeStartParametersSourcePathMap();
QTC_ASSERT(m_process.state() != QProcess::Running, Utils::SynchronousProcess::stopProcess(m_process));
}
......@@ -2907,6 +2909,17 @@ unsigned CdbEngine::parseStackTrace(const GdbMi &data, bool sourceStepInto)
return 0;
}
void CdbEngine::mergeStartParametersSourcePathMap()
{
const DebuggerStartParameters &sp = startParameters();
QMap<QString, QString>::const_iterator end = sp.sourcePathMap.end();
for (QMap<QString, QString>::const_iterator it = sp.sourcePathMap.begin(); it != end; ++it) {
SourcePathMapping spm(QDir::toNativeSeparators(it.key()), QDir::toNativeSeparators(it.value()));
if (!m_sourcePathMappings.contains(spm))
m_sourcePathMappings.push_back(spm);
}
}
void CdbEngine::handleStackTrace(const CdbExtensionCommandPtr &command)
{
if (command->success) {
......
......@@ -243,6 +243,7 @@ private:
int elapsedLogTime() const;
void addLocalsOptions(ByteArrayInputStream &s) const;
unsigned parseStackTrace(const GdbMi &data, bool sourceStepInto);
void mergeStartParametersSourcePathMap();
const QByteArray m_creatorExtPrefix;
const QByteArray m_tokenPrefix;
......
......@@ -123,6 +123,7 @@ public:
QString localMountDir;
QSsh::SshConnectionParameters connParams;
bool remoteSetupNeeded;
QMap<QString, QString> sourcePathMap;
QString dumperLibrary;
QStringList solibSearchPath;
......
......@@ -4691,6 +4691,17 @@ static QString gdbBinary(const DebuggerStartParameters &sp)
return sp.debuggerCommand;
}
static GlobalDebuggerOptions::SourcePathMap mergeStartParametersSourcePathMap(
const DebuggerStartParameters &sp, const GlobalDebuggerOptions::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)
rc.insert(it.key(), it.value());
return rc;
}
//
// Starting up & shutting down
//
......@@ -4829,8 +4840,10 @@ void GdbEngine::startGdb(const QStringList &args)
const SourcePathMap sourcePathMap =
DebuggerSourcePathMappingWidget::mergePlatformQtPath(sp,
debuggerCore()->globalDebuggerOptions()->sourcePathMap);
const SourcePathMapIterator cend = sourcePathMap.constEnd();
SourcePathMapIterator it = sourcePathMap.constBegin();
const SourcePathMap completeSourcePathMap =
mergeStartParametersSourcePathMap(sp, sourcePathMap);
const SourcePathMapIterator cend = completeSourcePathMap.constEnd();
SourcePathMapIterator it = completeSourcePathMap.constBegin();
for ( ; it != cend; ++it)
postCommand("set substitute-path " + it.key().toLocal8Bit()
+ " " + it.value().toLocal8Bit());
......
Markdown is supported
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