Commit 245eb743 authored by Christian Kandeler's avatar Christian Kandeler

Maemo: Remove support for debugging with an on-device gdb.

It was only a workaround for a Fremantle problem that no longer
exists and has no advantages to the gdbserver approach.

Change-Id: Ia92c3e423fde3735a010d8abff646593f8bccdda
Reviewed-on: http://codereview.qt.nokia.com/478Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent 118de5c2
......@@ -72,35 +72,18 @@ RunControl *MaemoDebugSupport::createDebugRunControl(RemoteLinuxRunConfiguration
if (runConfig->activeQt4BuildConfiguration()->qtVersion())
params.sysroot = runConfig->activeQt4BuildConfiguration()->qtVersion()->systemRoot();
params.toolChainAbi = runConfig->abi();
if (runConfig->useRemoteGdb()) {
params.startMode = StartRemoteGdb;
params.executable = runConfig->remoteExecutableFilePath();
params.debuggerCommand = runConfig->commandPrefix() + QLatin1String(" /usr/bin/gdb");
params.connParams = devConf->sshParameters();
params.localMountDir = runConfig->localDirToMountForRemoteGdb();
params.remoteMountPoint
= runConfig->remoteProjectSourcesMountPoint();
const QString execDirAbs
= QDir::fromNativeSeparators(QFileInfo(runConfig->localExecutableFilePath()).path());
const QString execDirRel
= QDir(params.localMountDir).relativeFilePath(execDirAbs);
params.remoteSourcesDir = QString(params.remoteMountPoint
+ QLatin1Char('/') + execDirRel).toUtf8();
} else {
params.startMode = AttachToRemote;
params.executable = runConfig->localExecutableFilePath();
params.debuggerCommand = runConfig->gdbCmd();
params.remoteChannel
= devConf->sshParameters().host + QLatin1String(":-1");
params.useServerStartScript = true;
// TODO: This functionality should be inside the debugger.
const ProjectExplorer::Abi &abi = runConfig->target()
->activeBuildConfiguration()->toolChain()->targetAbi();
params.remoteArchitecture = abi.toString();
params.gnuTarget = QLatin1String(abi.architecture() == ProjectExplorer::Abi::ArmArchitecture
? "arm-none-linux-gnueabi": "i386-unknown-linux-gnu");
}
params.startMode = AttachToRemote;
params.executable = runConfig->localExecutableFilePath();
params.debuggerCommand = runConfig->gdbCmd();
params.remoteChannel = devConf->sshParameters().host + QLatin1String(":-1");
params.useServerStartScript = true;
// TODO: This functionality should be inside the debugger.
const ProjectExplorer::Abi &abi = runConfig->target()
->activeBuildConfiguration()->toolChain()->targetAbi();
params.remoteArchitecture = abi.toString();
params.gnuTarget = QLatin1String(abi.architecture() == ProjectExplorer::Abi::ArmArchitecture
? "arm-none-linux-gnueabi": "i386-unknown-linux-gnu");
} else {
params.startMode = AttachToRemote;
}
......@@ -116,23 +99,19 @@ RunControl *MaemoDebugSupport::createDebugRunControl(RemoteLinuxRunConfiguration
DebuggerRunControl * const runControl =
DebuggerPlugin::createDebugger(params, runConfig);
bool useGdb = params.startMode == StartRemoteGdb
&& debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly;
MaemoDebugSupport *debugSupport =
new MaemoDebugSupport(runConfig, runControl->engine(), useGdb);
new MaemoDebugSupport(runConfig, runControl->engine());
connect(runControl, SIGNAL(finished()),
debugSupport, SLOT(handleDebuggingFinished()));
return runControl;
}
MaemoDebugSupport::MaemoDebugSupport(RemoteLinuxRunConfiguration *runConfig,
DebuggerEngine *engine, bool useGdb)
MaemoDebugSupport::MaemoDebugSupport(RemoteLinuxRunConfiguration *runConfig, DebuggerEngine *engine)
: QObject(engine), m_engine(engine), m_runConfig(runConfig),
m_deviceConfig(m_runConfig->deviceConfig()),
m_runner(new MaemoSshRunner(this, runConfig, true)),
m_runner(new MaemoSshRunner(this, runConfig)),
m_debuggingType(runConfig->debuggingType()),
m_state(Inactive), m_gdbServerPort(-1), m_qmlPort(-1),
m_useGdb(useGdb)
m_state(Inactive), m_gdbServerPort(-1), m_qmlPort(-1)
{
connect(m_engine, SIGNAL(requestRemoteSetup()), this,
SLOT(handleAdapterSetupRequested()));
......@@ -183,7 +162,7 @@ void MaemoDebugSupport::startExecution()
ASSERT_STATE(StartingRunner);
if (!useGdb() && m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) {
if (m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) {
if (!setPort(m_gdbServerPort))
return;
}
......@@ -192,11 +171,6 @@ void MaemoDebugSupport::startExecution()
return;
}
if (useGdb()) {
handleAdapterSetupDone();
return;
}
setState(StartingRemoteProcess);
m_gdbserverOutput.clear();
connect(m_runner, SIGNAL(remoteErrorOutput(QByteArray)), this,
......@@ -301,11 +275,6 @@ void MaemoDebugSupport::setState(State newState)
m_runner->stop();
}
bool MaemoDebugSupport::useGdb() const
{
return m_useGdb;
}
bool MaemoDebugSupport::setPort(int &port)
{
port = m_runner->usedPortsGatherer()->getNextFreePort(m_runner->freePorts());
......
......@@ -56,8 +56,7 @@ class MaemoDebugSupport : public QObject
public:
static ProjectExplorer::RunControl *createDebugRunControl(RemoteLinuxRunConfiguration *runConfig);
MaemoDebugSupport(RemoteLinuxRunConfiguration *runConfig,
Debugger::DebuggerEngine *engine, bool useGdb);
MaemoDebugSupport(RemoteLinuxRunConfiguration *runConfig, Debugger::DebuggerEngine *engine);
~MaemoDebugSupport();
private slots:
......@@ -78,7 +77,6 @@ private:
void handleAdapterSetupFailed(const QString &error);
void handleAdapterSetupDone();
bool useGdb() const;
void setState(State newState);
bool setPort(int &port);
void showMessage(const QString &msg, int channel);
......@@ -93,7 +91,6 @@ private:
State m_state;
int m_gdbServerPort;
int m_qmlPort;
bool m_useGdb;
};
} // namespace Internal
......
......@@ -91,7 +91,6 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
QVBoxLayout *mainLayout = new QVBoxLayout(topWidget);
addGenericWidgets(mainLayout);
mainLayout->addSpacing(20);
addDebuggingWidgets(mainLayout);
addMountWidgets(mainLayout);
addEnvironmentWidgets(mainLayout);
connect(m_runConfiguration,
......@@ -106,7 +105,6 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
= qobject_cast<AbstractQt4MaemoTarget *>(runConfiguration->target());
const bool remoteMountsAvailable
= maemoTarget && maemoTarget->allowsRemoteMounts();
m_debugDetailsContainer->setVisible(remoteMountsAvailable);
m_mountDetailsContainer->setVisible(remoteMountsAvailable);
const bool qmlDebuggingAvailable
= !maemoTarget || maemoTarget->allowsQmlDebugging();
......@@ -211,27 +209,6 @@ void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout)
handleDeploySpecsChanged();
}
void MaemoRunConfigurationWidget::addDebuggingWidgets(QVBoxLayout *mainLayout)
{
m_debugDetailsContainer = new Utils::DetailsWidget(this);
QWidget *debugWidget = new QWidget;
m_debugDetailsContainer->setWidget(debugWidget);
mainLayout->addWidget(m_debugDetailsContainer);
QFormLayout *debugLayout = new QFormLayout(debugWidget);
QHBoxLayout *debugRadioButtonsLayout = new QHBoxLayout;
debugLayout->addRow(debugRadioButtonsLayout);
QRadioButton *gdbButton = new QRadioButton(tr("Use remote GDB"));
QRadioButton *gdbServerButton = new QRadioButton(tr("Use remote GDB server"));
debugRadioButtonsLayout->addWidget(gdbButton);
debugRadioButtonsLayout->addWidget(gdbServerButton);
debugRadioButtonsLayout->addStretch(1);
gdbButton->setChecked(m_runConfiguration->useRemoteGdb());
gdbServerButton->setChecked(!gdbButton->isChecked());
connect(gdbButton, SIGNAL(toggled(bool)), this,
SLOT(handleDebuggingTypeChanged(bool)));
handleDebuggingTypeChanged(gdbButton->isChecked());
}
void MaemoRunConfigurationWidget::addMountWidgets(QVBoxLayout *mainLayout)
{
......@@ -392,15 +369,6 @@ void MaemoRunConfigurationWidget::changeLocalMountDir(const QModelIndex &index)
}
}
void MaemoRunConfigurationWidget::handleDebuggingTypeChanged(bool useGdb)
{
m_runConfiguration->setUseRemoteGdb(useGdb);
const QString detailsText = useGdb ?
tr("<b>Debugging details:</b> Use GDB") :
tr("<b>Debugging details:</b> Use GDB server");
m_debugDetailsContainer->setSummaryText(detailsText);
}
void MaemoRunConfigurationWidget::fetchEnvironment()
{
disconnect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
......
......@@ -82,7 +82,6 @@ private slots:
void removeMount();
void changeLocalMountDir(const QModelIndex &index);
void enableOrDisableRemoveMountSpecButton();
void handleDebuggingTypeChanged(bool useGdb);
void fetchEnvironment();
void fetchEnvironmentFinished();
void fetchEnvironmentError(const QString &error);
......@@ -99,7 +98,6 @@ private slots:
private:
void addDisabledLabel(QVBoxLayout *topLayout);
void addGenericWidgets(QVBoxLayout *mainLayout);
void addDebuggingWidgets(QVBoxLayout *mainLayout);
void addMountWidgets(QVBoxLayout *mainLayout);
void addEnvironmentWidgets(QVBoxLayout *mainLayout);
void updateMountWarning();
......@@ -119,7 +117,6 @@ private:
QTableView *m_mountView;
QToolButton *m_removeMountButton;
Utils::DetailsWidget *m_mountDetailsContainer;
Utils::DetailsWidget *m_debugDetailsContainer;
RemoteLinuxRunConfiguration *m_runConfiguration;
bool m_ignoreChange;
......
......@@ -49,7 +49,7 @@ using ProjectExplorer::RunConfiguration;
MaemoRunControl::MaemoRunControl(RunConfiguration *rc)
: RunControl(rc, ProjectExplorer::Constants::RUNMODE)
, m_runner(new MaemoSshRunner(this, qobject_cast<RemoteLinuxRunConfiguration *>(rc), false))
, m_runner(new MaemoSshRunner(this, qobject_cast<RemoteLinuxRunConfiguration *>(rc)))
, m_running(false)
{
}
......
......@@ -54,8 +54,7 @@ using namespace Utils;
namespace RemoteLinux {
namespace Internal {
MaemoSshRunner::MaemoSshRunner(QObject *parent,
RemoteLinuxRunConfiguration *runConfig, bool debugging)
MaemoSshRunner::MaemoSshRunner(QObject *parent, RemoteLinuxRunConfiguration *runConfig)
: QObject(parent),
m_mounter(new MaemoRemoteMounter(this)),
m_portsGatherer(new MaemoUsedPortsGatherer(this)),
......@@ -68,11 +67,6 @@ MaemoSshRunner::MaemoSshRunner(QObject *parent,
m_state(Inactive)
{
m_mounter->setBuildConfiguration(runConfig->activeQt4BuildConfiguration());
if (debugging && runConfig->useRemoteGdb()) {
m_mountSpecs << MaemoMountSpecification(runConfig->localDirToMountForRemoteGdb(),
runConfig->remoteProjectSourcesMountPoint());
}
m_procsToKill << QFileInfo(m_remoteExecutable).fileName();
connect(m_mounter, SIGNAL(mounted()), this, SLOT(handleMounted()));
connect(m_mounter, SIGNAL(unmounted()), this, SLOT(handleUnmounted()));
......
......@@ -55,8 +55,7 @@ class MaemoSshRunner : public QObject
{
Q_OBJECT
public:
MaemoSshRunner(QObject *parent, RemoteLinuxRunConfiguration *runConfig,
bool debugging);
MaemoSshRunner(QObject *parent, RemoteLinuxRunConfiguration *runConfig);
~MaemoSshRunner();
void start();
......
......@@ -67,16 +67,12 @@ using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
namespace RemoteLinux {
namespace {
const bool DefaultUseRemoteGdbValue = false;
} // anonymous namespace
namespace Internal {
class RemoteLinuxRunConfigurationPrivate {
public:
RemoteLinuxRunConfigurationPrivate(const QString &proFilePath, const Qt4BaseTarget *target)
: proFilePath(proFilePath), useRemoteGdb(DefaultUseRemoteGdbValue),
: proFilePath(proFilePath),
baseEnvironmentType(RemoteLinuxRunConfiguration::SystemBaseEnvironment),
validParse(target->qt4Project()->validParse(proFilePath)),
parseInProgress(target->qt4Project()->parseInProgress(proFilePath))
......@@ -85,7 +81,7 @@ public:
RemoteLinuxRunConfigurationPrivate(const RemoteLinuxRunConfigurationPrivate *other)
: proFilePath(other->proFilePath), gdbPath(other->gdbPath), arguments(other->arguments),
useRemoteGdb(other->useRemoteGdb), baseEnvironmentType(other->baseEnvironmentType),
baseEnvironmentType(other->baseEnvironmentType),
systemEnvironment(other->systemEnvironment),
userEnvironmentChanges(other->userEnvironmentChanges),
validParse(other->validParse),
......@@ -97,7 +93,6 @@ public:
QString gdbPath;
MaemoRemoteMountsModel *remoteMounts;
QString arguments;
bool useRemoteGdb;
RemoteLinuxRunConfiguration::BaseEnvironmentType baseEnvironmentType;
Utils::Environment systemEnvironment;
QList<Utils::EnvironmentItem> userEnvironmentChanges;
......@@ -230,7 +225,6 @@ QVariantMap RemoteLinuxRunConfiguration::toMap() const
map.insert(ArgumentsKey, m_d->arguments);
const QDir dir = QDir(target()->project()->projectDirectory());
map.insert(ProFileKey, dir.relativeFilePath(m_d->proFilePath));
map.insert(UseRemoteGdbKey, useRemoteGdb());
map.insert(BaseEnvironmentBaseKey, m_d->baseEnvironmentType);
map.insert(UserEnvironmentChangesKey,
Utils::EnvironmentItem::toStringList(m_d->userEnvironmentChanges));
......@@ -246,7 +240,6 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
m_d->arguments = map.value(ArgumentsKey).toString();
const QDir dir = QDir(target()->project()->projectDirectory());
m_d->proFilePath = dir.filePath(map.value(ProFileKey).toString());
m_d->useRemoteGdb = map.value(UseRemoteGdbKey, DefaultUseRemoteGdbValue).toBool();
m_d->userEnvironmentChanges =
Utils::EnvironmentItem::fromStringList(map.value(UserEnvironmentChangesKey)
.toStringList());
......@@ -311,32 +304,6 @@ QString RemoteLinuxRunConfiguration::commandPrefix() const
.arg(MaemoGlobal::remoteEnvironment(userEnvironmentChanges()));
}
QString RemoteLinuxRunConfiguration::localDirToMountForRemoteGdb() const
{
const QString projectDir
= QDir::fromNativeSeparators(QDir::cleanPath(activeBuildConfiguration()
->target()->project()->projectDirectory()));
const QString execDir
= QDir::fromNativeSeparators(QFileInfo(localExecutableFilePath()).path());
const int length = qMin(projectDir.length(), execDir.length());
int lastSeparatorPos = 0;
for (int i = 0; i < length; ++i) {
if (projectDir.at(i) != execDir.at(i))
return projectDir.left(lastSeparatorPos);
if (projectDir.at(i) == QLatin1Char('/'))
lastSeparatorPos = i;
}
return projectDir.length() == execDir.length()
? projectDir : projectDir.left(lastSeparatorPos);
}
QString RemoteLinuxRunConfiguration::remoteProjectSourcesMountPoint() const
{
return MaemoGlobal::homeDirOnDevice(deviceConfig()->sshParameters().userName)
+ QLatin1String("/gdbSourcesDir_")
+ QFileInfo(localExecutableFilePath()).fileName();
}
QString RemoteLinuxRunConfiguration::localExecutableFilePath() const
{
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()
......@@ -361,20 +328,6 @@ PortList RemoteLinuxRunConfiguration::freePorts() const
: PortList();
}
bool RemoteLinuxRunConfiguration::useRemoteGdb() const
{
if (!m_d->useRemoteGdb)
return false;
const AbstractQt4MaemoTarget * const maemoTarget
= qobject_cast<AbstractQt4MaemoTarget *>(target());
return maemoTarget && maemoTarget->allowsRemoteMounts();
}
void RemoteLinuxRunConfiguration::setUseRemoteGdb(bool useRemoteGdb)
{
m_d->useRemoteGdb = useRemoteGdb;
}
void RemoteLinuxRunConfiguration::setArguments(const QString &args)
{
m_d->arguments = args;
......
......@@ -100,12 +100,9 @@ public:
QString commandPrefix() const;
QSharedPointer<const LinuxDeviceConfiguration> deviceConfig() const;
PortList freePorts() const;
bool useRemoteGdb() const;
DebuggingType debuggingType() const;
QString gdbCmd() const;
QString localDirToMountForRemoteGdb() const;
QString remoteProjectSourcesMountPoint() const;
virtual QVariantMap toMap() const;
......@@ -149,7 +146,6 @@ private:
Internal::AbstractLinuxDeviceDeployStep *deployStep() const;
void setArguments(const QString &args);
void setUseRemoteGdb(bool useRemoteGdb);
void setBaseEnvironmentType(BaseEnvironmentType env);
void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
void setSystemEnvironment(const Utils::Environment &environment);
......
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