Commit 220a3d1a authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Maemo: Remove remaining barriers for concurrent debugging.

Pipes and mount points for debugging with on-device gdb now have
unique names.
Also give mount point for deploying via UTFS per-project file name.

Task-number: QTCREATORBUG-2702
parent 88b0e1f6
......@@ -33,6 +33,8 @@
#include <utils/qtcassert.h>
#include <QtCore/QFileInfo>
#include <ctype.h>
using namespace Core;
......@@ -67,10 +69,13 @@ void RemoteGdbProcess::start(const QString &cmd, const QStringList &args)
QTC_ASSERT(m_gdbStarted, return);
}
void RemoteGdbProcess::realStart(const QString &cmd, const QStringList &args)
void RemoteGdbProcess::realStart(const QString &cmd, const QStringList &args,
const QString &executableFilePath)
{
m_command = cmd;
m_cmdArgs = args;
m_appOutputFileName = "app_output_"
+ QFileInfo(executableFilePath).fileName().toUtf8();
m_gdbStarted = false;
m_error.clear();
m_conn = SshConnection::create();
......@@ -83,7 +88,7 @@ void RemoteGdbProcess::realStart(const QString &cmd, const QStringList &args)
void RemoteGdbProcess::handleConnected()
{
m_fifoCreator = m_conn->createRemoteProcess( "rm -f "
+ AppOutputFile + " && mkfifo " + AppOutputFile);
+ m_appOutputFileName + " && mkfifo " + m_appOutputFileName);
connect(m_fifoCreator.data(), SIGNAL(closed(int)), this,
SLOT(handleFifoCreationFinished(int)));
m_fifoCreator->start();
......@@ -99,8 +104,8 @@ void RemoteGdbProcess::handleFifoCreationFinished(int exitStatus)
if (exitStatus != SshRemoteProcess::ExitedNormally) {
emitErrorExit(tr("Could not create FIFO."));
} else {
m_appOutputReader = m_conn->createRemoteProcess("cat " + AppOutputFile
+ " && rm -f " + AppOutputFile);
m_appOutputReader = m_conn->createRemoteProcess("cat "
+ m_appOutputFileName + " && rm -f " + m_appOutputFileName);
connect(m_appOutputReader.data(), SIGNAL(started()), this,
SLOT(handleAppOutputReaderStarted()));
connect(m_appOutputReader.data(), SIGNAL(closed(int)), this,
......@@ -115,7 +120,7 @@ void RemoteGdbProcess::handleAppOutputReaderStarted()
this, SLOT(handleAppOutput(QByteArray)));
QByteArray cmdLine = "DISPLAY=:0.0 " + m_command.toUtf8() + ' '
+ m_cmdArgs.join(QLatin1String(" ")).toUtf8()
+ " -tty=" + AppOutputFile;
+ " -tty=" + m_appOutputFileName;
if (!m_wd.isEmpty())
cmdLine.prepend("cd " + m_wd.toUtf8() + " && ");
m_gdbProc = m_conn->createRemoteProcess(cmdLine);
......@@ -303,7 +308,6 @@ void RemoteGdbProcess::emitErrorExit(const QString &error)
}
const QByteArray RemoteGdbProcess::CtrlC = QByteArray(1, 0x3);
const QByteArray RemoteGdbProcess::AppOutputFile("app_output");
} // namespace Internal
} // namespace Debugger
......@@ -67,7 +67,8 @@ public:
virtual void setWorkingDirectory(const QString &dir);
void interruptInferior();
void realStart(const QString &cmd, const QStringList &args);
void realStart(const QString &cmd, const QStringList &args,
const QString &executableFilePath);
static const QByteArray CtrlC;
......@@ -95,8 +96,6 @@ private:
QByteArray removeCarriageReturn(const QByteArray &data);
void emitErrorExit(const QString &error);
static const QByteArray AppOutputFile;
Core::SshConnectionParameters m_connParams;
Core::SshConnection::Ptr m_conn;
Core::SshRemoteProcess::Ptr m_gdbProc;
......@@ -112,6 +111,7 @@ private:
QByteArray m_lastSeqNr;
QString m_error;
bool m_gdbStarted;
QByteArray m_appOutputFileName;
RemotePlainGdbAdapter *m_adapter;
};
......
......@@ -112,7 +112,8 @@ void RemotePlainGdbAdapter::handleSetupDone(int qmlPort)
if (!startParameters().environment.isEmpty())
m_gdbProc.setEnvironment(startParameters().environment);
m_gdbProc.realStart(m_engine->startParameters().debuggerCommand,
QStringList() << QLatin1String("-i") << QLatin1String("mi"));
QStringList() << QLatin1String("-i") << QLatin1String("mi"),
m_engine->startParameters().executable);
}
void RemotePlainGdbAdapter::handleGdbStarted()
......
......@@ -86,7 +86,8 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
+ environment(runConfig) + QLatin1String(" /usr/bin/gdb");
params.connParams = devConf.server;
params.localMountDir = runConfig->localDirToMountForRemoteGdb();
params.remoteMountPoint = MaemoGlobal::remoteProjectSourcesMountPoint();
params.remoteMountPoint
= runConfig->remoteProjectSourcesMountPoint();
const QString execDirAbs
= QDir::fromNativeSeparators(QFileInfo(runConfig->localExecutableFilePath()).path());
const QString execDirRel
......
......@@ -705,7 +705,7 @@ void MaemoDeployStep::handleCleanupTimeout()
QString MaemoDeployStep::deployMountPoint() const
{
return MaemoGlobal::homeDirOnDevice(deviceConfig().server.uname)
+ QLatin1String("/deployMountPoint");
+ QLatin1String("/deployMountPoint_") + packagingStep()->projectName();
}
const MaemoToolChain *MaemoDeployStep::toolChain() const
......
......@@ -71,10 +71,5 @@ QString MaemoGlobal::remoteEnvironment(const QList<Utils::EnvironmentItem> &list
return env.mid(0, env.size() - 1);
}
QString MaemoGlobal::remoteProjectSourcesMountPoint()
{
return QLatin1String("/tmp/gdbSourcesDir");
}
} // namespace Internal
} // namespace Qt4ProjectManager
......@@ -55,7 +55,6 @@ public:
static QString remoteSudo();
static QString remoteCommandPrefix(const QString &commandFilePath);
static QString remoteEnvironment(const QList<Utils::EnvironmentItem> &list);
static QString remoteProjectSourcesMountPoint();
static QString remoteSourceProfilesCommand();
template<class T> static T *buildStep(const ProjectExplorer::DeployConfiguration *dc)
......
......@@ -84,6 +84,8 @@ public:
const QString &version);
static bool removeDirectory(const QString &dirPath);
QString projectName() const;
static const QLatin1String DefaultVersionNumber;
signals:
......@@ -118,7 +120,6 @@ private:
void raiseError(const QString &shortMsg,
const QString &detailedMsg = QString());
QString buildDirectory() const;
QString projectName() const;
const Qt4BuildConfiguration *qt4BuildConfiguration() const;
MaemoDeployStep * deployStep() const;
void checkProjectName();
......
......@@ -291,6 +291,13 @@ QString MaemoRunConfiguration::localDirToMountForRemoteGdb() const
? projectDir : projectDir.left(lastSeparatorPos);
}
QString MaemoRunConfiguration::remoteProjectSourcesMountPoint() const
{
return MaemoGlobal::homeDirOnDevice(deviceConfig().server.uname)
+ QLatin1String("/gdbSourcesDir_")
+ QFileInfo(localExecutableFilePath()).fileName();
}
QString MaemoRunConfiguration::localExecutableFilePath() const
{
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()
......
......@@ -104,6 +104,7 @@ public:
const QString gdbCmd() const;
const QString dumperLib() const;
QString localDirToMountForRemoteGdb() const;
QString remoteProjectSourcesMountPoint() const;
virtual QVariantMap toMap() const;
......
......@@ -202,7 +202,7 @@ void MaemoSshRunner::handleUnmounted()
if (m_debugging && m_runConfig->useRemoteGdb()) {
m_mounter->addMountSpecification(MaemoMountSpecification(
m_runConfig->localDirToMountForRemoteGdb(),
MaemoGlobal::remoteProjectSourcesMountPoint()), false);
m_runConfig->remoteProjectSourcesMountPoint()), false);
}
setState(PreMountUnmounting);
unmount();
......
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