forked from qt-creator/qt-creator
debugger: port 'Attach to Core' over to new Profile architecture
Change-Id: I89e743314025fe715982b4c43849ce128e014f55 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -70,20 +70,10 @@
|
|||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="Debugger::Internal::DebuggerToolChainComboBox" name="toolchainComboBox"/>
|
<widget class="Debugger::Internal::DebuggerToolChainComboBox" name="toolchainComboBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="sysrootLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Sys&root:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>sysrootPathChooser</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="Utils::PathChooser" name="sysrootPathChooser" native="true"/>
|
<widget class="Utils::PathChooser" name="overrideStartScriptFileName" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="overrideStartScriptLabel">
|
<widget class="QLabel" name="overrideStartScriptLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Override &start script:</string>
|
<string>Override &start script:</string>
|
||||||
@@ -93,9 +83,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="Utils::PathChooser" name="overrideStartScriptFileName" native="true"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include "debuggerstartparameters.h"
|
#include "debuggerstartparameters.h"
|
||||||
|
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
|
#include "debuggerprofileinformation.h"
|
||||||
#include "debuggerstringutils.h"
|
#include "debuggerstringutils.h"
|
||||||
#include "cdb/cdbengine.h"
|
#include "cdb/cdbengine.h"
|
||||||
#include "shared/hostutils.h"
|
#include "shared/hostutils.h"
|
||||||
@@ -47,6 +48,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <projectexplorer/abi.h>
|
#include <projectexplorer/abi.h>
|
||||||
|
#include <projectexplorer/profileinformation.h>
|
||||||
#include <utils/historycompleter.h>
|
#include <utils/historycompleter.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/synchronousprocess.h>
|
#include <utils/synchronousprocess.h>
|
||||||
@@ -68,6 +70,7 @@
|
|||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
@@ -191,9 +194,6 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
|
|||||||
m_ui->coreFileName->setExpectedKind(PathChooser::File);
|
m_ui->coreFileName->setExpectedKind(PathChooser::File);
|
||||||
m_ui->coreFileName->setPromptDialogTitle(tr("Select Core 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->setExpectedKind(PathChooser::File);
|
||||||
m_ui->overrideStartScriptFileName->setPromptDialogTitle(tr("Select Startup Script"));
|
m_ui->overrideStartScriptFileName->setPromptDialogTitle(tr("Select Startup Script"));
|
||||||
|
|
||||||
@@ -232,37 +232,22 @@ void AttachCoreDialog::setCoreFile(const QString &fileName)
|
|||||||
changed();
|
changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::Abi AttachCoreDialog::abi() const
|
Profile *AttachCoreDialog::profile() const
|
||||||
{
|
{
|
||||||
return m_ui->toolchainComboBox->abi();
|
return m_ui->toolchainComboBox->profile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttachCoreDialog::setAbiIndex(int i)
|
void AttachCoreDialog::setProfileIndex(int i)
|
||||||
{
|
{
|
||||||
if (i >= 0 && i < m_ui->toolchainComboBox->count())
|
if (i >= 0 && i < m_ui->toolchainComboBox->count())
|
||||||
m_ui->toolchainComboBox->setCurrentIndex(i);
|
m_ui->toolchainComboBox->setCurrentIndex(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AttachCoreDialog::abiIndex() const
|
int AttachCoreDialog::profileIndex() const
|
||||||
{
|
{
|
||||||
return m_ui->toolchainComboBox->currentIndex();
|
return m_ui->toolchainComboBox->currentIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
QString AttachCoreDialog::overrideStartScript() const
|
||||||
{
|
{
|
||||||
return m_ui->overrideStartScriptFileName->path();
|
return m_ui->overrideStartScriptFileName->path();
|
||||||
@@ -394,27 +379,22 @@ QString AttachExternalDialog::executable() const
|
|||||||
return m_model->executableForPid(attachPIDText());
|
return m_model->executableForPid(attachPIDText());
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::Abi AttachExternalDialog::abi() const
|
Profile *AttachExternalDialog::profile() const
|
||||||
{
|
{
|
||||||
return m_ui->toolchainComboBox->abi();
|
return m_ui->toolchainComboBox->profile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttachExternalDialog::setAbiIndex(int i)
|
void AttachExternalDialog::setProfileIndex(int i)
|
||||||
{
|
{
|
||||||
if (i >= 0 && i < m_ui->toolchainComboBox->count())
|
if (i >= 0 && i < m_ui->toolchainComboBox->count())
|
||||||
m_ui->toolchainComboBox->setCurrentIndex(i);
|
m_ui->toolchainComboBox->setCurrentIndex(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AttachExternalDialog::abiIndex() const
|
int AttachExternalDialog::profileIndex() const
|
||||||
{
|
{
|
||||||
return m_ui->toolchainComboBox->currentIndex();
|
return m_ui->toolchainComboBox->currentIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AttachExternalDialog::debuggerCommand()
|
|
||||||
{
|
|
||||||
return m_ui->toolchainComboBox->debuggerCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AttachExternalDialog::pidChanged(const QString &pid)
|
void AttachExternalDialog::pidChanged(const QString &pid)
|
||||||
{
|
{
|
||||||
const bool enabled = !pid.isEmpty() && pid != QLatin1String("0") && pid != m_selfPid
|
const bool enabled = !pid.isEmpty() && pid != QLatin1String("0") && pid != m_selfPid
|
||||||
@@ -607,14 +587,9 @@ QString StartExternalDialog::executableFile() const
|
|||||||
return m_ui->execFile->path();
|
return m_ui->execFile->path();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::Abi StartExternalDialog::abi() const
|
Profile *StartExternalDialog::profile() const
|
||||||
{
|
{
|
||||||
return m_ui->toolChainComboBox->abi();
|
return m_ui->toolChainComboBox->profile();
|
||||||
}
|
|
||||||
|
|
||||||
QString StartExternalDialog::debuggerCommand()
|
|
||||||
{
|
|
||||||
return m_ui->toolChainComboBox->debuggerCommand();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StartExternalDialog::isValid() const
|
bool StartExternalDialog::isValid() const
|
||||||
@@ -695,10 +670,15 @@ bool StartExternalDialog::run(QWidget *parent,
|
|||||||
writeParameterHistory(history, settings, settingsGroup, arrayName);
|
writeParameterHistory(history, settings, settingsGroup, arrayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Profile *profile = dialog.profile();
|
||||||
|
QTC_ASSERT(profile, return false);
|
||||||
|
ToolChain *tc = ToolChainProfileInformation::toolChain(profile);
|
||||||
|
QTC_ASSERT(tc, return false);
|
||||||
|
|
||||||
sp->executable = newParameters.executableFile;
|
sp->executable = newParameters.executableFile;
|
||||||
sp->startMode = StartExternal;
|
sp->startMode = StartExternal;
|
||||||
sp->toolChainAbi = dialog.abi();
|
sp->toolChainAbi = tc->targetAbi();
|
||||||
sp->debuggerCommand = dialog.debuggerCommand();
|
sp->debuggerCommand = DebuggerProfileInformation::debuggerCommand(profile).toString();
|
||||||
sp->workingDirectory = newParameters.workingDirectory;
|
sp->workingDirectory = newParameters.workingDirectory;
|
||||||
sp->displayName = sp->executable;
|
sp->displayName = sp->executable;
|
||||||
sp->useTerminal = newParameters.runInTerminal;
|
sp->useTerminal = newParameters.runInTerminal;
|
||||||
@@ -707,10 +687,10 @@ bool StartExternalDialog::run(QWidget *parent,
|
|||||||
// Fixme: 1 of 3 testing hacks.
|
// Fixme: 1 of 3 testing hacks.
|
||||||
if (sp->processArgs.startsWith(QLatin1String("@tcf@ ")) || sp->processArgs.startsWith(QLatin1String("@sym@ ")))
|
if (sp->processArgs.startsWith(QLatin1String("@tcf@ ")) || sp->processArgs.startsWith(QLatin1String("@sym@ ")))
|
||||||
// Set up an ARM Symbian Abi
|
// Set up an ARM Symbian Abi
|
||||||
sp->toolChainAbi = ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture,
|
sp->toolChainAbi = Abi(Abi::ArmArchitecture,
|
||||||
ProjectExplorer::Abi::SymbianOS,
|
Abi::SymbianOS,
|
||||||
ProjectExplorer::Abi::SymbianDeviceFlavor,
|
Abi::SymbianDeviceFlavor,
|
||||||
ProjectExplorer::Abi::ElfFormat, false);
|
Abi::ElfFormat, false);
|
||||||
|
|
||||||
sp->breakOnMain = newParameters.breakAtMain;
|
sp->breakOnMain = newParameters.breakAtMain;
|
||||||
return true;
|
return true;
|
||||||
@@ -870,12 +850,17 @@ bool StartRemoteDialog::run(QWidget *parent,
|
|||||||
writeParameterHistory(history, settings, settingsGroup, arrayName);
|
writeParameterHistory(history, settings, settingsGroup, arrayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Profile *profile = dialog.profile();
|
||||||
|
QTC_ASSERT(profile, return false);
|
||||||
|
ToolChain *tc = ToolChainProfileInformation::toolChain(profile);
|
||||||
|
QTC_ASSERT(tc, return false);
|
||||||
|
|
||||||
sp->remoteChannel = newParameters.remoteChannel;
|
sp->remoteChannel = newParameters.remoteChannel;
|
||||||
sp->remoteArchitecture = newParameters.remoteArchitecture;
|
sp->remoteArchitecture = newParameters.remoteArchitecture;
|
||||||
sp->executable = newParameters.localExecutable;
|
sp->executable = newParameters.localExecutable;
|
||||||
sp->displayName = tr("Remote: \"%1\"").arg(sp->remoteChannel);
|
sp->displayName = tr("Remote: \"%1\"").arg(sp->remoteChannel);
|
||||||
sp->debuggerCommand = dialog.debuggerCommand();
|
sp->debuggerCommand = DebuggerProfileInformation::debuggerCommand(profile).toString();
|
||||||
sp->toolChainAbi = dialog.abi();
|
sp->toolChainAbi = tc->targetAbi();
|
||||||
sp->overrideStartScript = newParameters.overrideStartScript;
|
sp->overrideStartScript = newParameters.overrideStartScript;
|
||||||
sp->useServerStartScript = newParameters.useServerStartScript;
|
sp->useServerStartScript = newParameters.useServerStartScript;
|
||||||
sp->serverStartScript = newParameters.serverStartScript;
|
sp->serverStartScript = newParameters.serverStartScript;
|
||||||
@@ -933,14 +918,9 @@ void StartRemoteDialog::historyIndexChanged(int index)
|
|||||||
setParameters(v.value<StartRemoteParameters>());
|
setParameters(v.value<StartRemoteParameters>());
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::Abi StartRemoteDialog::abi() const
|
Profile *StartRemoteDialog::profile() const
|
||||||
{
|
{
|
||||||
return m_ui->toolchainComboBox->abi();
|
return m_ui->toolchainComboBox->profile();
|
||||||
}
|
|
||||||
|
|
||||||
QString StartRemoteDialog::debuggerCommand() const
|
|
||||||
{
|
|
||||||
return m_ui->toolchainComboBox->debuggerCommand();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartRemoteDialog::setRemoteArchitectures(const QStringList &list)
|
void StartRemoteDialog::setRemoteArchitectures(const QStringList &list)
|
||||||
|
@@ -33,10 +33,9 @@
|
|||||||
#ifndef DEBUGGER_DIALOGS_H
|
#ifndef DEBUGGER_DIALOGS_H
|
||||||
#define DEBUGGER_DIALOGS_H
|
#define DEBUGGER_DIALOGS_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QDialog>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
@@ -46,7 +45,7 @@ class QDialogButtonBox;
|
|||||||
class QSettings;
|
class QSettings;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer { class Abi; }
|
namespace ProjectExplorer { class Profile; }
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
class DebuggerStartParameters;
|
class DebuggerStartParameters;
|
||||||
@@ -80,13 +79,9 @@ public:
|
|||||||
QString executableFile() const;
|
QString executableFile() const;
|
||||||
QString coreFile() const;
|
QString coreFile() const;
|
||||||
|
|
||||||
int abiIndex() const;
|
int profileIndex() const;
|
||||||
void setAbiIndex(int);
|
void setProfileIndex(int);
|
||||||
ProjectExplorer::Abi abi() const;
|
ProjectExplorer::Profile *profile() const;
|
||||||
QString debuggerCommand();
|
|
||||||
|
|
||||||
QString sysroot() const;
|
|
||||||
void setSysroot(const QString &sysroot);
|
|
||||||
|
|
||||||
QString overrideStartScript() const;
|
QString overrideStartScript() const;
|
||||||
void setOverrideStartScript(const QString &scriptName);
|
void setOverrideStartScript(const QString &scriptName);
|
||||||
@@ -111,12 +106,11 @@ public:
|
|||||||
qint64 attachPID() const;
|
qint64 attachPID() const;
|
||||||
QString executable() const;
|
QString executable() const;
|
||||||
|
|
||||||
int abiIndex() const;
|
int profileIndex() const;
|
||||||
void setAbiIndex(int);
|
void setProfileIndex(int);
|
||||||
ProjectExplorer::Abi abi() const;
|
ProjectExplorer::Profile *profile() const;
|
||||||
QString debuggerCommand();
|
|
||||||
|
|
||||||
virtual void accept();
|
void accept();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void rebuildProcessList();
|
void rebuildProcessList();
|
||||||
@@ -156,9 +150,7 @@ private:
|
|||||||
QString executableFile() const;
|
QString executableFile() const;
|
||||||
void setExecutableFile(const QString &executable);
|
void setExecutableFile(const QString &executable);
|
||||||
|
|
||||||
ProjectExplorer::Abi abi() const;
|
ProjectExplorer::Profile *profile() const;
|
||||||
QString debuggerCommand();
|
|
||||||
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
Ui::StartExternalDialog *m_ui;
|
Ui::StartExternalDialog *m_ui;
|
||||||
@@ -186,8 +178,7 @@ private:
|
|||||||
|
|
||||||
void setRemoteArchitectures(const QStringList &list);
|
void setRemoteArchitectures(const QStringList &list);
|
||||||
|
|
||||||
ProjectExplorer::Abi abi() const;
|
ProjectExplorer::Profile *profile() const;
|
||||||
QString debuggerCommand() const;
|
|
||||||
|
|
||||||
Ui::StartRemoteDialog *m_ui;
|
Ui::StartRemoteDialog *m_ui;
|
||||||
};
|
};
|
||||||
@@ -224,12 +215,12 @@ public:
|
|||||||
QString connection() const;
|
QString connection() const;
|
||||||
void setConnection(const QString &);
|
void setConnection(const QString &);
|
||||||
|
|
||||||
virtual void accept();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void textChanged(const QString &);
|
void textChanged(const QString &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void accept();
|
||||||
|
|
||||||
QPushButton *m_okButton;
|
QPushButton *m_okButton;
|
||||||
QLineEdit *m_lineEdit;
|
QLineEdit *m_lineEdit;
|
||||||
};
|
};
|
||||||
@@ -243,12 +234,12 @@ public:
|
|||||||
void setAddress(quint64 a);
|
void setAddress(quint64 a);
|
||||||
quint64 address() const;
|
quint64 address() const;
|
||||||
|
|
||||||
virtual void accept();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void textChanged();
|
void textChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void accept();
|
||||||
|
|
||||||
void setOkButtonEnabled(bool v);
|
void setOkButtonEnabled(bool v);
|
||||||
bool isOkButtonEnabled() const;
|
bool isOkButtonEnabled() const;
|
||||||
|
|
||||||
|
@@ -1534,7 +1534,7 @@ void DebuggerPluginPrivate::startExternalApplication()
|
|||||||
void DebuggerPluginPrivate::attachExternalApplication()
|
void DebuggerPluginPrivate::attachExternalApplication()
|
||||||
{
|
{
|
||||||
AttachExternalDialog dlg(mainWindow());
|
AttachExternalDialog dlg(mainWindow());
|
||||||
dlg.setAbiIndex(configValue(_("LastAttachExternalAbiIndex")).toInt());
|
dlg.setProfileIndex(configValue(_("LastAttachExternalProfileIndex")).toInt());
|
||||||
|
|
||||||
if (dlg.exec() != QDialog::Accepted)
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
@@ -1545,7 +1545,12 @@ void DebuggerPluginPrivate::attachExternalApplication()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setConfigValue(_("LastAttachExternalAbiIndex"), QVariant(dlg.abiIndex()));
|
setConfigValue(_("LastAttachExternalProfileIndex"), QVariant(dlg.profileIndex()));
|
||||||
|
|
||||||
|
Profile *profile = dlg.profile();
|
||||||
|
QTC_ASSERT(profile, return);
|
||||||
|
ToolChain *tc = ToolChainProfileInformation::toolChain(profile);
|
||||||
|
QTC_ASSERT(tc, return);
|
||||||
|
|
||||||
DebuggerStartParameters sp;
|
DebuggerStartParameters sp;
|
||||||
sp.attachPID = dlg.attachPID();
|
sp.attachPID = dlg.attachPID();
|
||||||
@@ -1553,8 +1558,8 @@ void DebuggerPluginPrivate::attachExternalApplication()
|
|||||||
sp.executable = dlg.executable();
|
sp.executable = dlg.executable();
|
||||||
sp.startMode = AttachExternal;
|
sp.startMode = AttachExternal;
|
||||||
sp.closeMode = DetachAtClose;
|
sp.closeMode = DetachAtClose;
|
||||||
sp.toolChainAbi = dlg.abi();
|
sp.toolChainAbi = tc->targetAbi();
|
||||||
sp.debuggerCommand = dlg.debuggerCommand();
|
sp.debuggerCommand = DebuggerProfileInformation::debuggerCommand(profile).toString();
|
||||||
if (DebuggerRunControl *rc = createDebugger(sp))
|
if (DebuggerRunControl *rc = createDebugger(sp))
|
||||||
startDebugger(rc);
|
startDebugger(rc);
|
||||||
}
|
}
|
||||||
@@ -1576,8 +1581,7 @@ void DebuggerPluginPrivate::attachCore()
|
|||||||
AttachCoreDialog dlg(mainWindow());
|
AttachCoreDialog dlg(mainWindow());
|
||||||
dlg.setExecutableFile(configValue(_("LastExternalExecutableFile")).toString());
|
dlg.setExecutableFile(configValue(_("LastExternalExecutableFile")).toString());
|
||||||
dlg.setCoreFile(configValue(_("LastExternalCoreFile")).toString());
|
dlg.setCoreFile(configValue(_("LastExternalCoreFile")).toString());
|
||||||
dlg.setAbiIndex(configValue(_("LastExternalAbiIndex")).toInt());
|
dlg.setProfileIndex(configValue(_("LastExternalProfileIndex")).toInt());
|
||||||
dlg.setSysroot(configValue(_("LastSysroot")).toString());
|
|
||||||
dlg.setOverrideStartScript(configValue(_("LastExternalStartScript")).toString());
|
dlg.setOverrideStartScript(configValue(_("LastExternalStartScript")).toString());
|
||||||
|
|
||||||
if (dlg.exec() != QDialog::Accepted)
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
@@ -1585,19 +1589,23 @@ void DebuggerPluginPrivate::attachCore()
|
|||||||
|
|
||||||
setConfigValue(_("LastExternalExecutableFile"), dlg.executableFile());
|
setConfigValue(_("LastExternalExecutableFile"), dlg.executableFile());
|
||||||
setConfigValue(_("LastExternalCoreFile"), dlg.coreFile());
|
setConfigValue(_("LastExternalCoreFile"), dlg.coreFile());
|
||||||
setConfigValue(_("LastExternalAbiIndex"), QVariant(dlg.abiIndex()));
|
setConfigValue(_("LastExternalProfileIndex"), QVariant(dlg.profileIndex()));
|
||||||
setConfigValue(_("LastSysroot"), dlg.sysroot());
|
|
||||||
setConfigValue(_("LastExternalStartScript"), dlg.overrideStartScript());
|
setConfigValue(_("LastExternalStartScript"), dlg.overrideStartScript());
|
||||||
|
|
||||||
|
Profile *profile = dlg.profile();
|
||||||
|
QTC_ASSERT(profile, return);
|
||||||
|
ToolChain *tc = ToolChainProfileInformation::toolChain(profile);
|
||||||
|
QTC_ASSERT(tc, return);
|
||||||
|
|
||||||
DebuggerStartParameters sp;
|
DebuggerStartParameters sp;
|
||||||
sp.executable = dlg.executableFile();
|
sp.executable = dlg.executableFile();
|
||||||
sp.coreFile = dlg.coreFile();
|
sp.coreFile = dlg.coreFile();
|
||||||
sp.displayName = tr("Core file \"%1\"").arg(dlg.coreFile());
|
sp.displayName = tr("Core file \"%1\"").arg(dlg.coreFile());
|
||||||
sp.startMode = AttachCore;
|
sp.startMode = AttachCore;
|
||||||
sp.closeMode = DetachAtClose;
|
sp.closeMode = DetachAtClose;
|
||||||
sp.debuggerCommand = dlg.debuggerCommand();
|
sp.debuggerCommand = DebuggerProfileInformation::debuggerCommand(profile).toString();
|
||||||
sp.toolChainAbi = dlg.abi();
|
sp.toolChainAbi = tc->targetAbi();
|
||||||
sp.sysroot = dlg.sysroot();
|
sp.sysroot = SysRootProfileInformation::sysRoot(profile).toString();
|
||||||
sp.overrideStartScript = dlg.overrideStartScript();
|
sp.overrideStartScript = dlg.overrideStartScript();
|
||||||
if (DebuggerRunControl *rc = createDebugger(sp))
|
if (DebuggerRunControl *rc = createDebugger(sp))
|
||||||
startDebugger(rc);
|
startDebugger(rc);
|
||||||
|
@@ -46,10 +46,6 @@
|
|||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
typedef QPair<Abi, QString> AbiDebuggerCommandPair;
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(AbiDebuggerCommandPair)
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -75,77 +71,50 @@ void DebuggerToolChainComboBox::init(bool hostAbiOnly)
|
|||||||
if (debuggerCommand.isEmpty())
|
if (debuggerCommand.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const AbiDebuggerCommandPair data(abi, debuggerCommand);
|
|
||||||
const QString completeBase = QFileInfo(debuggerCommand).completeBaseName();
|
const QString completeBase = QFileInfo(debuggerCommand).completeBaseName();
|
||||||
const QString name = tr("%1 (%2)").arg(st->displayName(), completeBase);
|
const QString name = tr("%1 (%2)").arg(st->displayName(), completeBase);
|
||||||
addItem(name, qVariantFromValue(data));
|
addItem(name, qVariantFromValue(st->id()));
|
||||||
|
QString debugger = QDir::toNativeSeparators(debuggerCommand);
|
||||||
|
debugger.replace(QString(QLatin1Char(' ')), QLatin1String(" "));
|
||||||
|
QString toolTip = tr("<html><head/><body><table>"
|
||||||
|
"<tr><td>ABI:</td><td><i>%1</i></td></tr>"
|
||||||
|
"<tr><td>Debugger:</td><td>%2</td></tr>")
|
||||||
|
.arg(st->displayName(), QDir::toNativeSeparators(debugger));
|
||||||
|
setItemData(count() - 1, toolTip, Qt::ToolTipRole);
|
||||||
}
|
}
|
||||||
setEnabled(count() > 1);
|
setEnabled(count() > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerToolChainComboBox::setAbi(const Abi &abi)
|
void DebuggerToolChainComboBox::setProfile(const Profile *profile)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(abi.isValid(), return);
|
QTC_ASSERT(profile->isValid(), return);
|
||||||
const int c = count();
|
const int c = count();
|
||||||
for (int i = 0; i < c; i++) {
|
for (int i = 0; i < c; i++) {
|
||||||
if (abiAt(i) == abi) {
|
if (profileAt(i) == profile) {
|
||||||
setCurrentIndex(i);
|
setCurrentIndex(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Abi DebuggerToolChainComboBox::abi() const
|
Profile *DebuggerToolChainComboBox::profile() const
|
||||||
{
|
{
|
||||||
return abiAt(currentIndex());
|
return profileAt(currentIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DebuggerToolChainComboBox::debuggerCommand() const
|
//QString DebuggerToolChainComboBox::debuggerCommand() const
|
||||||
{
|
//{
|
||||||
return debuggerCommandAt(currentIndex());
|
// int index = currentIndex();
|
||||||
}
|
// Core::Id id = qvariant_cast<Core::Id>(itemData(index));
|
||||||
|
// Profile *st = ProfileManager::instance()->find(id);
|
||||||
|
// QTC_ASSERT(st, return QString());
|
||||||
|
// return DebuggerProfileInformation::debuggerCommand(st).toString();
|
||||||
|
//}
|
||||||
|
|
||||||
QString DebuggerToolChainComboBox::debuggerCommandAt(int index) const
|
Profile *DebuggerToolChainComboBox::profileAt(int index) const
|
||||||
{
|
{
|
||||||
if (index >= 0 && index < count()) {
|
Core::Id id = qvariant_cast<Core::Id>(itemData(index));
|
||||||
const AbiDebuggerCommandPair abiCommandPair = qvariant_cast<AbiDebuggerCommandPair>(itemData(index));
|
return ProfileManager::instance()->find(id);
|
||||||
return abiCommandPair.second;
|
|
||||||
}
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
Abi DebuggerToolChainComboBox::abiAt(int index) const
|
|
||||||
{
|
|
||||||
if (index >= 0 && index < count()) {
|
|
||||||
const AbiDebuggerCommandPair abiCommandPair = qvariant_cast<AbiDebuggerCommandPair>(itemData(index));
|
|
||||||
return abiCommandPair.first;
|
|
||||||
}
|
|
||||||
return Abi();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline QString abiToolTip(const AbiDebuggerCommandPair &abiCommandPair)
|
|
||||||
{
|
|
||||||
QString debugger = QDir::toNativeSeparators(abiCommandPair.second);
|
|
||||||
debugger.replace(QString(QLatin1Char(' ')), QLatin1String(" "));
|
|
||||||
return DebuggerToolChainComboBox::tr(
|
|
||||||
"<html><head/><body><table><tr><td>ABI:</td><td><i>%1</i></td></tr>"
|
|
||||||
"<tr><td>Debugger:</td><td>%2</td></tr>").
|
|
||||||
arg(abiCommandPair.first.toString(),
|
|
||||||
QDir::toNativeSeparators(debugger));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DebuggerToolChainComboBox::event(QEvent *event)
|
|
||||||
{
|
|
||||||
if (event->type() == QEvent::ToolTip) {
|
|
||||||
const int index = currentIndex();
|
|
||||||
if (index >= 0) {
|
|
||||||
const AbiDebuggerCommandPair abiCommandPair = qvariant_cast<AbiDebuggerCommandPair>(itemData(index));
|
|
||||||
setToolTip(abiToolTip(abiCommandPair));
|
|
||||||
} else {
|
|
||||||
setToolTip(QString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return QComboBox::event(event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
@@ -35,32 +35,27 @@
|
|||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer { class Profile; }
|
||||||
class Abi;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
// Let the user pick a tool chain/ABI associated with a debugger.
|
// Let the user pick a profile associated with a debugger.
|
||||||
class DebuggerToolChainComboBox : public QComboBox
|
class DebuggerToolChainComboBox : public QComboBox
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DebuggerToolChainComboBox(QWidget *parent);
|
explicit DebuggerToolChainComboBox(QWidget *parent);
|
||||||
|
|
||||||
void init(bool hostAbiOnly);
|
void init(bool hostAbiOnly);
|
||||||
|
|
||||||
void setAbi(const ProjectExplorer::Abi &abi);
|
void setProfile(const ProjectExplorer::Profile *profile);
|
||||||
ProjectExplorer::Abi abi() const;
|
ProjectExplorer::Profile *profile() const;
|
||||||
QString debuggerCommand() const;
|
//QString debuggerCommand() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual bool event(QEvent *event);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString debuggerCommandAt(int index) const;
|
ProjectExplorer::Profile *profileAt(int index) const;
|
||||||
ProjectExplorer::Abi abiAt(int index) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
Reference in New Issue
Block a user