Commit 2849d3e2 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by hjk
Browse files

Debugger: Added a start script (gdbinit) field in attach to core and in remote debugging



Merge-request: 2191
Reviewed-by: default avatarhjk <qtc-committer@nokia.com>
parent 326ea080
......@@ -2,6 +2,14 @@
<ui version="4.0">
<class>AttachCoreDialog</class>
<widget class="QDialog" name="AttachCoreDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>246</width>
<height>147</height>
</rect>
</property>
<property name="windowTitle">
<string>Start Debugger</string>
</property>
......@@ -59,6 +67,19 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="overrideStartScriptLabel">
<property name="text">
<string>Override &amp;Start script:</string>
</property>
<property name="buddy">
<cstring>overrideStartScriptFileName</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Utils::PathChooser" name="overrideStartScriptFileName"/>
</item>
<item row="2" column="1">
<widget class="Debugger::Internal::DebuggerToolChainComboBox" name="toolchainComboBox"/>
</item>
......@@ -104,7 +125,7 @@
<container>1</container>
</customwidget>
<customwidget>
<class>DebuggerToolChainComboBox</class>
<class>Debugger::Internal::DebuggerToolChainComboBox</class>
<extends>QComboBox</extends>
<header>debuggertoolchaincombobox.h</header>
</customwidget>
......
......@@ -189,12 +189,14 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
m_ui->coreFileName->setExpectedKind(PathChooser::File);
m_ui->coreFileName->setPromptDialogTitle(tr("Select Core File"));
m_ui->overrideStartScriptFileName->setExpectedKind(PathChooser::File);
m_ui->overrideStartScriptFileName->setPromptDialogTitle(tr("Select Startup Script"));
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(m_ui->coreFileName, SIGNAL(changed(QString)), this, SLOT(changed()));
connect(m_ui->execFileName, SIGNAL(changed(QString)), this, SLOT(changed()));
changed();
}
......@@ -246,6 +248,16 @@ QString AttachCoreDialog::debuggerCommand()
return m_ui->toolchainComboBox->debuggerCommand();
}
QString AttachCoreDialog::overrideStartScript() const
{
return m_ui->overrideStartScriptFileName->path();
}
void AttachCoreDialog::setOverrideStartScript(const QString &scriptName)
{
m_ui->overrideStartScriptFileName->setPath(scriptName);
}
bool AttachCoreDialog::isValid() const
{
return m_ui->toolchainComboBox->currentIndex() >= 0 &&
......@@ -632,8 +644,10 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent)
m_ui->executablePathChooser->setExpectedKind(PathChooser::File);
m_ui->executablePathChooser->setPromptDialogTitle(tr("Select Executable"));
m_ui->sysrootPathChooser->setPromptDialogTitle(tr("Select Sysroot"));
m_ui->overrideStartScriptPathChooser->setExpectedKind(PathChooser::File);
m_ui->overrideStartScriptPathChooser->setPromptDialogTitle(tr("Select GDB Start Script"));
m_ui->serverStartScript->setExpectedKind(PathChooser::File);
m_ui->serverStartScript->setPromptDialogTitle(tr("Select Start Script"));
m_ui->serverStartScript->setPromptDialogTitle(tr("Select Server Start Script"));
connect(m_ui->useServerStartScriptCheckBox, SIGNAL(toggled(bool)),
this, SLOT(updateState()));
......@@ -721,6 +735,16 @@ void StartRemoteDialog::setGnuTarget(const QString &gnuTarget)
m_ui->gnuTargetComboBox->setCurrentIndex(index);
}
QString StartRemoteDialog::overrideStartScript() const
{
return m_ui->overrideStartScriptPathChooser->path();
}
void StartRemoteDialog::setOverrideStartScript(const QString &scriptName)
{
m_ui->overrideStartScriptPathChooser->setPath(scriptName);
}
void StartRemoteDialog::setServerStartScript(const QString &scriptName)
{
m_ui->serverStartScript->setPath(scriptName);
......
......@@ -88,6 +88,9 @@ public:
ProjectExplorer::Abi abi() const;
QString debuggerCommand();
QString overrideStartScript() const;
void setOverrideStartScript(const QString &scriptName);
private slots:
void changed();
......@@ -186,6 +189,9 @@ public:
void setGnuTarget(const QString &gnuTarget);
void setGnuTargets(const QStringList &gnuTargets);
QString overrideStartScript() const;
void setOverrideStartScript(const QString &scriptName);
bool useServerStartScript() const;
void setUseServerStartScript(bool on);
QString serverStartScript() const;
......
......@@ -695,6 +695,7 @@ public slots:
void attachCore();
void attachCore(const QString &core, const QString &exeFileName,
const ProjectExplorer::Abi &abi = ProjectExplorer::Abi(),
const QString &overrideStartScript = QString(),
const QString &debuggerCommand = QString());
void attachRemote(const QString &spec);
......@@ -1441,6 +1442,7 @@ void DebuggerPluginPrivate::attachCore()
dlg.setExecutableFile(configValue(_("LastExternalExecutableFile")).toString());
dlg.setCoreFile(configValue(_("LastExternalCoreFile")).toString());
dlg.setAbiIndex(configValue(_("LastExternalCoreAbiIndex")).toInt());
dlg.setOverrideStartScript(configValue(_("LastExternalStartScript")).toString());
if (dlg.exec() != QDialog::Accepted)
return;
......@@ -1448,12 +1450,14 @@ void DebuggerPluginPrivate::attachCore()
setConfigValue(_("LastExternalExecutableFile"), dlg.executableFile());
setConfigValue(_("LastExternalCoreFile"), dlg.coreFile());
setConfigValue(_("LastExternalCoreAbiIndex"), QVariant(dlg.abiIndex()));
attachCore(dlg.coreFile(), dlg.executableFile(), dlg.abi());
setConfigValue(_("LastExternalStartScript"), dlg.overrideStartScript());
attachCore(dlg.coreFile(), dlg.executableFile(), dlg.abi(), dlg.overrideStartScript());
}
void DebuggerPluginPrivate::attachCore(const QString &core,
const QString &exe,
const ProjectExplorer::Abi &abi,
const QString &overrideStartScript,
const QString &debuggerCommand)
{
DebuggerStartParameters sp;
......@@ -1463,6 +1467,7 @@ void DebuggerPluginPrivate::attachCore(const QString &core,
sp.startMode = AttachCore;
sp.debuggerCommand = debuggerCommand;
sp.toolChainAbi = abi.isValid() ? abi : abiOfBinary(sp.coreFile);
sp.overrideStartScript = overrideStartScript;
if (DebuggerRunControl *rc = createDebugger(sp))
startDebugger(rc);
}
......@@ -1534,6 +1539,7 @@ void DebuggerPluginPrivate::startRemoteApplication()
dlg.setDebugger(configValue(_("LastDebugger")).toString());
dlg.setRemoteArchitecture(lastUsed);
dlg.setGnuTarget(lastUsedGnuTarget);
dlg.setOverrideStartScript(configValue(_("LastRemoteStartScript")).toString());
dlg.setServerStartScript(
configValue(_("LastServerStartScript")).toString());
dlg.setUseServerStartScript(
......@@ -1546,6 +1552,7 @@ void DebuggerPluginPrivate::startRemoteApplication()
setConfigValue(_("LastDebugger"), dlg.debugger());
setConfigValue(_("LastRemoteArchitecture"), dlg.remoteArchitecture());
setConfigValue(_("LastGnuTarget"), dlg.gnuTarget());
setConfigValue(_("LastRemoteStartScript"), dlg.overrideStartScript());
setConfigValue(_("LastServerStartScript"), dlg.serverStartScript());
setConfigValue(_("LastUseServerStartScript"), dlg.useServerStartScript());
setConfigValue(_("LastSysroot"), dlg.sysRoot());
......@@ -1558,6 +1565,7 @@ void DebuggerPluginPrivate::startRemoteApplication()
if (!sp.debuggerCommand.isEmpty())
sp.toolChainAbi = ProjectExplorer::Abi();
sp.startMode = AttachToRemote;
sp.overrideStartScript = dlg.overrideStartScript();
sp.useServerStartScript = dlg.useServerStartScript();
sp.serverStartScript = dlg.serverStartScript();
sp.sysRoot = dlg.sysRoot();
......
......@@ -80,6 +80,7 @@ public:
QString displayName; // Used in the Snapshots view.
QString startMessage; // First status message shown.
QString coreFile;
QString overrideStartScript; // Used in attach to core and remote debugging
bool isSnapshot; // Set if created internally.
QString processArgs;
Utils::Environment environment;
......
......@@ -4438,7 +4438,9 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &settingsIdHint)
loadPythonDumpers();
QString scriptFileName = debuggerCore()->stringSetting(GdbScriptFile);
QString scriptFileName = sp.overrideStartScript;
if (scriptFileName.isEmpty())
scriptFileName = debuggerCore()->stringSetting(GdbScriptFile);
if (!scriptFileName.isEmpty()) {
if (QFileInfo(scriptFileName).isReadable()) {
postCommand("source " + scriptFileName.toLocal8Bit());
......
......@@ -107,6 +107,19 @@
<widget class="Utils::PathChooser" name="sysrootPathChooser"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="overrideStartScriptLabel">
<property name="text">
<string>Override S&amp;tart script:</string>
</property>
<property name="buddy">
<cstring>overrideStartScriptPathChooser</cstring>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="Utils::PathChooser" name="overrideStartScriptPathChooser"/>
</item>
<item row="7" column="0">
<widget class="QLabel" name="useServerStartScriptLabel">
<property name="text">
<string>&amp;Use server start script:</string>
......@@ -116,10 +129,10 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QCheckBox" name="useServerStartScriptCheckBox"/>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="serverStartScriptLabel">
<property name="text">
<string>&amp;Server start script:</string>
......@@ -129,7 +142,7 @@
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="Utils::PathChooser" name="serverStartScript"/>
</item>
</layout>
......
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