debugger: Added Sysroot chooser for Attach to Core

Merge-request: 339
Reviewed-by: hjk <qtc-committer@nokia.com>

Change-Id: Iad451a0ad124c2eb992433fb0db95b962a551d6b
Reviewed-on: http://codereview.qt.nokia.com/211
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Orgad Shaneh
2011-05-30 12:32:58 +02:00
committed by hjk
parent 66dd03cccc
commit ef19691309
5 changed files with 41 additions and 5 deletions

View File

@@ -67,7 +67,20 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Debugger::Internal::DebuggerToolChainComboBox" name="toolchainComboBox"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="sysrootLabel">
<property name="text">
<string>Sysroot</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Utils::PathChooser" name="sysrootPathChooser"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="overrideStartScriptLabel">
<property name="text">
<string>Override &amp;Start script:</string>
@@ -77,12 +90,9 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="Utils::PathChooser" name="overrideStartScriptFileName"/>
</item>
<item row="2" column="1">
<widget class="Debugger::Internal::DebuggerToolChainComboBox" name="toolchainComboBox"/>
</item>
</layout>
</item>
<item>

View File

@@ -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();

View File

@@ -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);

View File

@@ -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);

View File

@@ -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));
}