Commit 7effd0e2 authored by Friedemann Kleint's avatar Friedemann Kleint

Debugger: Work towards having a debugger setting per toolchain.

Rubber-stamped-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
Rubber-stamped-by: hjk
parent e8106899
......@@ -54,8 +54,9 @@ namespace ProjectExplorer {
// Helpers:
// --------------------------------------------------------------------------
static const char *const COMPILER_PATH_KEY = "ProjectExplorer.GccToolChain.Path";
static const char *const FORCE_32BIT_KEY = "ProjectExplorer.GccToolChain.Force32Bit";
static const char compilerPathKeyC[] = "ProjectExplorer.GccToolChain.Path";
static const char force32bitKeyC[] = "ProjectExplorer.GccToolChain.Force32Bit";
static const char debuggerCommandKeyC[] = "ProjectExplorer.GccToolChain.Debugger";
static QByteArray runGcc(const QString &gcc, const QStringList &arguments, const QStringList &env)
{
......@@ -323,6 +324,16 @@ void GccToolChain::addToEnvironment(Utils::Environment &env) const
env.prependOrSetPath(QFileInfo(m_compilerPath).absolutePath());
}
void GccToolChain::setDebuggerCommand(const QString &d)
{
m_debuggerCommand = d;
}
QString GccToolChain::debuggerCommand() const
{
return m_debuggerCommand;
}
QString GccToolChain::makeCommand() const
{
return QLatin1String("make");
......@@ -387,8 +398,9 @@ ToolChain *GccToolChain::clone() const
QVariantMap GccToolChain::toMap() const
{
QVariantMap data = ToolChain::toMap();
data.insert(QLatin1String(COMPILER_PATH_KEY), m_compilerPath);
data.insert(QLatin1String(FORCE_32BIT_KEY), m_forcedTo32Bit);
data.insert(QLatin1String(compilerPathKeyC), m_compilerPath);
data.insert(QLatin1String(force32bitKeyC), m_forcedTo32Bit);
data.insert(QLatin1String(debuggerCommandKeyC), m_debuggerCommand);
return data;
}
......@@ -397,8 +409,9 @@ bool GccToolChain::fromMap(const QVariantMap &data)
if (!ToolChain::fromMap(data))
return false;
m_compilerPath = data.value(QLatin1String(COMPILER_PATH_KEY)).toString();
m_forcedTo32Bit = data.value(QLatin1String(FORCE_32BIT_KEY)).toBool();
m_compilerPath = data.value(QLatin1String(compilerPathKeyC)).toString();
m_forcedTo32Bit = data.value(QLatin1String(force32bitKeyC)).toBool();
m_debuggerCommand = data.value(QLatin1String(debuggerCommandKeyC)).toString();
return true;
}
......@@ -408,7 +421,8 @@ bool GccToolChain::operator ==(const ToolChain &other) const
return false;
const GccToolChain *gccTc = static_cast<const GccToolChain *>(&other);
return m_compilerPath == gccTc->m_compilerPath && m_forcedTo32Bit == gccTc->m_forcedTo32Bit;
return m_compilerPath == gccTc->m_compilerPath && m_forcedTo32Bit == gccTc->m_forcedTo32Bit
&& m_debuggerCommand == gccTc->m_debuggerCommand;
}
ToolChainConfigWidget *GccToolChain::configurationWidget()
......@@ -511,16 +525,19 @@ Internal::GccToolChainConfigWidget::GccToolChainConfigWidget(GccToolChain *tc) :
{
Q_ASSERT(tc);
const QStringList gnuVersionArgs = QStringList(QLatin1String("--version"));
m_compilerPath->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_compilerPath->setCommandVersionArguments(QStringList(QLatin1String("--version")));
m_compilerPath->setCommandVersionArguments(gnuVersionArgs);
connect(m_compilerPath, SIGNAL(changed(QString)), this, SLOT(handlePathChange()));
QFormLayout *layout = new QFormLayout(this);
layout->addRow(tr("Compiler path:"), m_compilerPath);
layout->addRow(tr("Force 32bit compilation:"), m_force32BitCheckBox);
layout->addRow(tr("&Compiler path:"), m_compilerPath);
layout->addRow(tr("&Force 32bit compilation:"), m_force32BitCheckBox);
connect(m_force32BitCheckBox, SIGNAL(toggled(bool)), this, SLOT(handle32BitChange()));
addDebuggerCommandControls(layout, gnuVersionArgs);
discard();
}
......@@ -538,6 +555,7 @@ void Internal::GccToolChainConfigWidget::apply()
tc->forceTo32Bit(m_force32BitCheckBox->isChecked());
tc->setCompilerPath(path);
tc->setDisplayName(displayName); // reset display name
tc->setDebuggerCommand(debuggerCommand());
}
void Internal::GccToolChainConfigWidget::discard()
......@@ -547,6 +565,7 @@ void Internal::GccToolChainConfigWidget::discard()
m_compilerPath->setPath(tc->compilerPath());
m_force32BitCheckBox->setChecked(tc->isForcedTo32Bit());
m_force32BitCheckBox->setEnabled(tc->supports64Bit());
setDebuggerCommand(tc->debuggerCommand());
}
bool Internal::GccToolChainConfigWidget::isDirty() const
......
......@@ -70,6 +70,8 @@ public:
QList<HeaderPath> systemHeaderPaths() const;
void addToEnvironment(Utils::Environment &env) const;
QString makeCommand() const;
void setDebuggerCommand(const QString &);
QString debuggerCommand() const;
IOutputParser *outputParser() const;
QVariantMap toMap() const;
......@@ -103,6 +105,7 @@ private:
GccToolChain(bool autodetect);
QString m_compilerPath;
QString m_debuggerCommand;
bool m_forcedTo32Bit;
mutable bool m_supports64Bit;
......
......@@ -39,6 +39,7 @@
#include <projectexplorer/projectexplorersettings.h>
#include <utils/qtcprocess.h>
#include <utils/qtcassert.h>
#include <utils/synchronousprocess.h>
#include <QtCore/QCoreApplication>
......@@ -47,7 +48,9 @@
#include <QtCore/QSettings>
#include <QtCore/QTemporaryFile>
#include <QtGui/QLabel>
#include <QtGui/QVBoxLayout>
#include <QtGui/QFormLayout>
static const char debuggerCommandKeyC[] = "ProjectExplorer.MsvcToolChain.Debugger";
namespace ProjectExplorer {
namespace Internal {
......@@ -362,6 +365,32 @@ QString MsvcToolChain::makeCommand() const
return QLatin1String("nmake.exe");
}
void MsvcToolChain::setDebuggerCommand(const QString &d)
{
m_debuggerCommand = d;
}
QString MsvcToolChain::debuggerCommand() const
{
return m_debuggerCommand;
}
QVariantMap MsvcToolChain::toMap() const
{
QVariantMap data = ToolChain::toMap();
data.insert(QLatin1String(debuggerCommandKeyC), m_debuggerCommand);
return data;
}
bool MsvcToolChain::fromMap(const QVariantMap &data)
{
if (!ToolChain::fromMap(data))
return false;
m_debuggerCommand= data.value(QLatin1String(debuggerCommandKeyC)).toString();
return true;
}
IOutputParser *MsvcToolChain::outputParser() const
{
return new MsvcParser;
......@@ -389,25 +418,30 @@ ToolChain *MsvcToolChain::clone() const
MsvcToolChainConfigWidget::MsvcToolChainConfigWidget(ToolChain *tc) :
ToolChainConfigWidget(tc)
{
QLabel *label = new QLabel;
label->setText(tc->displayName());
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(label);
QFormLayout *formLayout = new QFormLayout(this);
formLayout->addRow(new QLabel(tc->displayName()));
addDebuggerCommandControls(formLayout);
}
void MsvcToolChainConfigWidget::apply()
{
// Nothing to apply!
MsvcToolChain *tc = static_cast<MsvcToolChain *>(toolChain());
QTC_ASSERT(tc, return; );
tc->setDebuggerCommand(debuggerCommand());
}
void MsvcToolChainConfigWidget::discard()
{
// Nothing to apply!
MsvcToolChain *tc = static_cast<MsvcToolChain *>(toolChain());
QTC_ASSERT(tc, return);
setDebuggerCommand(tc->debuggerCommand());
}
bool MsvcToolChainConfigWidget::isDirty() const
{
return false;
MsvcToolChain *tc = static_cast<MsvcToolChain *>(toolChain());
QTC_ASSERT(tc, return false);
return debuggerCommand() != tc->debuggerCommand();
}
// --------------------------------------------------------------------------
......
......@@ -64,8 +64,13 @@ public:
QList<HeaderPath> systemHeaderPaths() const;
void addToEnvironment(Utils::Environment &env) const;
QString makeCommand() const;
void setDebuggerCommand(const QString &d);
virtual QString debuggerCommand() const;
IOutputParser *outputParser() const;
virtual QVariantMap toMap() const;
virtual bool fromMap(const QVariantMap &data);
ToolChainConfigWidget *configurationWidget();
bool canClone() const;
......@@ -74,6 +79,7 @@ public:
private:
QString m_varsBat; // Script to setup environment
QString m_varsBatArg; // Argument
QString m_debuggerCommand;
mutable QByteArray m_predefinedMacros;
mutable Utils::Environment m_lastEnvironment;
mutable Utils::Environment m_resultEnvironment;
......
......@@ -115,6 +115,8 @@ public:
virtual QList<HeaderPath> systemHeaderPaths() const = 0;
virtual void addToEnvironment(Utils::Environment &env) const = 0;
virtual QString makeCommand() const = 0;
virtual QString debuggerCommand() const = 0;
virtual QString defaultMakeTarget() const;
virtual IOutputParser *outputParser() const = 0;
......
......@@ -35,6 +35,13 @@
#include "toolchain.h"
#include <utils/qtcassert.h>
#include <utils/pathchooser.h>
#include <QtGui/QFormLayout>
#include <QtGui/QGridLayout>
#include <QtGui/QLabel>
namespace ProjectExplorer {
namespace Internal {
......@@ -46,12 +53,15 @@ class ToolChainConfigWidgetPrivate
{
public:
ToolChainConfigWidgetPrivate(ToolChain *tc) :
m_toolChain(tc)
m_toolChain(tc), m_debuggerPathChooser(0)
{
Q_ASSERT(tc);
}
ToolChain *m_toolChain;
Utils::PathChooser *m_debuggerPathChooser;
};
} // namespace Internal
......@@ -62,7 +72,8 @@ public:
ToolChainConfigWidget::ToolChainConfigWidget(ToolChain *tc) :
m_d(new Internal::ToolChainConfigWidgetPrivate(tc))
{ }
{
}
void ToolChainConfigWidget::setDisplayName(const QString &name)
{
......@@ -74,4 +85,50 @@ ToolChain *ToolChainConfigWidget::toolChain() const
return m_d->m_toolChain;
}
void ToolChainConfigWidget::emitDirty()
{
emit dirty(toolChain());
}
void ToolChainConfigWidget::addDebuggerCommandControls(QFormLayout *lt,
const QStringList &versionArguments)
{
ensureDebuggerPathChooser(versionArguments);
lt->addRow(tr("&Debugger:"), m_d->m_debuggerPathChooser);
}
void ToolChainConfigWidget::addDebuggerCommandControls(QGridLayout *lt,
int row, int column,
const QStringList &versionArguments)
{
ensureDebuggerPathChooser(versionArguments);
QLabel *label = new QLabel(tr("&Debugger:"));
label->setBuddy(m_d->m_debuggerPathChooser);
lt->addWidget(label, row, column);
lt->addWidget(m_d->m_debuggerPathChooser, row, column + 1);
}
void ToolChainConfigWidget::ensureDebuggerPathChooser(const QStringList &versionArguments)
{
if (m_d->m_debuggerPathChooser)
return;
m_d->m_debuggerPathChooser = new Utils::PathChooser;
if (!versionArguments.isEmpty())
m_d->m_debuggerPathChooser->setCommandVersionArguments(versionArguments);
m_d->m_debuggerPathChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
connect(m_d->m_debuggerPathChooser, SIGNAL(changed(QString)), this, SLOT(emitDirty()));
}
QString ToolChainConfigWidget::debuggerCommand() const
{
QTC_ASSERT(m_d->m_debuggerPathChooser, return QString(); )
return m_d->m_debuggerPathChooser->path();
}
void ToolChainConfigWidget::setDebuggerCommand(const QString &d)
{
QTC_ASSERT(m_d->m_debuggerPathChooser, return; )
m_d->m_debuggerPathChooser->setPath(d);
}
} // namespace ProjectExplorer
......@@ -38,6 +38,9 @@
#include <QtGui/QWidget>
QT_FORWARD_DECLARE_CLASS(QFormLayout)
QT_FORWARD_DECLARE_CLASS(QGridLayout)
namespace ProjectExplorer {
namespace Internal {
......@@ -68,7 +71,22 @@ public:
signals:
void dirty(ProjectExplorer::ToolChain *);
protected slots:
void emitDirty();
protected:
void addDebuggerCommandControls(QFormLayout *lt,
const QStringList &versionArguments = QStringList());
void addDebuggerCommandControls(QGridLayout *lt,
int row = 0, int column = 0,
const QStringList &versionArguments = QStringList());
QString debuggerCommand() const;
void setDebuggerCommand(const QString &d);
private:
void ensureDebuggerPathChooser(const QStringList &versionArguments);
Internal::ToolChainConfigWidgetPrivate *m_d;
};
......
......@@ -57,9 +57,10 @@ static const char *const RVCT_BINARY = "armcc";
static const char *const RVCT_LICENSE_KEY = "ARMLMD_LICENSE_FILE";
static const char *const RVCT_PATH_KEY = "Qt4ProjectManager.RvctToolChain.CompilerPath";
static const char *const RVCT_ENVIRONMENT_KEY = "Qt4ProjectManager.RvctToolChain.Environment";
static const char *const RVCT_ARM_VERSION_KEY = "Qt4ProjectManager.RvctToolChain.ArmVersion";
static const char rvctPathKeyC[] = "Qt4ProjectManager.RvctToolChain.CompilerPath";
static const char rvctEnvironmentKeyC[] = "Qt4ProjectManager.RvctToolChain.Environment";
static const char rvctArmVersionKeyC[] = "Qt4ProjectManager.RvctToolChain.ArmVersion";
static const char debuggerCommandKeyC[] = "Qt4ProjectManager.RvctToolChain.Debugger";
static QString valueOf(const QList<Utils::EnvironmentItem> &items, const QString &suffix)
{
......@@ -239,7 +240,8 @@ bool RvctToolChain::operator ==(const ToolChain &other) const
const RvctToolChain *otherPtr = dynamic_cast<const RvctToolChain *>(&other);
return m_compilerPath == otherPtr->m_compilerPath
&& m_environmentChanges == otherPtr->m_environmentChanges
&& m_armVersion == otherPtr->m_armVersion;
&& m_armVersion == otherPtr->m_armVersion
&& m_debuggerCommand == otherPtr->m_debuggerCommand;
}
void RvctToolChain::setEnvironmentChanges(const QList<Utils::EnvironmentItem> &changes)
......@@ -267,6 +269,16 @@ QString RvctToolChain::compilerPath() const
return m_compilerPath;
}
void RvctToolChain::setDebuggerCommand(const QString &d)
{
m_debuggerCommand = d;
}
QString RvctToolChain::debuggerCommand() const
{
return m_debuggerCommand;
}
void RvctToolChain::setArmVersion(RvctToolChain::ArmVersion av)
{
m_armVersion = av;
......@@ -296,12 +308,13 @@ ProjectExplorer::ToolChain *RvctToolChain::clone() const
QVariantMap RvctToolChain::toMap() const
{
QVariantMap result = ToolChain::toMap();
result.insert(QLatin1String(RVCT_PATH_KEY), m_compilerPath);
result.insert(QLatin1String(rvctPathKeyC), m_compilerPath);
QVariantMap tmp;
foreach (const Utils::EnvironmentItem &i, m_environmentChanges)
tmp.insert(i.name, i.value);
result.insert(QLatin1String(RVCT_ENVIRONMENT_KEY), tmp);
result.insert(QLatin1String(RVCT_ARM_VERSION_KEY), static_cast<int>(m_armVersion));
result.insert(QLatin1String(rvctEnvironmentKeyC), tmp);
result.insert(QLatin1String(rvctArmVersionKeyC), static_cast<int>(m_armVersion));
result.insert(QLatin1String(debuggerCommandKeyC), m_debuggerCommand);
return result;
}
......@@ -309,14 +322,14 @@ bool RvctToolChain::fromMap(const QVariantMap &data)
{
if (!ToolChain::fromMap(data))
return false;
m_compilerPath = data.value(QLatin1String(RVCT_PATH_KEY)).toString();
m_compilerPath = data.value(QLatin1String(rvctPathKeyC)).toString();
m_environmentChanges.clear();
QVariantMap tmp = data.value(QLatin1String(RVCT_ENVIRONMENT_KEY)).toMap();
QVariantMap tmp = data.value(QLatin1String(rvctEnvironmentKeyC)).toMap();
for (QVariantMap::const_iterator i = tmp.constBegin(); i != tmp.constEnd(); ++i)
m_environmentChanges.append(Utils::EnvironmentItem(i.key(), i.value().toString()));
m_armVersion = static_cast<ArmVersion>(data.value(QLatin1String(RVCT_ARM_VERSION_KEY), 0).toInt());
m_armVersion = static_cast<ArmVersion>(data.value(QLatin1String(rvctArmVersionKeyC), 0).toInt());
m_debuggerCommand = data.value(QLatin1String(debuggerCommandKeyC)).toString();
return isValid();
}
......@@ -341,6 +354,7 @@ RvctToolChainConfigWidget::RvctToolChainConfigWidget(RvctToolChain *tc) :
m_model(new Utils::EnvironmentModel(this))
{
m_ui->setupUi(this);
addDebuggerCommandControls(m_ui->formLayout, QStringList(QLatin1String("--version")));
m_ui->environmentView->setModel(m_model);
m_ui->environmentView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
......
......@@ -95,6 +95,9 @@ public:
void setCompilerPath(const QString &path);
QString compilerPath() const;
void setDebuggerCommand(const QString &d);
virtual QString debuggerCommand() const;
void setArmVersion(ArmVersion);
ArmVersion armVersion() const;
......@@ -119,6 +122,7 @@ private:
QList<Utils::EnvironmentItem> m_environmentChanges;
ArmVersion m_armVersion;
mutable RvctVersion m_version;
QString m_debuggerCommand;
friend class RvctToolChainFactory;
};
......
......@@ -7,33 +7,26 @@
<x>0</x>
<y>0</y>
<width>399</width>
<height>302</height>
<height>318</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="armVersionLabel">
<property name="text">
<string>Compiler path:</string>
<string>ARM &amp;version:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="compilerPath"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>ARM version:</string>
<property name="buddy">
<cstring>versionComboBox</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<widget class="QComboBox" name="versionComboBox">
<item>
<property name="text">
......@@ -47,6 +40,19 @@
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="compilerPathLabel">
<property name="text">
<string>&amp;Compiler path:</string>
</property>
<property name="buddy">
<cstring>compilerPath</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Utils::PathChooser" name="compilerPath"/>
</item>
</layout>
</item>
<item>
......@@ -66,15 +72,17 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Environment variables:</string>
<widget class="QGroupBox" name="envGroupBox">
<property name="title">
<string>Environment Variables</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableView" name="environmentView"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTableView" name="environmentView"/>
</item>
</layout>
</widget>
<customwidgets>
......
......@@ -46,9 +46,9 @@
namespace Qt4ProjectManager {
namespace Internal {
static const char *const WINSCW_COMPILER_PATH_KEY = "Qt4ProjectManager.Winscw.CompilerPath";
static const char *const WINSCW_SYSTEM_INCLUDE_PATH_KEY = "Qt4ProjectManager.Winscw.IncludePath";
static const char *const WINSCW_SYSTEM_LIBRARY_PATH_KEY = "Qt4ProjectManager.Winscw.LibraryPath";
static const char winscwCompilerPathKeyC[] = "Qt4ProjectManager.Winscw.CompilerPath";
static const char winscwSystemIncludePathKeyC[] = "Qt4ProjectManager.Winscw.IncludePath";
static const char winscwSystemLibraryPathKeyC[] = "Qt4ProjectManager.Winscw.LibraryPath";
static const char *const WINSCW_DEFAULT_SYSTEM_INCLUDES[] = {
"/MSL/MSL_C/MSL_Common/Include",
......@@ -188,6 +188,10 @@ QString WinscwToolChain::makeCommand() const
#endif
}
QString WinscwToolChain::debuggerCommand() const
{
return QString();
}
QString WinscwToolChain::defaultMakeTarget() const
{
......@@ -224,9 +228,10 @@ ProjectExplorer::ToolChain *WinscwToolChain::clone() const
QVariantMap WinscwToolChain::toMap() const
{
QVariantMap result = ToolChain::toMap();
result.insert(QLatin1String(WINSCW_COMPILER_PATH_KEY), m_compilerPath);
result.insert(QLatin1String(WINSCW_SYSTEM_INCLUDE_PATH_KEY), m_systemIncludePathes.join(QString(QLatin1Char(';'))));
result.insert(QLatin1String(WINSCW_SYSTEM_LIBRARY_PATH_KEY), m_systemLibraryPathes.join(QString(QLatin1Char(';'))));
result.insert(QLatin1String(winscwCompilerPathKeyC), m_compilerPath);
const QString semicolon = QString(QLatin1Char(';'));
result.insert(QLatin1String(winscwSystemIncludePathKeyC), m_systemIncludePathes.join(semicolon));
result.insert(QLatin1String(winscwSystemLibraryPathKeyC), m_systemLibraryPathes.join(semicolon));
return result;
}
......@@ -234,10 +239,10 @@ bool WinscwToolChain::fromMap(const QVariantMap &data)
{
if (!ToolChain::fromMap(data))
return false;
m_compilerPath = data.value(QLatin1String(WINSCW_COMPILER_PATH_KEY)).toString();
m_systemIncludePathes = data.value(QLatin1String(WINSCW_SYSTEM_INCLUDE_PATH_KEY)).toString().split(QLatin1Char(';'));
m_systemLibraryPathes = data.value(QLatin1String(WINSCW_SYSTEM_LIBRARY_PATH_KEY)).toString().split(QLatin1Char(';'));
m_compilerPath = data.value(QLatin1String(winscwCompilerPathKeyC)).toString();
const QChar semicolon = QLatin1Char(';');
m_systemIncludePathes = data.value(QLatin1String(winscwSystemIncludePathKeyC)).toString().split(semicolon);
m_systemLibraryPathes = data.value(QLatin1String(winscwSystemLibraryPathKeyC)).toString().split(semicolon);
</