diff --git a/src/plugins/debugger/attachcoredialog.ui b/src/plugins/debugger/attachcoredialog.ui
index 0de43d2f785..206b7d41dc6 100644
--- a/src/plugins/debugger/attachcoredialog.ui
+++ b/src/plugins/debugger/attachcoredialog.ui
@@ -67,7 +67,20 @@
+ -
+
+
-
+
+
+ Sysroot
+
+
+
+ -
+
+
+ -
Override &Start script:
@@ -77,12 +90,9 @@
- -
+
-
- -
-
-
-
diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp
index b65d1d73d45..d4c0ef14ae2 100644
--- a/src/plugins/debugger/debuggerdialogs.cpp
+++ b/src/plugins/debugger/debuggerdialogs.cpp
@@ -189,6 +189,9 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
m_ui->coreFileName->setExpectedKind(PathChooser::File);
m_ui->coreFileName->setPromptDialogTitle(tr("Select Core File"));
+ m_ui->sysrootPathChooser->setExpectedKind(PathChooser::Directory);
+ m_ui->sysrootPathChooser->setPromptDialogTitle(tr("Select Sysroot"));
+
m_ui->overrideStartScriptFileName->setExpectedKind(PathChooser::File);
m_ui->overrideStartScriptFileName->setPromptDialogTitle(tr("Select Startup Script"));
@@ -248,6 +251,17 @@ QString AttachCoreDialog::debuggerCommand()
return m_ui->toolchainComboBox->debuggerCommand();
}
+QString AttachCoreDialog::sysRoot() const
+
+{
+ return m_ui->sysrootPathChooser->path();
+}
+
+void AttachCoreDialog::setSysRoot(const QString &sysroot)
+{
+ m_ui->sysrootPathChooser->setPath(sysroot);
+}
+
QString AttachCoreDialog::overrideStartScript() const
{
return m_ui->overrideStartScriptFileName->path();
diff --git a/src/plugins/debugger/debuggerdialogs.h b/src/plugins/debugger/debuggerdialogs.h
index 291fbd22dd8..18d03153536 100644
--- a/src/plugins/debugger/debuggerdialogs.h
+++ b/src/plugins/debugger/debuggerdialogs.h
@@ -88,6 +88,9 @@ public:
ProjectExplorer::Abi abi() const;
QString debuggerCommand();
+ QString sysRoot() const;
+ void setSysRoot(const QString &sysRoot);
+
QString overrideStartScript() const;
void setOverrideStartScript(const QString &scriptName);
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 3a988c52ce5..2698d7094e5 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -695,6 +695,7 @@ public slots:
void attachCore();
void attachCore(const QString &core, const QString &exeFileName,
const ProjectExplorer::Abi &abi = ProjectExplorer::Abi(),
+ const QString &sysRoot = QString(),
const QString &overrideStartScript = QString(),
const QString &debuggerCommand = QString());
void attachRemote(const QString &spec);
@@ -1439,6 +1440,7 @@ void DebuggerPluginPrivate::attachCore()
dlg.setExecutableFile(configValue(_("LastExternalExecutableFile")).toString());
dlg.setCoreFile(configValue(_("LastExternalCoreFile")).toString());
dlg.setAbiIndex(configValue(_("LastExternalCoreAbiIndex")).toInt());
+ dlg.setSysRoot(configValue(_("LastSysroot")).toString());
dlg.setOverrideStartScript(configValue(_("LastExternalStartScript")).toString());
if (dlg.exec() != QDialog::Accepted)
@@ -1447,13 +1449,16 @@ void DebuggerPluginPrivate::attachCore()
setConfigValue(_("LastExternalExecutableFile"), dlg.executableFile());
setConfigValue(_("LastExternalCoreFile"), dlg.coreFile());
setConfigValue(_("LastExternalCoreAbiIndex"), QVariant(dlg.abiIndex()));
+ setConfigValue(_("LastSysroot"), dlg.sysRoot());
setConfigValue(_("LastExternalStartScript"), dlg.overrideStartScript());
- attachCore(dlg.coreFile(), dlg.executableFile(), dlg.abi(), dlg.overrideStartScript());
+ attachCore(dlg.coreFile(), dlg.executableFile(), dlg.abi(),
+ dlg.sysRoot(), dlg.overrideStartScript());
}
void DebuggerPluginPrivate::attachCore(const QString &core,
const QString &exe,
const ProjectExplorer::Abi &abi,
+ const QString &sysRoot,
const QString &overrideStartScript,
const QString &debuggerCommand)
{
@@ -1464,6 +1469,7 @@ void DebuggerPluginPrivate::attachCore(const QString &core,
sp.startMode = AttachCore;
sp.debuggerCommand = debuggerCommand;
sp.toolChainAbi = abi.isValid() ? abi : abiOfBinary(sp.coreFile);
+ sp.sysRoot = sysRoot;
sp.overrideStartScript = overrideStartScript;
if (DebuggerRunControl *rc = createDebugger(sp))
startDebugger(rc);
diff --git a/src/plugins/debugger/gdb/coregdbadapter.cpp b/src/plugins/debugger/gdb/coregdbadapter.cpp
index 645ba343e5a..c1fd588f1ef 100644
--- a/src/plugins/debugger/gdb/coregdbadapter.cpp
+++ b/src/plugins/debugger/gdb/coregdbadapter.cpp
@@ -164,7 +164,10 @@ void CoreGdbAdapter::setupInferior()
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
// Do that first, otherwise no symbols are loaded.
QFileInfo fi(m_executable);
+ const QByteArray sysRoot = startParameters().sysRoot.toLocal8Bit();
QByteArray path = fi.absoluteFilePath().toLocal8Bit();
+ if (!sysRoot.isEmpty())
+ m_engine->postCommand("set sysroot " + sysRoot);
m_engine->postCommand("-file-exec-and-symbols \"" + path + '"',
CB(handleFileExecAndSymbols));
}