Commit 8a4f1ab5 authored by ck's avatar ck
Browse files

Maemo: Fix Qemu for recent MADDE.

Reviewed-by: kh1
parent 77079d7c
......@@ -147,7 +147,7 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Project *project,
, m_cachedSimulatorInformationValid(false)
, qemu(0)
{
ctor();
init();
}
MaemoRunConfiguration::MaemoRunConfiguration(Qt4Project *project,
......@@ -160,6 +160,9 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Project *project,
, m_simulatorArgs(source->m_simulatorArgs)
, m_simulatorPath(source->m_simulatorPath)
, m_visibleSimulatorParameter(source->m_visibleSimulatorParameter)
, m_simulatorLibPath(source->m_simulatorLibPath)
, m_simulatorSshPort(source->m_simulatorSshPort)
, m_simulatorGdbServerPort(source->m_simulatorGdbServerPort)
, m_cachedSimulatorInformationValid(false)
, m_isUserSetSimulator(source->m_isUserSetSimulator)
, m_userSimulatorPath(source->m_userSimulatorPath)
......@@ -174,10 +177,10 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Project *project,
, m_remoteHostRequiresPassword(source->m_remoteHostRequiresPassword)
#endif
{
ctor();
init();
}
void MaemoRunConfiguration::ctor()
void MaemoRunConfiguration::init()
{
if (!m_proFilePath.isEmpty()) {
setDisplayName(tr("%1 on Maemo device").arg(QFileInfo(m_proFilePath)
......@@ -537,8 +540,15 @@ void MaemoRunConfiguration::updateSimulatorInformation()
line.mid(index + 1).remove(QLatin1Char('\'')));
}
m_simulator = map.value(QLatin1String("runcommand"));
m_simulatorArgs = map.value(QLatin1String("runcommand_args"));
m_simulator = map.value(QLatin1String("qemu"));
m_simulatorArgs = map.value(QLatin1String("qemu_args"));
const QString &libPathSpec
= map.value(QLatin1String("libpath"));
m_simulatorLibPath
= libPathSpec.mid(libPathSpec.indexOf(QLatin1Char('=')) + 1);
m_simulatorSshPort = map.value(QLatin1String("sshport"));
m_simulatorGdbServerPort
= map.value(QLatin1String("redirport2"));
m_visibleSimulatorParameter = m_simulator
#ifdef Q_OS_WIN
......@@ -571,23 +581,27 @@ void MaemoRunConfiguration::startStopQemu()
if (root.isEmpty() || simulator().isEmpty())
return;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
#ifdef Q_OS_WIN
const QLatin1Char colon(';');
const QString path = QDir::toNativeSeparators(root + QLatin1Char('/'));
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("PATH", env.value("Path") + colon + path + QLatin1String("bin"));
env.insert("PATH", env.value("Path") + colon + path + QLatin1String("madlib"));
const QLatin1String key("PATH");
env.insert(key, env.value(key) % colon % path % QLatin1String("bin"));
env.insert(key, env.value(key) % colon % path % QLatin1String("madlib"));
#elif defined(Q_OS_UNIX)
const QLatin1String key("LD_LIBRARY_PATH");
env.insert(key, env.value(key) % QLatin1Char(':') % m_simulatorLibPath);
#endif
qemu->setProcessEnvironment(env);
qemu->setWorkingDirectory(simulatorPath());
QString app = root + QLatin1String("/madlib/") + simulator()
const QString app = root % QLatin1String("/madlib/") % simulator()
#ifdef Q_OS_WIN
+ QLatin1String(".exe")
% QLatin1String(".exe")
#endif
; // keep
qemu->start(app + QLatin1Char(' ') + simulatorArgs(), QIODevice::ReadWrite);
qemu->start(app % QLatin1Char(' ') % simulatorArgs(), QIODevice::ReadWrite);
emit qemuProcessStatus(qemu->waitForStarted());
}
......
......@@ -96,6 +96,8 @@ public:
QString simulator() const;
QString simulatorArgs() const;
QString simulatorPath() const;
QString simulatorSshPort() const { return m_simulatorSshPort; }
QString simulatorGdbServerPort() const { return m_simulatorGdbServerPort; }
QString visibleSimulatorParameter() const;
const QString sshCmd() const;
......@@ -142,7 +144,7 @@ private slots:
void enabledStateChanged();
private:
void ctor();
void init();
void updateTarget();
void updateSimulatorInformation();
const QString cmd(const QString &cmdName) const;
......@@ -157,6 +159,9 @@ private:
QString m_simulatorArgs;
QString m_simulatorPath;
QString m_visibleSimulatorParameter;
QString m_simulatorLibPath;
QString m_simulatorSshPort;
QString m_simulatorGdbServerPort;
bool m_cachedSimulatorInformationValid;
bool m_isUserSetSimulator;
......
......@@ -69,6 +69,7 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
QHBoxLayout *devConfLayout = new QHBoxLayout(devConfWidget);
m_devConfBox = new QComboBox;
m_devConfBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
devConfLayout->setMargin(0);
devConfLayout->addWidget(m_devConfBox);
QLabel *addDevConfLabel
= new QLabel(tr("<a href=\"#\">Manage device configurations</a>"));
......
......@@ -244,7 +244,9 @@ const QString AbstractMaemoRunControl::executableOnHost() const
const QString AbstractMaemoRunControl::sshPort() const
{
return QString::number(devConfig.sshPort);
return devConfig.type == MaemoDeviceConfig::Physical
? QString::number(devConfig.sshPort)
: runConfig->simulatorSshPort();
}
const QString AbstractMaemoRunControl::executableFileName() const
......@@ -476,8 +478,7 @@ MaemoDebugRunControl::MaemoDebugRunControl(RunConfiguration *runConfiguration)
startParams->startMode = Debugger::StartRemote;
startParams->executable = executableOnHost();
startParams->remoteChannel
= devConfig.host % QLatin1Char(':')
% QString::number(devConfig.gdbServerPort);
= devConfig.host % QLatin1Char(':') % gdbServerPort();
startParams->remoteArchitecture = QLatin1String("arm");
startParams->sysRoot = runConfig->sysRoot();
startParams->toolChainType = ToolChain::GCC_MAEMO;
......@@ -518,7 +519,7 @@ void MaemoDebugRunControl::handleDeploymentFinished(bool success)
void MaemoDebugRunControl::startGdbServer()
{
const QString remoteCall(QString::fromLocal8Bit("%1 gdbserver :%2 %3 %4").
arg(targetCmdLinePrefix()).arg(devConfig.gdbServerPort)
arg(targetCmdLinePrefix()).arg(gdbServerPort())
.arg(executableOnTarget()).arg(runConfig->arguments().join(" ")));
inferiorPid = -1;
#ifdef USE_SSH_LIB
......@@ -671,5 +672,12 @@ void MaemoDebugRunControl::debuggerOutput(const QString &output)
emit addToOutputWindowInline(this, output);
}
QString MaemoDebugRunControl::gdbServerPort() const
{
return devConfig.type == MaemoDeviceConfig::Physical
? QString::number(devConfig.gdbServerPort)
: runConfig->simulatorGdbServerPort();
}
} // namespace Internal
} // namespace Qt4ProjectManager
......@@ -172,6 +172,7 @@ private slots:
private:
virtual void handleDeploymentFinished(bool success);
QString gdbServerPort() const;
void startGdbServer();
void gdbServerStartFailed(const QString &reason);
void startDebugging();
......
......@@ -355,6 +355,19 @@ void MaemoSettingsWidget::deviceTypeChanged()
m_ui->deviceButton->isChecked()
? MaemoDeviceConfig::Physical
: MaemoDeviceConfig::Simulator;
// Port values for the simulator are specified by Qemu's
// "information" file, to which we have no access here,
// so we hard-code the last known values.
if (currentConfig().type == MaemoDeviceConfig::Simulator) {
currentConfig().sshPort = 6666;
currentConfig().gdbServerPort = 13219;
m_ui->sshPortLineEdit->setReadOnly(true);
m_ui->gdbServerPortLineEdit->setReadOnly(true);
} else {
m_ui->sshPortLineEdit->setReadOnly(false);
m_ui->gdbServerPortLineEdit->setReadOnly(false);
}
}
void MaemoSettingsWidget::authenticationTypeChanged()
......@@ -452,7 +465,6 @@ void MaemoSettingsWidget::processSshOutput(const QString &data)
void MaemoSettingsWidget::handleTestThreadFinished()
{
#ifdef USE_SSH_LIB
qDebug("================> %s", Q_FUNC_INFO);
if (!m_deviceTester)
return;
......@@ -460,6 +472,8 @@ void MaemoSettingsWidget::handleTestThreadFinished()
if (m_deviceTester->hasError()) {
output = tr("Device configuration test failed:\n");
output.append(m_deviceTester->error());
if (currentConfig().type == MaemoDeviceConfig::Simulator)
output.append(tr("\nDid you start Qemu?"));
} else {
output = parseTestOutput();
}
......
Supports Markdown
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