Commit 6a49395e authored by ck's avatar ck
Browse files

Add experimental Maemo support.

Includes Maemo tool chain, run configuration, run control,
manager, etc.

Adds the DebuggerManager to the object pool. This is ugly, but
nobody came up with anything better on short notice. To be
refactored.

Co-Authored-By: kh1
parent 6f5158fa
......@@ -113,7 +113,9 @@ public:
QString symbolFileName;
QString serverStartScript;
QString sysRoot;
QString debuggerCommand;
int toolChainType;
QString remoteDumperLib;
QString dumperLibrary;
QStringList dumperLibraryLocations;
......
......@@ -451,6 +451,7 @@ void DebuggerPlugin::shutdown()
delete m_locationMark;
m_locationMark = 0;
removeObject(m_manager);
delete m_manager;
m_manager = 0;
}
......@@ -545,6 +546,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
}
m_manager = new DebuggerManager;
ExtensionSystem::PluginManager::instance()->addObject(m_manager);
const QList<Core::IOptionsPage *> engineOptionPages =
m_manager->initializeEngines(m_cmdLineEnabledEngines);
......
......@@ -3796,47 +3796,56 @@ void GdbEngine::tryLoadDebuggingHelpers()
}
m_debuggingHelperState = DebuggingHelperLoadTried;
const QString dlopenLib =
(startParameters().startMode == StartRemote)
? startParameters().remoteDumperLib : lib;
#if defined(Q_OS_WIN)
if (m_dumperInjectionLoad) {
/// Launch asynchronous remote thread to load.
SharedLibraryInjector injector(inferiorPid());
QString errorMessage;
if (injector.remoteInject(lib, false, &errorMessage)) {
debugMessage(tr("Dumper injection loading triggered (%1)...").arg(lib));
if (injector.remoteInject(dlopenLib, false, &errorMessage)) {
debugMessage(tr("Dumper injection loading triggered (%1)...").
arg(dlopenLib));
} else {
debugMessage(tr("Dumper loading (%1) failed: %2").arg(lib, errorMessage));
debugMessage(tr("Dumper loading (%1) failed: %2").
arg(dlopenLib, errorMessage));
debugMessage(errorMessage);
manager()->showQtDumperLibraryWarning(errorMessage);
m_debuggingHelperState = DebuggingHelperUnavailable;
return;
}
} else {
debugMessage(tr("Loading dumpers via debugger call (%1)...").arg(lib));
debugMessage(tr("Loading dumpers via debugger call (%1)...").
arg(dlopenLib));
postCommand(_("sharedlibrary .*")); // for LoadLibraryA
//postCommand(_("handle SIGSEGV pass stop print"));
//postCommand(_("set unwindonsignal off"));
postCommand(_("call LoadLibraryA(\"") + GdbMi::escapeCString(lib) + _("\")"),
postCommand(_("call LoadLibraryA(\"") + GdbMi::escapeCString(dlopenLib) + _("\")"),
CB(handleDebuggingHelperSetup));
postCommand(_("sharedlibrary ") + dotEscape(lib));
postCommand(_("sharedlibrary ") + dotEscape(dlopenLib));
}
#elif defined(Q_OS_MAC)
//postCommand(_("sharedlibrary libc")); // for malloc
//postCommand(_("sharedlibrary libdl")); // for dlopen
postCommand(_("call (void)dlopen(\"") + GdbMi::escapeCString(lib) + _("\", " STRINGIFY(RTLD_NOW) ")"),
postCommand(_("call (void)dlopen(\"") + GdbMi::escapeCString(dlopenLib)
+ _("\", " STRINGIFY(RTLD_NOW) ")"),
CB(handleDebuggingHelperSetup));
//postCommand(_("sharedlibrary ") + dotEscape(lib));
//postCommand(_("sharedlibrary ") + dotEscape(dlopenLib));
m_debuggingHelperState = DebuggingHelperLoadTried;
#else
//postCommand(_("p dlopen"));
QString flag = QString::number(RTLD_NOW);
postCommand(_("sharedlibrary libc")); // for malloc
postCommand(_("sharedlibrary libdl")); // for dlopen
postCommand(_("call (void*)dlopen(\"") + GdbMi::escapeCString(lib) + _("\", " STRINGIFY(RTLD_NOW) ")"),
postCommand(_("call (void*)dlopen(\"") + GdbMi::escapeCString(dlopenLib)
+ _("\", " STRINGIFY(RTLD_NOW) ")"),
CB(handleDebuggingHelperSetup));
// some older systems like CentOS 4.6 prefer this:
postCommand(_("call (void*)__dlopen(\"") + GdbMi::escapeCString(lib) + _("\", " STRINGIFY(RTLD_NOW) ")"),
postCommand(_("call (void*)__dlopen(\"") + GdbMi::escapeCString(dlopenLib)
+ _("\", " STRINGIFY(RTLD_NOW) ")"),
CB(handleDebuggingHelperSetup));
postCommand(_("sharedlibrary ") + dotEscape(lib));
postCommand(_("sharedlibrary ") + dotEscape(dlopenLib));
#endif
if (!m_dumperInjectionLoad)
tryQueryDebuggingHelpers();
......
......@@ -160,6 +160,8 @@ void RemoteGdbAdapter::startInferior()
m_engine->postCommand(_("set architecture %1")
.arg(startParameters().remoteArchitecture));
m_engine->postCommand(_("set sysroot %1").arg(startParameters().sysRoot));
m_engine->postCommand(_("set solib-search-path %1").
arg(QFileInfo(startParameters().dumperLibrary).path()));
if (!startParameters().processArgs.isEmpty())
m_engine->postCommand(_("-exec-arguments ")
......
......@@ -127,6 +127,8 @@ QString ToolChain::toolChainName(ToolChainType tc)
return QCoreApplication::translate("ToolChain", "RVCT (ARMV5)");
case RVCT_ARMV6:
return QCoreApplication::translate("ToolChain", "RVCT (ARMV6)");
case GCC_MAEMO:
return QCoreApplication::translate("ToolChain", "GCC for Maemo");
case OTHER:
return QCoreApplication::translate("ToolChain", "Other");
case INVALID:
......
......@@ -83,7 +83,8 @@ public:
GCCE = 6,
RVCT_ARMV5 = 7,
RVCT_ARMV6 = 8,
LAST_VALID = 9,
GCC_MAEMO = 9,
LAST_VALID = 10,
OTHER = 200,
UNKNOWN = 201,
INVALID = 202
......
......@@ -25,5 +25,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<dependency name="CppEditor" version="1.3.80"/>
<dependency name="Help" version="1.3.80"/>
<dependency name="Designer" version="1.3.80"/>
<dependency name="Debugger" version="1.3.80"/>
</dependencyList>
</plugin>
......@@ -68,6 +68,12 @@ QStringList QMakeStep::arguments(const QString &buildConfiguration)
arguments << "-r";
#ifdef Q_OS_WIN
ToolChain::ToolChainType type = m_pro->toolChainType(bc);
if (type == ToolChain::GCC_MAEMO)
arguments << QLatin1String("-unix");
#endif
if (bc->value("buildConfiguration").isValid()) {
QStringList configarguments;
QtVersion::QmakeBuildConfig defaultBuildConfiguration = m_pro->qtVersion(bc)->defaultBuildConfig();
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "maemomanager.h"
#include "maemotoolchain.h"
#include "maemorunconfiguration.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/modemanager.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QList>
#include <QtCore/QMutexLocker>
#include <QtGui/QAction>
namespace Qt4ProjectManager {
namespace Internal {
QMutex MaemoManager::m_mutex;
MaemoManager *MaemoManager::m_instance = 0;
const QSize iconSize = QSize(24, 20);
MaemoManager::MaemoManager()
: QObject(0)
, m_runControlFactory(new MaemoRunControlFactory(this))
, m_runConfigurationFactory(new MaemoRunConfigurationFactory(this))
, m_qemuCommand(0)
{
icon.addFile(":/qt-maemo/images/qemu-run.png", iconSize);
icon.addFile(":/qt-maemo/images/qemu-stop.png", iconSize, QIcon::Normal,
QIcon::On);
ExtensionSystem::PluginManager::instance()->addObject(m_runControlFactory);
ExtensionSystem::PluginManager::instance()->addObject(m_runConfigurationFactory);
}
MaemoManager::~MaemoManager()
{
ExtensionSystem::PluginManager::instance()->removeObject(m_runControlFactory);
ExtensionSystem::PluginManager::instance()->removeObject(m_runConfigurationFactory);
}
MaemoManager *MaemoManager::instance()
{
if (!m_instance) {
QMutexLocker _(&m_mutex);
if (!m_instance)
m_instance = new MaemoManager;
}
return m_instance;
}
ProjectExplorer::ToolChain*
MaemoManager::maemoToolChain(const QtVersion *version) const
{
return new MaemoToolChain(version);
}
void
MaemoManager::addQemuSimulatorStarter(Project *project)
{
projects.insert(project);
if (m_qemuCommand) {
m_qemuCommand->action()->setVisible(true);
return;
}
Core::ICore *core = Core::ICore::instance();
Core::ModeManager *modeManager = core->modeManager();
Core::ActionManager *actionManager = core->actionManager();
QAction *action = new QAction("Qemu", this);
action->setIcon(icon.pixmap(iconSize));
action->setToolTip(tr("Start Qemu"));
m_qemuCommand = actionManager->registerAction(action, "qemu",
QList<int>() << Core::Constants::C_GLOBAL_ID);
modeManager->addAction(m_qemuCommand, 1);
m_qemuCommand->action()->setEnabled(true);
m_qemuCommand->setAttribute(Core::Command::CA_UpdateText);
m_qemuCommand->setAttribute(Core::Command::CA_UpdateIcon);
connect(m_qemuCommand->action(), SIGNAL(triggered()), this, SLOT(triggered()));
}
void
MaemoManager::removeQemuSimulatorStarter(Project *project)
{
projects.remove(project);
if (projects.isEmpty() && m_qemuCommand)
m_qemuCommand->action()->setVisible(false);
}
void
MaemoManager::setQemuSimulatorStarterEnabled(bool enable)
{
if (m_qemuCommand)
m_qemuCommand->action()->setEnabled(enable);
}
void
MaemoManager::triggered()
{
emit startStopQemu();
}
void
MaemoManager::updateQemuSimulatorStarter(bool running)
{
if (m_qemuCommand) {
QIcon::State state = QIcon::Off;
QString toolTip(tr("Start Qemu"));
if (running) {
state = QIcon::On;
toolTip = tr("Stop Qemu");
}
QAction *action = m_qemuCommand->action();
action->setToolTip(toolTip);
action->setIcon(icon.pixmap(iconSize, QIcon::Normal, state));
}
}
} // namespace Internal
} // namespace Qt4ProjectManager
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef MAEMOMANAGER_H
#define MAEMOMANAGER_H
#include "qtversionmanager.h"
#include <coreplugin/actionmanager/command.h>
#include <QtCore/QMutex>
#include <QtCore/QObject>
#include <QtCore/QSet>
#include <QtGui/QIcon>
QT_BEGIN_NAMESPACE
class QAction;
QT_END_NAMESPACE
namespace ProjectExplorer {
class Project;
class ToolChain;
}
using ProjectExplorer::Project;
using ProjectExplorer::ToolChain;
namespace Qt4ProjectManager {
class QtVersion;
namespace Internal {
class MaemoRunControlFactory;
class MaemoRunConfigurationFactory;
class MaemoManager : public QObject
{
Q_OBJECT
public:
static MaemoManager *instance();
void addVersion(const Qt4ProjectManager::QtVersion *version) { Q_UNUSED(version); }
ToolChain *maemoToolChain(const Qt4ProjectManager::QtVersion *version) const;
void addQemuSimulatorStarter(Project *project);
void removeQemuSimulatorStarter(Project *project);
void setQemuSimulatorStarterEnabled(bool state);
public slots:
void triggered();
void updateQemuSimulatorStarter(bool running);
signals:
void startStopQemu();
private:
MaemoManager();
~MaemoManager();
private:
static QMutex m_mutex;
static MaemoManager *m_instance;
MaemoRunControlFactory *m_runControlFactory;
MaemoRunConfigurationFactory *m_runConfigurationFactory;
QIcon icon;
int m_runCount;
QSet<Project*> projects;
Core::Command *m_qemuCommand;
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // MAEMOMANAGER_H
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef MAEMORUNCONFIGURATION_H
#define MAEMORUNCONFIGURATION_H
#include <QtCore/QDateTime>
#include <QtGui/QWidget>
#include <debugger/debuggermanager.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/applicationlauncher.h>
namespace Qt4ProjectManager {
class Qt4Project;
namespace Internal {
class MaemoManager;
class MaemoToolChain;
using namespace ProjectExplorer;
typedef QSharedPointer<RunConfiguration> RunConfig;
#define USE_SSL_PASSWORD 0
class ErrorDumper : public QObject
{
Q_OBJECT
public:
ErrorDumper(QObject *parent = 0)
: QObject(parent) {}
public slots:
void printToStream(QProcess::ProcessError error);
};
class MaemoRunConfiguration : public RunConfiguration
{
Q_OBJECT
public:
MaemoRunConfiguration(Project *project, const QString &proFilePath);
~MaemoRunConfiguration();
QString type() const;
bool isEnabled() const;
QWidget *configurationWidget();
Qt4Project *project() const;
void save(ProjectExplorer::PersistentSettingsWriter &writer) const;
void restore(const ProjectExplorer::PersistentSettingsReader &reader);
bool currentlyNeedsDeployment() const;
void wasDeployed();
bool hasDebuggingHelpers() const;
bool debuggingHelpersNeedDeployment() const;
void debuggingHelpersDeployed();
QString maddeRoot() const;
QString executable() const;
const QString sysRoot() const;
const QStringList arguments() const { return m_arguments; }
void setArguments(const QStringList &args);
QString simulator() const;
QString simulatorArgs() const;
QString simulatorPath() const;
QString visibleSimulatorParameter() const;
bool remoteHostIsSimulator() const { return m_remoteHostIsSimulator; }
const QString remoteHostName() const { return m_remoteHostName; }
const QString remoteUserName() const { return m_remoteUserName; }
int remotePort() const { return m_remotePort > 0 ? m_remotePort : 22; }
const QString remoteDir() const;
const QString sshCmd() const;
const QString scpCmd() const;
const QString gdbCmd() const;
const QString dumperLib() const;
void setRemoteHostIsSimulator(bool isSimulator);
void setRemoteHostName(const QString &hostName);
void setRemoteUserName(const QString &userName);
void setRemotePort(int port);
bool isQemuRunning() const;
#if USE_SSL_PASSWORD
// Only valid if remoteHostRequiresPassword() == true.
void setRemotePassword(const QString &password);
const QString remoteUserPassword() const { return m_remoteUserPassword; }
void setRemoteHostRequiresPassword(bool requiresPassword);
bool remoteHostRequiresPassword() const { return m_remoteHostRequiresPassword; }
#endif
signals:
void targetInformationChanged();
void cachedSimulatorInformationChanged();
void qemuProcessStatus(bool running);
private slots:
void invalidateCachedTargetInformation();
void setSimulatorPath(const QString &path);
void invalidateCachedSimulatorInformation();
void startStopQemu();
void qemuProcessFinished();
void enabledStateChanged();
private:
void updateTarget();
void updateSimulatorInformation();
const QString cmd(const QString &cmdName) const;
const MaemoToolChain *toolchain() const;
bool fileNeedsDeployment(const QString &path, const QDateTime &lastDeployed) const;
private:
// Keys for saving/loading attributes.
static const QString ArgumentsKey;
static const QString RemoteHostIsSimulatorKey;
static const QString RemoteHostRequiresPasswordKey;
static const QString RemoteHostNameKey;
static const QString RemoteUserNameKey;
static const QString RemoteUserPasswordKey;
static const QString RemotePortKey;
static const QString LastDeployedKey;
static const QString DebuggingHelpersLastDeployedKey;
QString m_executable;
QString m_proFilePath;
bool m_cachedTargetInformationValid;
QStringList m_arguments;
QString m_simulator;
QString m_simulatorArgs;
QString m_simulatorPath;
QString m_visibleSimulatorParameter;
bool m_cachedSimulatorInformationValid;
QString m_gdbPath;
// Information about the remote host.
bool m_remoteHostIsSimulator;
QString m_remoteHostName;
QString m_remoteUserName;