remotelinux: use /proc/*/exe link target to determine local binary

Change-Id: I08a3ab02214e41af646f01e7de705009fa07ecac
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
hjk
2012-05-04 12:46:33 +02:00
committed by hjk
parent 2afa559c2a
commit 344620ffbc
2 changed files with 23 additions and 7 deletions

View File

@@ -1114,8 +1114,10 @@ public slots:
// FIXME: Remove.
void maybeEnrichParameters(DebuggerStartParameters *sp);
void gdbServerStarted(const QString &channel, const QString &sysroot, const QString &localExecutable);
void attachedToProcess(const QString &channel, const QString &sysroot, const QString &localExecutable);
void gdbServerStarted(const QString &channel, const QString &sysroot,
const QString &remoteCommandLine, const QString &remoteExecutable);
void attachedToProcess(const QString &channel, const QString &sysroot,
const QString &remoteCommandLine, const QString &remoteExecutable);
public:
DebuggerMainWindow *m_mainWindow;
@@ -1690,9 +1692,12 @@ void DebuggerPluginPrivate::startRemoteServer()
}
void DebuggerPluginPrivate::gdbServerStarted(const QString &channel,
const QString &sysroot, const QString &remoteCommandLine)
const QString &sysroot,
const QString &remoteCommandLine,
const QString &remoteExecutable)
{
Q_UNUSED(remoteCommandLine);
Q_UNUSED(remoteExecutable);
Q_UNUSED(sysroot);
showStatusMessage(tr("gdbserver is now listening at %1").arg(channel));
}
@@ -1708,13 +1713,21 @@ void DebuggerPluginPrivate::attachToRemoteProcess()
}
void DebuggerPluginPrivate::attachedToProcess(const QString &channel,
const QString &sysroot, const QString &remoteCommandLine)
const QString &sysroot,
const QString &remoteCommandLine,
const QString &remoteExecutable)
{
QString binary = remoteCommandLine.section(QLatin1Char(' '), 0, 0);
QString binary;
QString localExecutable;
QString candidate = sysroot + QLatin1Char('/') + binary;
QString candidate = sysroot + remoteExecutable;
if (QFileInfo(candidate).exists())
localExecutable = candidate;
if (localExecutable.isEmpty()) {
binary = remoteCommandLine.section(QLatin1Char(' '), 0, 0);
candidate = sysroot + QLatin1Char('/') + binary;
if (QFileInfo(candidate).exists())
localExecutable = candidate;
}
if (localExecutable.isEmpty()) {
candidate = sysroot + QLatin1String("/usr/bin/") + binary;
if (QFileInfo(candidate).exists())

View File

@@ -109,6 +109,7 @@ public:
SshRemoteProcessRunner runner;
QSettings *settings;
QString remoteCommandLine;
QString remoteExecutable;
};
StartGdbServerDialogPrivate::StartGdbServerDialogPrivate(StartGdbServerDialog *q)
@@ -273,6 +274,7 @@ void StartGdbServerDialog::attachToProcess()
QTC_ASSERT(row >= 0, return);
RemoteProcess process = d->processList->at(row);
d->remoteCommandLine = process.cmdLine;
d->remoteExecutable = process.exe;
if (port == -1) {
reportFailure();
return;
@@ -378,7 +380,8 @@ void StartGdbServerDialog::reportOpenPort(int port)
QMetaObject::invokeMethod(ob, member, Qt::QueuedConnection,
Q_ARG(QString, channel),
Q_ARG(QString, d->sysrootPathChooser->path()),
Q_ARG(QString, d->remoteCommandLine));
Q_ARG(QString, d->remoteCommandLine),
Q_ARG(QString, d->remoteExecutable));
}
close();
}