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
|
// Create local list of mappings in native separators
|
||||||
m_sourcePathMappings.clear();
|
m_sourcePathMappings.clear();
|
||||||
const QSharedPointer<GlobalDebuggerOptions> globalOptions = debuggerCore()->globalDebuggerOptions();
|
const QSharedPointer<GlobalDebuggerOptions> globalOptions = debuggerCore()->globalDebuggerOptions();
|
||||||
if (!globalOptions->sourcePathMap.isEmpty()) {
|
SourcePathMap sourcePathMap = globalOptions->sourcePathMap;
|
||||||
typedef GlobalDebuggerOptions::SourcePathMap::const_iterator SourcePathMapIterator;
|
if (!sourcePathMap.isEmpty()) {
|
||||||
m_sourcePathMappings.reserve(globalOptions->sourcePathMap.size());
|
m_sourcePathMappings.reserve(sourcePathMap.size());
|
||||||
const SourcePathMapIterator cend = globalOptions->sourcePathMap.constEnd();
|
for (auto it = sourcePathMap.constBegin(), cend = sourcePathMap.constEnd(); it != cend; ++it) {
|
||||||
for (SourcePathMapIterator it = globalOptions->sourcePathMap.constBegin(); it != cend; ++it) {
|
|
||||||
m_sourcePathMappings.push_back(SourcePathMapping(QDir::toNativeSeparators(it.key()),
|
m_sourcePathMappings.push_back(SourcePathMapping(QDir::toNativeSeparators(it.key()),
|
||||||
QDir::toNativeSeparators(it.value())));
|
QDir::toNativeSeparators(it.value())));
|
||||||
}
|
}
|
||||||
|
@@ -59,8 +59,9 @@ void GlobalDebuggerOptions::toSettings() const
|
|||||||
const QString sourcePathMappingSourceKey = QLatin1String(sourcePathMappingSourceKeyC);
|
const QString sourcePathMappingSourceKey = QLatin1String(sourcePathMappingSourceKeyC);
|
||||||
const QString sourcePathMappingTargetKey = QLatin1String(sourcePathMappingTargetKeyC);
|
const QString sourcePathMappingTargetKey = QLatin1String(sourcePathMappingTargetKeyC);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
const SourcePathMap::const_iterator cend = sourcePathMap.constEnd();
|
for (auto it = sourcePathMap.constBegin(), cend = sourcePathMap.constEnd();
|
||||||
for (SourcePathMap::const_iterator it = sourcePathMap.constBegin(); it != cend; ++it, ++i) {
|
it != cend;
|
||||||
|
++it, ++i) {
|
||||||
s->setArrayIndex(i);
|
s->setArrayIndex(i);
|
||||||
s->setValue(sourcePathMappingSourceKey, it.key());
|
s->setValue(sourcePathMappingSourceKey, it.key());
|
||||||
s->setValue(sourcePathMappingTargetKey, it.value());
|
s->setValue(sourcePathMappingTargetKey, it.value());
|
||||||
|
@@ -39,12 +39,12 @@ namespace Utils { class SavedAction; }
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
typedef QMap<QString, QString> SourcePathMap;
|
||||||
|
|
||||||
// Global debugger options that are not stored as saved action.
|
// Global debugger options that are not stored as saved action.
|
||||||
class GlobalDebuggerOptions
|
class GlobalDebuggerOptions
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef QMap<QString, QString> SourcePathMap;
|
|
||||||
|
|
||||||
void toSettings() const;
|
void toSettings() const;
|
||||||
void fromSettings();
|
void fromSettings();
|
||||||
bool operator==(const GlobalDebuggerOptions &rhs) const
|
bool operator==(const GlobalDebuggerOptions &rhs) const
|
||||||
|
@@ -4106,13 +4106,12 @@ static QString gdbBinary(const DebuggerStartParameters &sp)
|
|||||||
return sp.debuggerCommand;
|
return sp.debuggerCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GlobalDebuggerOptions::SourcePathMap mergeStartParametersSourcePathMap(
|
static SourcePathMap mergeStartParametersSourcePathMap(const DebuggerStartParameters &sp,
|
||||||
const DebuggerStartParameters &sp, const GlobalDebuggerOptions::SourcePathMap &in)
|
const SourcePathMap &in)
|
||||||
{
|
{
|
||||||
// Do not overwrite user settings.
|
// Do not overwrite user settings.
|
||||||
GlobalDebuggerOptions::SourcePathMap rc = sp.sourcePathMap;
|
SourcePathMap rc = sp.sourcePathMap;
|
||||||
QMap<QString, QString>::const_iterator end = in.end();
|
for (auto it = in.constBegin(), end = in.constEnd(); it != end; ++it)
|
||||||
for (QMap<QString, QString>::const_iterator it = in.begin(); it != end; ++it)
|
|
||||||
rc.insert(it.key(), it.value());
|
rc.insert(it.key(), it.value());
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -4233,9 +4232,6 @@ void GdbEngine::startGdb(const QStringList &args)
|
|||||||
//postCommand("set remotecache on", ConsoleCommand);
|
//postCommand("set remotecache on", ConsoleCommand);
|
||||||
//postCommand("set non-stop on", ConsoleCommand);
|
//postCommand("set non-stop on", ConsoleCommand);
|
||||||
|
|
||||||
typedef GlobalDebuggerOptions::SourcePathMap SourcePathMap;
|
|
||||||
typedef SourcePathMap::const_iterator SourcePathMapIterator;
|
|
||||||
|
|
||||||
showStatusMessage(tr("Setting up inferior..."));
|
showStatusMessage(tr("Setting up inferior..."));
|
||||||
|
|
||||||
// Addint executable to modules list.
|
// Addint executable to modules list.
|
||||||
@@ -4253,11 +4249,12 @@ void GdbEngine::startGdb(const QStringList &args)
|
|||||||
debuggerCore()->globalDebuggerOptions()->sourcePathMap);
|
debuggerCore()->globalDebuggerOptions()->sourcePathMap);
|
||||||
const SourcePathMap completeSourcePathMap =
|
const SourcePathMap completeSourcePathMap =
|
||||||
mergeStartParametersSourcePathMap(sp, sourcePathMap);
|
mergeStartParametersSourcePathMap(sp, sourcePathMap);
|
||||||
const SourcePathMapIterator cend = completeSourcePathMap.constEnd();
|
for (auto it = completeSourcePathMap.constBegin(), cend = completeSourcePathMap.constEnd();
|
||||||
SourcePathMapIterator it = completeSourcePathMap.constBegin();
|
it != cend;
|
||||||
for ( ; it != cend; ++it)
|
++it) {
|
||||||
postCommand("set substitute-path " + it.key().toLocal8Bit()
|
postCommand("set substitute-path " + it.key().toLocal8Bit()
|
||||||
+ " " + it.value().toLocal8Bit());
|
+ " " + it.value().toLocal8Bit());
|
||||||
|
}
|
||||||
|
|
||||||
// Spaces just will not work.
|
// Spaces just will not work.
|
||||||
foreach (const QString &src, sp.debugSourceLocation) {
|
foreach (const QString &src, sp.debugSourceLocation) {
|
||||||
|
Reference in New Issue
Block a user