Commit c6779be8 authored by Friedemann Kleint's avatar Friedemann Kleint

Debugger[Symbian]: Remove Symbian/trk options page.

parent 4c802ee1
......@@ -3,9 +3,6 @@ HEADERS += \
$$PWD/gdbengine.h \
$$PWD/gdboptionspage.h \
$$PWD/gdbchooserwidget.h \
$$PWD/trkoptions.h \
$$PWD/trkoptionswidget.h \
$$PWD/trkoptionspage.h \
$$PWD/abstractgdbadapter.h \
$$PWD/attachgdbadapter.h \
$$PWD/coregdbadapter.h \
......@@ -22,9 +19,6 @@ SOURCES += \
$$PWD/pythongdbengine.cpp \
$$PWD/gdboptionspage.cpp \
$$PWD/gdbchooserwidget.cpp \
$$PWD/trkoptions.cpp \
$$PWD/trkoptionswidget.cpp \
$$PWD/trkoptionspage.cpp \
$$PWD/abstractgdbadapter.cpp \
$$PWD/attachgdbadapter.cpp \
$$PWD/coregdbadapter.cpp \
......@@ -34,7 +28,6 @@ SOURCES += \
$$PWD/trkgdbadapter.cpp \
$$PWD/s60debuggerbluetoothstarter.cpp
FORMS += $$PWD/gdboptionspage.ui \
$$PWD/trkoptionswidget.ui
FORMS += $$PWD/gdboptionspage.ui
RESOURCES += $$PWD/gdb.qrc
......@@ -31,8 +31,6 @@
#include "gdbengine.h"
#include "gdboptionspage.h"
#include "trkoptions.h"
#include "trkoptionspage.h"
#include "debuggeruiswitcher.h"
#include "debuggermainwindow.h"
......@@ -176,8 +174,6 @@ GdbEngine::GdbEngine(DebuggerManager *manager) :
IDebuggerEngine(manager),
m_gdbBinaryToolChainMap(DebuggerSettings::instance()->gdbBinaryToolChainMap())
{
m_trkOptions = QSharedPointer<TrkOptions>(new TrkOptions);
m_trkOptions->fromSettings(Core::ICore::instance()->settings());
m_gdbAdapter = 0;
m_progress = 0;
......@@ -1714,22 +1710,19 @@ int GdbEngine::currentFrame() const
return manager()->stackHandler()->currentIndex();
}
static inline QString msgNoBinaryForToolChain(int tc)
{
const ProjectExplorer::ToolChain::ToolChainType toolChain = static_cast<ProjectExplorer::ToolChain::ToolChainType>(tc);
const QString toolChainName = ProjectExplorer::ToolChain::toolChainName(toolChain);
return GdbEngine::tr("There is no gdb binary available for '%1'").arg(toolChainName);
}
bool GdbEngine::checkConfiguration(int toolChain, QString *errorMessage, QString *settingsPage) const
{
switch (toolChain) {
case ProjectExplorer::ToolChain::WINSCW: // S60
case ProjectExplorer::ToolChain::GCCE:
case ProjectExplorer::ToolChain::RVCT_ARMV5:
case ProjectExplorer::ToolChain::RVCT_ARMV6:
case ProjectExplorer::ToolChain::RVCT_ARMV5_GNUPOC:
case ProjectExplorer::ToolChain::GCCE_GNUPOC:
if (!m_trkOptions->check(errorMessage)) {
if (settingsPage)
*settingsPage = TrkOptionsPage::settingsId();
return false;
}
default:
break;
if (m_gdbBinaryToolChainMap->key(toolChain).isEmpty()) {
*errorMessage = msgNoBinaryForToolChain(toolChain);
*settingsPage = GdbOptionsPage::settingsId();
return false;
}
return true;
}
......@@ -1743,13 +1736,13 @@ AbstractGdbAdapter *GdbEngine::createAdapter(const DebuggerStartParametersPtr &s
case ProjectExplorer::ToolChain::RVCT_ARMV6:
case ProjectExplorer::ToolChain::RVCT_ARMV5_GNUPOC:
case ProjectExplorer::ToolChain::GCCE_GNUPOC:
return new TrkGdbAdapter(this, m_trkOptions);
return new TrkGdbAdapter(this);
default:
break;
}
// @todo: remove testing hack
if (sp->processArgs.size() == 3 && sp->processArgs.at(0) == _("@sym@"))
return new TrkGdbAdapter(this, m_trkOptions);
return new TrkGdbAdapter(this);
switch (sp->startMode) {
case AttachCore:
return new CoreGdbAdapter(this);
......@@ -4044,10 +4037,8 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
if (m_gdb.isEmpty())
m_gdb = gdb;
if (m_gdb.isEmpty()) {
const ProjectExplorer::ToolChain::ToolChainType toolChain = static_cast<ProjectExplorer::ToolChain::ToolChainType>(m_startParameters->toolChainType);
const QString toolChainName = ProjectExplorer::ToolChain::toolChainName(toolChain);
const QString msg = tr("There is no gdb binary available for '%1'").arg(toolChainName);
handleAdapterStartFailed(msg, GdbOptionsPage::settingsId());
handleAdapterStartFailed(msgNoBinaryForToolChain(m_startParameters->toolChainType),
GdbOptionsPage::settingsId());
return false;
}
debugMessage(_("STARTING GDB ") + m_gdb);
......@@ -4348,7 +4339,6 @@ void GdbEngine::handleAdapterCrashed(const QString &msg)
void GdbEngine::addOptionPages(QList<Core::IOptionsPage *> *opts) const
{
opts->push_back(new GdbOptionsPage(m_gdbBinaryToolChainMap));
opts->push_back(new TrkOptionsPage(m_trkOptions));
}
QMessageBox *GdbEngine::showMessageBox(int icon, const QString &title,
......
......@@ -71,7 +71,6 @@ class CoreGdbAdapter;
class PlainGdbAdapter;
class RemoteGdbAdapter;
class TrkGdbAdapter;
struct TrkOptions;
enum DebuggingHelperState
{
......@@ -125,7 +124,6 @@ private: ////////// General State //////////
Q_SLOT void setAutoDerefPointers(const QVariant &on);
DebuggerStartParametersPtr m_startParameters;
QSharedPointer<TrkOptions> m_trkOptions;
bool m_registerNamesListed;
private: ////////// Gdb Process Management //////////
......
......@@ -30,7 +30,6 @@
#include "s60debuggerbluetoothstarter.h"
#include "bluetoothlistener.h"
#include "debuggermanager.h"
#include "trkoptions.h"
#include "trkdevice.h"
namespace Debugger {
......
......@@ -30,8 +30,6 @@
#include "trkgdbadapter.h"
#include "launcher.h"
#include "trkoptions.h"
#include "trkoptionspage.h"
#include "symbiandevicemanager.h"
#include "s60debuggerbluetoothstarter.h"
#include "bluetoothlistener_gui.h"
......@@ -238,11 +236,9 @@ void Snapshot::insertMemory(const MemoryRange &range, const QByteArray &ba)
//
///////////////////////////////////////////////////////////////////////////
TrkGdbAdapter::TrkGdbAdapter(GdbEngine *engine, const TrkOptionsPtr &options) :
TrkGdbAdapter::TrkGdbAdapter(GdbEngine *engine) :
AbstractGdbAdapter(engine),
m_options(options),
m_running(false),
m_deviceFromSymbianDeviceManager(false),
m_gdbAckMode(true),
m_verbose(0)
{
......@@ -1682,7 +1678,7 @@ void TrkGdbAdapter::slotStartGdb()
{
QStringList gdbArgs;
gdbArgs.append(QLatin1String("--nx")); // Do not read .gdbinit file
if (!m_engine->startGdb(gdbArgs, m_options->gdb, TrkOptionsPage::settingsId())) {
if (!m_engine->startGdb(gdbArgs, QString(), QString())) {
cleanup();
return;
}
......@@ -1714,8 +1710,7 @@ void TrkGdbAdapter::interruptInferior()
void TrkGdbAdapter::trkDeviceRemoved(const SymbianUtils::SymbianDevice &dev)
{
if (state() != DebuggerNotReady && m_deviceFromSymbianDeviceManager
&& !m_trkDevice.isNull() && m_trkDevice->port() == dev.portName()) {
if (state() != DebuggerNotReady && !m_trkDevice.isNull() && m_trkDevice->port() == dev.portName()) {
const QString message = QString::fromLatin1("Device '%1' has been disconnected.").arg(dev.friendlyName());
logMessage(message);
emit adapterCrashed(message);
......@@ -1724,24 +1719,18 @@ void TrkGdbAdapter::trkDeviceRemoved(const SymbianUtils::SymbianDevice &dev)
bool TrkGdbAdapter::initializeDevice(const QString &remoteChannel, QString *errorMessage)
{
m_deviceFromSymbianDeviceManager = false;
if (remoteChannel.isEmpty()) {
// Obtain device from settings page
m_trkDevice = TrkDevicePtr(new TrkDevice);
m_trkDevice->setPort(m_options->mode == TrkOptions::BlueTooth ?
m_options->blueToothDevice : m_options->serialPort);
m_trkDevice->setSerialFrame(m_options->mode != TrkOptions::BlueTooth);
} else {
// Run config: Acquire from device manager.
m_trkDevice = SymbianUtils::SymbianDeviceManager::instance()->acquireDevice(remoteChannel);
if (m_trkDevice.isNull()) {
*errorMessage = tr("Unable to acquire a device on '%1'. It appears to be in use.").arg(remoteChannel);
return false;
}
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)),
this, SLOT(trkDeviceRemoved(SymbianUtils::SymbianDevice)));
m_deviceFromSymbianDeviceManager = true;
*errorMessage = tr("Port specification missing.");
return false;
}
// Run config: Acquire from device manager.
m_trkDevice = SymbianUtils::SymbianDeviceManager::instance()->acquireDevice(remoteChannel);
if (m_trkDevice.isNull()) {
*errorMessage = tr("Unable to acquire a device on '%1'. It appears to be in use.").arg(remoteChannel);
return false;
}
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)),
this, SLOT(trkDeviceRemoved(SymbianUtils::SymbianDevice)));
connect(m_trkDevice.data(), SIGNAL(messageReceived(trk::TrkResult)),
this, SLOT(handleTrkResult(trk::TrkResult)));
connect(m_trkDevice.data(), SIGNAL(error(QString)),
......@@ -1796,7 +1785,7 @@ void TrkGdbAdapter::startAdapter()
emit adapterStartFailed(QString(), QString());
} else {
logMessage(message);
emit adapterStartFailed(message, TrkOptionsPage::settingsId());
emit adapterStartFailed(message, QString());
}
return;
}
......@@ -1809,7 +1798,7 @@ void TrkGdbAdapter::startAdapter()
QString msg = QString("Unable to start the gdb server at %1: %2.")
.arg(m_gdbServerName).arg(m_gdbServer->errorString());
logMessage(msg);
emit adapterStartFailed(msg, TrkOptionsPage::settingsId());
emit adapterStartFailed(msg, QString());
return;
}
......@@ -2133,11 +2122,8 @@ void TrkGdbAdapter::cleanup()
{
if (!m_trkDevice.isNull()) {
m_trkDevice->close();
if (m_deviceFromSymbianDeviceManager) {
m_trkDevice->disconnect(this);
SymbianUtils::SymbianDeviceManager::instance()->releaseDevice(m_trkDevice->port());
m_deviceFromSymbianDeviceManager = false;
}
m_trkDevice->disconnect(this);
SymbianUtils::SymbianDeviceManager::instance()->releaseDevice(m_trkDevice->port());
m_trkDevice = TrkDevicePtr();
}
......
......@@ -34,7 +34,6 @@
#include "trkutils.h"
#include "trkdevice.h"
#include "trkoptions.h"
#include "launcher.h"
#include <QtCore/QHash>
......@@ -143,9 +142,8 @@ public:
typedef trk::TrkResult TrkResult;
typedef trk::Callback<const TrkResult &> TrkCallback;
typedef trk::Callback<const GdbResult &> GdbCallback;
typedef QSharedPointer<TrkOptions> TrkOptionsPtr;
TrkGdbAdapter(GdbEngine *engine, const TrkOptionsPtr &options);
TrkGdbAdapter(GdbEngine *engine);
~TrkGdbAdapter();
void setGdbServerName(const QString &name);
QString gdbServerName() const { return m_gdbServerName; }
......@@ -162,8 +160,6 @@ signals:
void output(const QString &msg);
private:
const TrkOptionsPtr m_options;
QString m_gdbServerName; // 127.0.0.1:(2222+uid)
bool m_running;
......@@ -264,7 +260,6 @@ private:
Q_SLOT void trkDeviceRemoved(const SymbianUtils::SymbianDevice &);
QSharedPointer<trk::TrkDevice> m_trkDevice;
bool m_deviceFromSymbianDeviceManager;
QString m_adapterFailMessage;
//
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 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.
**
**************************************************************************/
#include "trkoptions.h"
#include <utils/synchronousprocess.h>
#include <QtCore/QSettings>
#include <QtCore/QFileInfo>
#include <QtCore/QCoreApplication>
#ifdef Q_OS_WIN
# define SERIALPORT_ROOT "COM"
enum { firstSerialPort = 1, lastSerialPort = 12 };
enum { modeDefault = Debugger::Internal::TrkOptions::Serial };
static const char *serialPortDefaultC = SERIALPORT_ROOT"1";
static const char *gdbDefaultC = "gdb-arm-none-symbianelf.exe";
#else
# define SERIALPORT_ROOT "/dev/ttyS"
enum { firstSerialPort = 0, lastSerialPort = 3 };
enum { modeDefault = Debugger::Internal::TrkOptions::BlueTooth };
static const char *serialPortDefaultC = SERIALPORT_ROOT"0";
static const char *gdbDefaultC = "gdb-arm-none-symbianelf";
#endif
static const char *settingsGroupC = "S60Debugger";
static const char *serialPortKeyC = "Port";
static const char *modeKeyC = "Mode";
static const char *blueToothDeviceKeyC = "BlueToothDevice";
static const char *blueToothDeviceDefaultC = "/dev/rfcomm0";
static const char *gdbKeyC = "gdb";
namespace Debugger {
namespace Internal {
TrkOptions::TrkOptions() :
mode(modeDefault),
serialPort(QLatin1String(serialPortDefaultC)),
blueToothDevice(QLatin1String(blueToothDeviceDefaultC)),
gdb(QLatin1String(gdbDefaultC))
{
}
void TrkOptions::fromSettings(const QSettings *s)
{
const QString keyRoot = QLatin1String(settingsGroupC) + QLatin1Char('/');
mode = s->value(keyRoot + QLatin1String(modeKeyC), modeDefault).toInt();
serialPort = s->value(keyRoot + QLatin1String(serialPortKeyC), QLatin1String(serialPortDefaultC)).toString();
gdb = s->value(keyRoot + QLatin1String(gdbKeyC),QLatin1String(gdbDefaultC)).toString();
blueToothDevice = s->value(keyRoot + QLatin1String(blueToothDeviceKeyC), QLatin1String(blueToothDeviceDefaultC)).toString();
}
void TrkOptions::toSettings(QSettings *s) const
{
s->beginGroup(QLatin1String(settingsGroupC));
s->setValue(QLatin1String(modeKeyC), mode);
s->setValue(QLatin1String(serialPortKeyC), serialPort);
s->setValue(QLatin1String(blueToothDeviceKeyC), blueToothDevice);
s->setValue(QLatin1String(gdbKeyC), gdb);
s->endGroup();
}
bool TrkOptions::check(QString *errorMessage) const
{
if (gdb.isEmpty()) {
*errorMessage = QCoreApplication::translate("TrkOptions", "No Symbian gdb executable specified.");
return false;
}
const QString expanded = Utils::SynchronousProcess::locateBinary(gdb);
if (expanded.isEmpty()) {
*errorMessage = QCoreApplication::translate("TrkOptions", "The Symbian gdb executable '%1' could not be found in the search path.").arg(gdb);
return false;
}
return true;
}
bool TrkOptions::equals(const TrkOptions &o) const
{
return mode == o.mode
&& serialPort == o.serialPort
&& blueToothDevice == o.blueToothDevice
&& gdb == o.gdb;
}
QStringList TrkOptions::serialPorts()
{
QStringList rc;
const QString root = QLatin1String(SERIALPORT_ROOT);
for (int p = firstSerialPort; p != lastSerialPort; p++)
rc.push_back(root + QString::number(p));
return rc;
}
QStringList TrkOptions::blueToothDevices()
{
QStringList rc;
rc.push_back(QLatin1String(blueToothDeviceDefaultC));
return rc;
}
} // namespace Internal
} // namespace Debugger
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 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 TRKOPTIONS_H
#define TRKOPTIONS_H
#include <QtCore/QStringList>
QT_BEGIN_NAMESPACE
class QSettings;
QT_END_NAMESPACE
namespace Debugger {
namespace Internal {
/* Parameter to be used for debugging S60 via TRK.
* GDB is a Symbian-ARM Gdb.
* Communication happens either via BlueTooth (Linux only) or
* serial ports. */
struct TrkOptions
{
// Matches the communication enumeration from the S60 devices listener.
enum Mode { Serial, BlueTooth };
TrkOptions();
void fromSettings(const QSettings *s);
void toSettings(QSettings *s) const;
bool equals(const TrkOptions &o) const;
bool check(QString *errorMessage) const;
// Lists of choices for the devices
static QStringList serialPorts();
static QStringList blueToothDevices();
int mode;
QString serialPort;
QString blueToothDevice;
QString gdb;
};
inline bool operator==(const TrkOptions &o1, const TrkOptions &o2)
{
return o1.equals(o2);
}
inline bool operator!=(const TrkOptions &o1, const TrkOptions &o2)
{
return !o1.equals(o2);
}
} // namespace Internal
} // namespace Debugger
#endif // TRKOPTIONS_H
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 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.
**
**************************************************************************/
#include "trkoptionspage.h"
#include "trkoptionswidget.h"
#include "trkoptions.h"
#include "debuggerconstants.h"
#include <coreplugin/icore.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QSettings>
namespace Debugger {
namespace Internal {
TrkOptionsPage::TrkOptionsPage(const TrkOptionsPtr &options) :
m_options(options)
{
}
TrkOptionsPage::~TrkOptionsPage()
{
}
QString TrkOptionsPage::settingsId()
{
return QLatin1String("S.Trk");
}
QString TrkOptionsPage::displayName() const
{
return tr("Symbian");
}
QString TrkOptionsPage::category() const
{
return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
}
QString TrkOptionsPage::displayCategory() const
{
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY);
}
QIcon TrkOptionsPage::categoryIcon() const
{
return QIcon(QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON));
}
QWidget *TrkOptionsPage::createPage(QWidget *parent)
{
if (!m_widget)
m_widget = new TrkOptionsWidget(parent);
m_widget->setTrkOptions(*m_options);
if (m_searchKeywords.isEmpty())
m_searchKeywords = m_widget->searchKeywords();
return m_widget;
}
void TrkOptionsPage::apply()
{
if (!m_widget)
return;
const TrkOptions newOptions = m_widget->trkOptions();
if (newOptions == *m_options)
return;
*m_options = newOptions;
m_options->toSettings(Core::ICore::instance()->settings());
}
void TrkOptionsPage::finish()
{
}
bool TrkOptionsPage::matches(const QString &s) const
{
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
}
} // namespace Internal
} // namespace Designer
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**