diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp
index ba0a6c9f837..adaaf58c6e8 100644
--- a/src/plugins/debugger/debuggeractions.cpp
+++ b/src/plugins/debugger/debuggeractions.cpp
@@ -349,6 +349,14 @@ DebuggerSettings::DebuggerSettings(QSettings *settings)
item->setValue(true);
insertItem(LoadGdbInit, item);
+ item = new SavedAction(this);
+ item->setSettingsKey(debugModeGroup, QLatin1String("AutoEnrichParameters"));
+ item->setDefaultValue(QString());
+ item->setCheckable(true);
+ item->setDefaultValue(false);
+ item->setValue(false);
+ insertItem(AutoEnrichParameters, item);
+
item = new SavedAction(this);
item->setSettingsKey(debugModeGroup, QLatin1String("TargetAsync"));
item->setCheckable(true);
diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h
index 33b564c6bae..1699d5fcba7 100644
--- a/src/plugins/debugger/debuggeractions.h
+++ b/src/plugins/debugger/debuggeractions.h
@@ -55,17 +55,18 @@ public:
void toSettings(QSettings *) const;
void fromSettings(QSettings *);
- bool equals(const GlobalDebuggerOptions &rhs) const { return sourcePathMap == rhs.sourcePathMap; }
+ bool operator==(const GlobalDebuggerOptions &rhs) const
+ { return sourcePathMap == rhs.sourcePathMap; }
+ bool operator!=(const GlobalDebuggerOptions &rhs) const
+ { return sourcePathMap != rhs.sourcePathMap; }
SourcePathMap sourcePathMap;
};
-inline bool operator==(const GlobalDebuggerOptions &o1, const GlobalDebuggerOptions &o2) { return o1.equals(o2); }
-inline bool operator!=(const GlobalDebuggerOptions &o1, const GlobalDebuggerOptions &o2) { return !o1.equals(o2); }
-
class DebuggerSettings : public QObject
{
Q_OBJECT // For tr().
+
public:
explicit DebuggerSettings(QSettings *setting);
~DebuggerSettings();
@@ -118,6 +119,7 @@ enum DebuggerActionCode
LoadGdbInit,
GdbScriptFile,
GdbWatchdogTimeout,
+ AutoEnrichParameters,
TargetAsync,
// Stack
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 6b5307a78e7..8b3cb805458 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1187,6 +1187,23 @@ static QString msgParameterMissing(const QString &a)
return DebuggerPlugin::tr("Option '%1' is missing the parameter.").arg(a);
}
+
+static void maybeEnrichParameters(DebuggerStartParameters *sp)
+{
+ if (!theDebuggerCore->boolSetting(AutoEnrichParameters))
+ return;
+ if (sp->debugInfoLocation.isEmpty())
+ sp->debugInfoLocation = sp->sysroot + "/usr/lib/debug";
+ if (sp->debugSourceLocation.isEmpty()) {
+ QString base = sp->sysroot + "/usr/src/debug/";
+ sp->debugSourceLocation.append(base + "qt5base/src/corelib");
+ sp->debugSourceLocation.append(base + "qt5base/src/gui");
+ sp->debugSourceLocation.append(base + "qt5base/src/network");
+ sp->debugSourceLocation.append(base + "qt5base/src/v8");
+ sp->debugSourceLocation.append(base + "qtdeclarative/src/declarative/qml");
+ }
+}
+
bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
const QStringList::const_iterator &cend,
unsigned *enabledEngines, QString *errorMessage)
@@ -1467,6 +1484,7 @@ void DebuggerPluginPrivate::attachExternalApplication()
sp.startMode = AttachExternal;
sp.toolChainAbi = dlg.abi();
sp.debuggerCommand = dlg.debuggerCommand();
+ maybeEnrichParameters(&sp);
if (DebuggerRunControl *rc = createDebugger(sp))
startDebugger(rc);
}
@@ -1478,6 +1496,7 @@ void DebuggerPluginPrivate::attachExternalApplication(ProjectExplorer::RunContro
sp.displayName = tr("Debugger attached to %1").arg(rc->displayName());
sp.startMode = AttachExternal;
sp.toolChainAbi = rc->abi();
+ maybeEnrichParameters(&sp);
if (DebuggerRunControl *rc = createDebugger(sp))
startDebugger(rc);
}
@@ -1509,6 +1528,7 @@ void DebuggerPluginPrivate::attachCore()
sp.toolChainAbi = dlg.abi();
sp.sysroot = dlg.sysroot();
sp.overrideStartScript = dlg.overrideStartScript();
+ maybeEnrichParameters(&sp);
if (DebuggerRunControl *rc = createDebugger(sp))
startDebugger(rc);
}
@@ -1523,6 +1543,7 @@ void DebuggerPluginPrivate::attachRemote(const QString &spec)
sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel);
sp.startMode = AttachToRemoteServer;
sp.toolChainAbi = anyAbiOfBinary(sp.executable);
+ maybeEnrichParameters(&sp);
if (DebuggerRunControl *rc = createDebugger(sp))
startDebugger(rc);
}
@@ -1611,16 +1632,6 @@ bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, b
sp.serverStartScript = dlg.serverStartScript();
sp.sysroot = dlg.sysroot();
sp.debugInfoLocation = dlg.debugInfoLocation();
- if (sp.debugInfoLocation.isEmpty())
- sp.debugInfoLocation = sp.sysroot + "/usr/lib/debug";
- if (sp.debugSourceLocation.isEmpty()) {
- QString base = sp.sysroot + "/usr/src/debug/";
- sp.debugSourceLocation.append(base + "qt5base/src/corelib");
- sp.debugSourceLocation.append(base + "qt5base/src/gui");
- sp.debugSourceLocation.append(base + "qt5base/src/network");
- sp.debugSourceLocation.append(base + "qt5base/src/v8");
- sp.debugSourceLocation.append(base + "qtdeclarative/src/declarative/qml");
- }
return true;
}
@@ -1628,9 +1639,11 @@ void DebuggerPluginPrivate::startRemoteApplication()
{
DebuggerStartParameters sp;
sp.startMode = StartRemote;
- if (queryRemoteParameters(sp, true))
- if (RunControl *rc = createDebugger(sp))
- startDebugger(rc);
+ if (!queryRemoteParameters(sp, true))
+ return;
+ maybeEnrichParameters(&sp);
+ if (RunControl *rc = createDebugger(sp))
+ startDebugger(rc);
}
void DebuggerPluginPrivate::attachRemoteApplication()
@@ -1641,6 +1654,7 @@ void DebuggerPluginPrivate::attachRemoteApplication()
sp.startMode = AttachToRemoteServer;
sp.useServerStartScript = false;
sp.serverStartScript.clear();
+ maybeEnrichParameters(&sp);
if (RunControl *rc = createDebugger(sp))
startDebugger(rc);
}
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 68b28e49373..e4064016574 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -4759,6 +4759,12 @@ void GdbEngine::setupInferior()
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
showStatusMessage(tr("Setting up inferior..."));
+ const DebuggerStartParameters &sp = startParameters();
+ const QByteArray debugInfoLocation = sp.debugInfoLocation.toLocal8Bit();
+ if (!debugInfoLocation.isEmpty())
+ postCommand("set debug-file-directory " + debugInfoLocation);
+ foreach (const QString &src, sp.debugSourceLocation)
+ postCommand("directory " + src.toLocal8Bit());
m_gdbAdapter->setupInferior();
}
diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp
index 20f50d21d7e..654a265e47c 100644
--- a/src/plugins/debugger/gdb/gdboptionspage.cpp
+++ b/src/plugins/debugger/gdb/gdboptionspage.cpp
@@ -90,6 +90,8 @@ QWidget *GdbOptionsPage::createPage(QWidget *parent)
m_ui->scriptFileChooser);
m_group.insert(debuggerCore()->action(LoadGdbInit),
m_ui->checkBoxLoadGdbInit);
+ m_group.insert(debuggerCore()->action(AutoEnrichParameters),
+ m_ui->checkBoxAutoEnrichParameters);
m_group.insert(debuggerCore()->action(TargetAsync),
m_ui->checkBoxTargetAsync);
m_group.insert(debuggerCore()->action(AdjustBreakpointLocations),
diff --git a/src/plugins/debugger/gdb/gdboptionspage.ui b/src/plugins/debugger/gdb/gdboptionspage.ui
index f2e21e1e913..187d2285abf 100644
--- a/src/plugins/debugger/gdb/gdboptionspage.ui
+++ b/src/plugins/debugger/gdb/gdboptionspage.ui
@@ -123,20 +123,30 @@ on slow machines. In this case, the value should be increased.
-
+
+
+ This adds common paths to locations of debug information at debugger startup.
+
+
+ Use common locations for debug information automatically
+
+
+
+ -
Stop when a qWarning is issued
- -
+
-
Stop when a qFatal is issued
- -
+
-
<html><head/><body><p>Selecting this enables reverse debugging.</p><.p><b>Note:</b>This feature is very slow and unstable on the GDB side. It exhibits unpredictable behaviour when going backwards over system calls and is very likely to destroy your debugging session.</p><body></html>