Commit ded2dd12 authored by hjk's avatar hjk

debugger: adjust to profile changes

This replaces the debugger command, sysroot and target abi fields
with a profile id.

Change-Id: I831c42ff8624fcfa520c2f28f6f06d73191b2680
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent bb31b257
......@@ -37,9 +37,10 @@
#include "androidrunner.h"
#include "androidmanager.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerplugin.h>
#include <debugger/debuggerprofileinformation.h>
#include <debugger/debuggerrunner.h>
#include <debugger/debuggerengine.h>
#include <debugger/debuggerstartparameters.h>
#include <projectexplorer/target.h>
......@@ -69,11 +70,14 @@ static Qt4Project *project(AndroidRunConfiguration *rc)
RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *runConfig)
{
DebuggerStartParameters params;
params.toolChainAbi = runConfig->abi();
Profile *profile = runConfig->target()->profile();
params.sysRoot = SysRootProfileInformation::sysRoot(profile).toString();
params.debuggerCommand = DebuggerProfileInformation::debuggerCommand(profile).toString();
if (ToolChain *tc = ToolChainProfileInformation::toolChain(profile))
params.toolChainAbi = tc->targetAbi();
params.dumperLibrary = runConfig->dumperLib();
params.startMode = AttachToRemoteServer;
params.executable = project(runConfig)->rootQt4ProjectNode()->buildDir() + QLatin1String("/app_process");
params.debuggerCommand = runConfig->gdbCmd().toString();
params.remoteChannel = runConfig->remoteChannel();
params.displayName = AndroidManager::packageName(runConfig->target());
......
......@@ -60,7 +60,7 @@
<item row="2" column="0">
<widget class="QLabel" name="toolchainLabel">
<property name="text">
<string>&amp;Tool chain:</string>
<string>&amp;Target:</string>
</property>
<property name="buddy">
<cstring>toolchainComboBox</cstring>
......@@ -68,7 +68,7 @@
</widget>
</item>
<item row="2" column="1">
<widget class="Debugger::Internal::DebuggerToolChainComboBox" name="toolchainComboBox"/>
<widget class="Debugger::ProfileChooser" name="toolchainComboBox"/>
</item>
<item row="3" column="1">
<widget class="Utils::PathChooser" name="overrideStartScriptFileName" native="true"/>
......@@ -129,7 +129,7 @@
</slots>
</customwidget>
<customwidget>
<class>Debugger::Internal::DebuggerToolChainComboBox</class>
<class>Debugger::ProfileChooser</class>
<extends>QComboBox</extends>
<header>debuggertoolchaincombobox.h</header>
</customwidget>
......
......@@ -44,7 +44,7 @@
<item row="1" column="0">
<widget class="QLabel" name="toolchainLabel">
<property name="text">
<string>&amp;Tool chain:</string>
<string>&amp;Target:</string>
</property>
<property name="buddy">
<cstring>toolchainComboBox</cstring>
......@@ -52,7 +52,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="Debugger::Internal::DebuggerToolChainComboBox" name="toolchainComboBox"/>
<widget class="Debugger::ProfileChooser" name="toolchainComboBox"/>
</item>
</layout>
</item>
......@@ -94,7 +94,7 @@
<header location="global">utils/filterlineedit.h</header>
</customwidget>
<customwidget>
<class>Debugger::Internal::DebuggerToolChainComboBox</class>
<class>Debugger::ProfileChooser</class>
<extends>QComboBox</extends>
<header>debuggertoolchaincombobox.h</header>
</customwidget>
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Debugger::Internal::AttachToQmlPortDialog</class>
<widget class="QDialog" name="Debugger::Internal::AttachToQmlPortDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>212</width>
<height>136</height>
</rect>
</property>
<property name="windowTitle">
<string>Start Debugger</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="hostLabel">
<property name="text">
<string>&amp;Host:</string>
</property>
<property name="buddy">
<cstring>hostLineEdit</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="hostLineEdit">
<property name="text">
<string notr="true">localhost</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="portLabel">
<property name="text">
<string>&amp;Port:</string>
</property>
<property name="buddy">
<cstring>portSpinBox</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="portSpinBox">
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>3768</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="sysrootLabel">
<property name="text">
<string>Sys&amp;root:</string>
</property>
<property name="buddy">
<cstring>sysRootChooser</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Utils::PathChooser" name="sysRootChooser" native="true"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
<slots>
<signal>editingFinished()</signal>
<signal>browsingFinished()</signal>
</slots>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
......@@ -368,24 +368,13 @@ static inline bool isMsvcFlavor(Abi::OSFlavor osf)
|| osf == Abi::WindowsMsvc2010Flavor;
}
static QString cdbBinary(const DebuggerStartParameters &sp)
{
if (!sp.debuggerCommand.isEmpty()) {
// Do not use a GDB binary if we got started for a project with MinGW runtime.
const bool abiMatch = sp.toolChainAbi.os() == Abi::WindowsOS
&& isMsvcFlavor(sp.toolChainAbi.osFlavor());
if (abiMatch)
return sp.debuggerCommand;
}
return debuggerCore()->debuggerForAbi(sp.toolChainAbi, CdbEngineType);
}
bool checkCdbConfiguration(const DebuggerStartParameters &sp, ConfigurationCheck *check)
{
#ifdef Q_OS_WIN
const Abi abi = toolChainAbi(sp);
if (!isCdbEngineEnabled()) {
check->errorDetails.push_back(CdbEngine::tr("The CDB debug engine required for %1 is currently disabled.").
arg(sp.toolChainAbi.toString()));
arg(abi.toString()));
check->settingsCategory = QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
check->settingsPage = CdbOptionsPage::settingsId();
return false;
......@@ -396,19 +385,19 @@ bool checkCdbConfiguration(const DebuggerStartParameters &sp, ConfigurationCheck
return false;
}
if (sp.toolChainAbi.binaryFormat() != Abi::PEFormat || sp.toolChainAbi.os() != Abi::WindowsOS) {
if (abi.binaryFormat() != Abi::PEFormat || abi.os() != Abi::WindowsOS) {
check->errorDetails.push_back(CdbEngine::tr("The CDB debug engine does not support the %1 ABI.").
arg(sp.toolChainAbi.toString()));
arg(abi.toString()));
return false;
}
if (sp.startMode == AttachCore && !isMsvcFlavor(sp.toolChainAbi.osFlavor())) {
if (sp.startMode == AttachCore && !isMsvcFlavor(abi.osFlavor())) {
check->errorDetails.push_back(CdbEngine::tr("The CDB debug engine cannot debug gdb core files."));
return false;
}
if (cdbBinary(sp).isEmpty()) {
check->errorDetails.push_back(msgNoCdbBinaryForToolChain(sp.toolChainAbi));
if (debuggerCommand(sp).isEmpty()) {
check->errorDetails.push_back(msgNoCdbBinaryForToolChain(abi));
check->settingsCategory = QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY);
check->settingsPage = QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY);
return false;
......@@ -722,7 +711,7 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
// Determine binary (force MSVC), extension lib name and path to use
// The extension is passed as relative name with the path variable set
//(does not work with absolute path names)
const QString executable = cdbBinary(sp);
const QString executable = sp.debuggerCommand;
if (executable.isEmpty()) {
*errorMessage = tr("There is no CDB executable specified.");
return false;
......
......@@ -143,8 +143,7 @@ FORMS += attachexternaldialog.ui \
commonoptionspage.ui \
startexternaldialog.ui \
startremotedialog.ui \
startremoteenginedialog.ui \
attachtoqmlportdialog.ui
startremoteenginedialog.ui
RESOURCES += debugger.qrc
......
......@@ -42,7 +42,6 @@ QtcPlugin {
"debuggerprofileinformation.h",
"attachcoredialog.ui",
"attachexternaldialog.ui",
"attachtoqmlportdialog.ui",
"basewindow.cpp",
"breakhandler.cpp",
"breakhandler.h",
......
......@@ -110,8 +110,8 @@ public:
virtual bool initialize(const QStringList &arguments, QString *errorMessage) = 0;
virtual QWidget *mainWindow() const = 0;
virtual bool isDockVisible(const QString &objectName) const = 0;
virtual QString debuggerForAbi(const ProjectExplorer::Abi &abi,
DebuggerEngineType et = NoEngineType) const = 0;
// virtual QString debuggerForAbi(const ProjectExplorer::Abi &abi,
// DebuggerEngineType et = NoEngineType) const = 0;
virtual void showModuleSymbols(const QString &moduleName,
const QVector<Symbol> &symbols) = 0;
virtual void openMemoryEditor() = 0;
......
......@@ -36,6 +36,7 @@
#include "debuggerconstants.h"
#include "debuggerprofileinformation.h"
#include "debuggerstringutils.h"
#include "debuggertoolchaincombobox.h"
#include "cdb/cdbengine.h"
#include "shared/hostutils.h"
......@@ -44,31 +45,40 @@
#include "ui_startexternaldialog.h"
#include "ui_startremotedialog.h"
#include "ui_startremoteenginedialog.h"
#include "ui_attachtoqmlportdialog.h"
#include <coreplugin/icore.h>
#include <projectexplorer/abi.h>
#include <projectexplorer/profileinformation.h>
#include <utils/historycompleter.h>
#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
#include <utils/synchronousprocess.h>
#include <QAction>
#include <QApplication>
#include <QButtonGroup>
#include <QCoreApplication>
#include <QDebug>
#include <QDialog>
#include <QDialogButtonBox>
#include <QDir>
#include <QRegExp>
#include <QButtonGroup>
#include <QFileDialog>
#include <QFormLayout>
#include <QGridLayout>
#include <QGroupBox>
#include <QHeaderView>
#include <QLabel>
#include <QLineEdit>
#include <QMessageBox>
#include <QPushButton>
#include <QRadioButton>
#include <QRegExp>
#include <QScrollArea>
#include <QSortFilterProxyModel>
#include <QSpinBox>
#include <QStandardItemModel>
#include <QGridLayout>
#include <QVariant>
#include <QVBoxLayout>
using namespace ProjectExplorer;
using namespace Utils;
......@@ -232,9 +242,9 @@ void AttachCoreDialog::setCoreFile(const QString &fileName)
changed();
}
Profile *AttachCoreDialog::profile() const
Core::Id AttachCoreDialog::profileId() const
{
return m_ui->toolchainComboBox->currentProfile();
return m_ui->toolchainComboBox->currentProfileId();
}
void AttachCoreDialog::setProfileIndex(int i)
......@@ -379,9 +389,9 @@ QString AttachExternalDialog::executable() const
return m_model->executableForPid(attachPIDText());
}
Profile *AttachExternalDialog::profile() const
Core::Id AttachExternalDialog::profileId() const
{
return m_ui->toolchainComboBox->currentProfile();
return m_ui->toolchainComboBox->currentProfileId();
}
void AttachExternalDialog::setProfileIndex(int i)
......@@ -587,9 +597,9 @@ QString StartExternalDialog::executableFile() const
return m_ui->execFile->path();
}
Profile *StartExternalDialog::profile() const
Core::Id StartExternalDialog::profileId() const
{
return m_ui->toolChainComboBox->currentProfile();
return m_ui->toolChainComboBox->currentProfileId();
}
bool StartExternalDialog::isValid() const
......@@ -670,28 +680,14 @@ bool StartExternalDialog::run(QWidget *parent,
writeParameterHistory(history, settings, settingsGroup, arrayName);
}
Profile *profile = dialog.profile();
QTC_ASSERT(profile, return false);
ToolChain *tc = ToolChainProfileInformation::toolChain(profile);
QTC_ASSERT(tc, return false);
fillParameters(sp, dialog.profileId());
sp->executable = newParameters.executableFile;
sp->startMode = StartExternal;
sp->toolChainAbi = tc->targetAbi();
sp->debuggerCommand = DebuggerProfileInformation::debuggerCommand(profile).toString();
sp->workingDirectory = newParameters.workingDirectory;
sp->displayName = sp->executable;
sp->useTerminal = newParameters.runInTerminal;
if (!newParameters.arguments.isEmpty())
sp->processArgs = newParameters.arguments;
// Fixme: 1 of 3 testing hacks.
if (sp->processArgs.startsWith(QLatin1String("@tcf@ ")) || sp->processArgs.startsWith(QLatin1String("@sym@ ")))
// Set up an ARM Symbian Abi
sp->toolChainAbi = Abi(Abi::ArmArchitecture,
Abi::SymbianOS,
Abi::SymbianDeviceFlavor,
Abi::ElfFormat, false);
sp->breakOnMain = newParameters.breakAtMain;
return true;
}
......@@ -847,17 +843,11 @@ bool StartRemoteDialog::run(QWidget *parent,
writeParameterHistory(history, settings, settingsGroup, arrayName);
}
Profile *profile = dialog.profile();
QTC_ASSERT(profile, return false);
ToolChain *tc = ToolChainProfileInformation::toolChain(profile);
QTC_ASSERT(tc, return false);
fillParameters(sp, dialog.profileId());
sp->remoteChannel = newParameters.remoteChannel;
sp->remoteArchitecture = newParameters.remoteArchitecture;
sp->executable = newParameters.localExecutable;
sp->displayName = tr("Remote: \"%1\"").arg(sp->remoteChannel);
sp->debuggerCommand = DebuggerProfileInformation::debuggerCommand(profile).toString();
sp->toolChainAbi = tc->targetAbi();
sp->overrideStartScript = newParameters.overrideStartScript;
sp->useServerStartScript = newParameters.useServerStartScript;
sp->serverStartScript = newParameters.serverStartScript;
......@@ -911,9 +901,9 @@ void StartRemoteDialog::historyIndexChanged(int index)
setParameters(v.value<StartRemoteParameters>());
}
Profile *StartRemoteDialog::profile() const
Core::Id StartRemoteDialog::profileId() const
{
return m_ui->toolchainComboBox->currentProfile();
return m_ui->toolchainComboBox->currentProfileId();
}
void StartRemoteDialog::setRemoteArchitectures(const QStringList &list)
......@@ -938,51 +928,97 @@ void StartRemoteDialog::updateState()
//
///////////////////////////////////////////////////////////////////////
class AttachToQmlPortDialogPrivate
{
public:
QLabel *hostLabel;
QLineEdit *hostLineEdit;
QLabel *portLabel;
QSpinBox *portSpinBox;
QLabel *profileLabel;
Debugger::ProfileChooser *profileChooser;
};
AttachToQmlPortDialog::AttachToQmlPortDialog(QWidget *parent)
: QDialog(parent),
m_ui(new Ui::AttachToQmlPortDialog)
d(new AttachToQmlPortDialogPrivate)
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui->setupUi(this);
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
setWindowTitle(tr("Start Debugger"));
connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
d->hostLineEdit = new QLineEdit(this);
d->hostLineEdit->setText(QString::fromUtf8("localhost"));
d->hostLabel = new QLabel(this);
d->hostLabel->setText(tr("&Host:"));
d->hostLabel->setBuddy(d->hostLineEdit);
d->portSpinBox = new QSpinBox(this);
d->portSpinBox->setMaximum(65535);
d->portSpinBox->setValue(3768);
d->portLabel = new QLabel(this);
d->portLabel->setText(tr("&Port:"));
d->portLabel->setBuddy(d->portSpinBox);
d->profileChooser = new Debugger::ProfileChooser(this);
d->profileLabel = new QLabel(this);
d->profileLabel->setText(tr("Target:"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
QFormLayout *formLayout = new QFormLayout();
formLayout->addRow(d->hostLabel, d->hostLineEdit);
formLayout->addRow(d->portLabel, d->portSpinBox);
formLayout->addRow(d->profileLabel, d->profileChooser);
verticalLayout->addLayout(formLayout);
verticalLayout->addWidget(buttonBox);
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
AttachToQmlPortDialog::~AttachToQmlPortDialog()
{
delete m_ui;
delete d;
}
void AttachToQmlPortDialog::setHost(const QString &host)
{
m_ui->hostLineEdit->setText(host);
d->hostLineEdit->setText(host);
}
QString AttachToQmlPortDialog::host() const
{
return m_ui->hostLineEdit->text();
return d->hostLineEdit->text();
}
void AttachToQmlPortDialog::setPort(const int port)
{
m_ui->portSpinBox->setValue(port);
d->portSpinBox->setValue(port);
}
int AttachToQmlPortDialog::port() const
{
return m_ui->portSpinBox->value();
return d->portSpinBox->value();
}
QString AttachToQmlPortDialog::sysroot() const
Core::Id AttachToQmlPortDialog::profileId() const
{
return m_ui->sysRootChooser->path();
return d->profileChooser->currentProfileId();
}
void AttachToQmlPortDialog::setSysroot(const QString &sysroot)
void AttachToQmlPortDialog::setProfileId(const Core::Id &id)
{
m_ui->sysRootChooser->setPath(sysroot);
d->profileChooser->setCurrentProfileId(id);
}
// --------- StartRemoteCdbDialog
......
......@@ -45,6 +45,7 @@ class QDialogButtonBox;
class QSettings;
QT_END_NAMESPACE
namespace Core { class Id; }
namespace ProjectExplorer { class Profile; }
namespace Debugger {
......@@ -57,13 +58,13 @@ class AttachCoreDialog;
class AttachExternalDialog;
class StartExternalDialog;
class StartRemoteDialog;
class AttachToQmlPortDialog;
class StartRemoteEngineDialog;
} // namespace Ui
class ProcessListFilterModel;
class StartExternalParameters;
class StartRemoteParameters;
class AttachToQmlPortDialogPrivate;
class AttachCoreDialog : public QDialog
{
......@@ -81,7 +82,7 @@ public:
int profileIndex() const;
void setProfileIndex(int);
ProjectExplorer::Profile *profile() const;
Core::Id profileId() const;
QString overrideStartScript() const;
void setOverrideStartScript(const QString &scriptName);
......@@ -108,7 +109,7 @@ public:
int profileIndex() const;
void setProfileIndex(int);
ProjectExplorer::Profile *profile() const;
Core::Id profileId() const;
void accept();
......@@ -150,7 +151,7 @@ private:
QString executableFile() const;
void setExecutableFile(const QString &executable);
ProjectExplorer::Profile *profile() const;
Core::Id profileId() const;
bool isValid() const;
Ui::StartExternalDialog *m_ui;
......@@ -178,7 +179,7 @@ private:
void setRemoteArchitectures(const QStringList &list);
ProjectExplorer::Profile *profile() const;
Core::Id profileId() const;
Ui::StartRemoteDialog *m_ui;
};
......@@ -197,11 +198,11 @@ public:
int port() const;
void setPort(const int port);
QString sysroot() const;
void setSysroot(const QString &sysroot);
Core::Id profileId() const;
void setProfileId(const Core::Id &id);
private:
Ui::AttachToQmlPortDialog *m_ui;
AttachToQmlPortDialogPrivate *d;
};
class StartRemoteCdbDialog : public QDialog
......
......@@ -185,8 +185,6 @@ public:
m_taskHub(0)
{
connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation()));
if (sp.toolChainAbi.os() == Abi::MacOS)
m_disassemblerAgent.setTryMixed(false);
}
~DebuggerEnginePrivate() {}
......@@ -1321,9 +1319,10 @@ DebuggerLanguages DebuggerEngine::languages() const
QString DebuggerEngine::toFileInProject(const QUrl &fileUrl)
{
// make sure file finder is properly initialized
d->m_fileFinder.setProjectDirectory(startParameters().projectSourceDirectory);
d->m_fileFinder.setProjectFiles(startParameters().projectSourceFiles);
d->m_fileFinder.setSysroot(startParameters().sysroot);
const DebuggerStartParameters &sp = startParameters();
d->m_fileFinder.setProjectDirectory(sp.projectSourceDirectory);
d->m_fileFinder.setProjectFiles(sp.projectSourceFiles);
d->m_fileFinder.setSysroot(sp.sysRoot);
return d->m_fileFinder.findFile(fileUrl);
}
......
This diff is collapsed.
......@@ -158,7 +158,7 @@ static inline QString msgEngineNotAvailable(DebuggerEngineType et)
//
////////////////////////////////////////////////////////////////////////
class DebuggerRunConfigWidget : public ProjectExplorer::RunConfigWidget
class DebuggerRunConfigWidget : public RunConfigWidget
{
Q_OBJECT
......@@ -323,7 +323,7 @@ DebuggerRunControlPrivate::DebuggerRunControlPrivate(DebuggerRunControl *parent,
DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration,
const DebuggerStartParameters &sp,
const QPair<DebuggerEngineType, DebuggerEngineType> &masterSlaveEngineTypes)
: RunControl(runConfiguration, ProjectExplorer::DebugRunMode),
: RunControl(runConfiguration, DebugRunMode),
d(new DebuggerRunControlPrivate(this, runConfiguration))
{
connect(this, SIGNAL(finished()), SLOT(handleFinished()));
......@@ -671,12 +671,6 @@ static QList<DebuggerEngineType> engineTypes(const DebuggerStartParameters &sp)
return result;
}
// FIXME: 1 of 3 testing hacks.
if (sp.processArgs.startsWith(QLatin1String("@tcf@ "))) {
result.push_back(GdbEngineType);
return result;
}
if (sp.startMode != AttachToRemoteServer
&& sp.startMode != AttachToRemoteProcess
&& sp.startMode != LoadRemoteCore
......@@ -743,8 +737,9 @@ static inline bool canUseEngine(DebuggerEngineType et,
DEBUGGER_EXPORT ConfigurationCheck checkDebugConfiguration(const DebuggerStartParameters &sp)
{