Commit 5adb6559 authored by hjk's avatar hjk

debugger: attempt to fix symbian output connections

parent bbf4acf4
......@@ -843,7 +843,7 @@ public slots:
QVariant configValue(const QString &name) const
{ return settings()->value(name); }
ProjectExplorer::RunControl *createDebugger(const DebuggerStartParameters &sp);
DebuggerRunControl *createDebugger(const DebuggerStartParameters &sp);
void startDebugger(ProjectExplorer::RunControl *runControl);
void dumpLog();
......@@ -1914,7 +1914,7 @@ void DebuggerPluginPrivate::showToolTip(ITextEditor *editor, const QPoint &point
notifyCurrentEngine(RequestToolTipByExpressionRole, list);
}
ProjectExplorer::RunControl *
DebuggerRunControl *
DebuggerPluginPrivate::createDebugger(const DebuggerStartParameters &sp)
{
return m_debuggerRunControlFactory->create(sp);
......@@ -1922,8 +1922,8 @@ DebuggerPluginPrivate::createDebugger(const DebuggerStartParameters &sp)
void DebuggerPluginPrivate::startDebugger(ProjectExplorer::RunControl *rc)
{
QTC_ASSERT(rc, return);
DebuggerRunControl *runControl = qobject_cast<DebuggerRunControl *>(rc);
qDebug() << "START DEBUGGER: " << runControl << rc;
QTC_ASSERT(runControl, return);
activateDebugMode();
connectEngine(runControl->engine());
......@@ -2576,7 +2576,7 @@ QWidget *DebuggerPlugin::mainWindow() const
return d->m_uiSwitcher->mainWindow();
}
ProjectExplorer::RunControl *
DebuggerRunControl *
DebuggerPlugin::createDebugger(const DebuggerStartParameters &sp)
{
return instance()->d->createDebugger(sp);
......
......@@ -83,8 +83,7 @@ public:
void readSettings();
void writeSettings() const;
static ProjectExplorer::RunControl *createDebugger
(const DebuggerStartParameters &sp);
static DebuggerRunControl *createDebugger(const DebuggerStartParameters &sp);
static void startDebugger(ProjectExplorer::RunControl *runControl);
QMessageBox *showMessageBox(int icon, const QString &title,
......
......@@ -171,7 +171,7 @@ RunControl *DebuggerRunControlFactory::create
return create(sp, runConfiguration);
}
RunControl *DebuggerRunControlFactory::create(const DebuggerStartParameters &sp,
DebuggerRunControl *DebuggerRunControlFactory::create(const DebuggerStartParameters &sp,
RunConfiguration *runConfiguration)
{
DebuggerRunControl *runControl = new DebuggerRunControl(runConfiguration);
......@@ -369,7 +369,7 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &sp)
break;
default: {
// Could not find anything suitable.
emit debuggingFinished();
debuggingFinished();
// Create Message box with possibility to go to settings
const QString msg = tr("Cannot debug '%1' (tool chain: '%2'): %3")
.arg(sp.executable, toolChainName(sp.toolChainType), m_errorMessage);
......
......@@ -42,6 +42,7 @@ class Environment;
namespace Debugger {
class DebuggerRunControl;
class DebuggerStartParameters;
namespace Internal {
......@@ -69,7 +70,7 @@ public:
// This is used by the "Non-Standard" scenarios, e.g. Attach to Core.
// FIXME: What to do in case of a 0 runConfiguration?
ProjectExplorer::RunControl *create(const DebuggerStartParameters &sp,
DebuggerRunControl *create(const DebuggerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0);
private:
......
......@@ -64,6 +64,7 @@ namespace Internal {
using ProjectExplorer::RunConfiguration;
using ProjectExplorer::ToolChain;
using namespace Debugger;
AbstractMaemoRunControl::AbstractMaemoRunControl(RunConfiguration *rc, QString mode)
: RunControl(rc, mode)
......@@ -383,17 +384,17 @@ void MaemoRunControl::handleRemoteOutput(const QString &output)
MaemoDebugRunControl::MaemoDebugRunControl(RunConfiguration *runConfiguration)
: AbstractMaemoRunControl(runConfiguration, ProjectExplorer::Constants::DEBUGMODE)
, m_debuggerRunControl(0)
, m_startParams(new Debugger::DebuggerStartParameters)
, m_startParams(new DebuggerStartParameters)
{
#ifdef USE_GDBSERVER
m_startParams->startMode = Debugger::AttachToRemote;
m_startParams->startMode = AttachToRemote;
m_startParams->executable = executableOnHost();
m_startParams->debuggerCommand = m_runConfig->gdbCmd();
m_startParams->remoteChannel
= m_devConfig.server.host % QLatin1Char(':') % gdbServerPort();
m_startParams->remoteArchitecture = QLatin1String("arm");
#else
m_startParams->startMode = Debugger::StartRemoteGdb;
m_startParams->startMode = StartRemoteGdb;
m_startParams->executable = executableFilePathOnTarget();
m_startParams->debuggerCommand = QLatin1String("/usr/bin/gdb");
m_startParams->sshserver = m_devConfig.server;
......@@ -405,8 +406,7 @@ MaemoDebugRunControl::MaemoDebugRunControl(RunConfiguration *runConfiguration)
m_startParams->remoteDumperLib = remoteDir().toUtf8() + '/'
+ QFileInfo(m_runConfig->dumperLib()).fileName().toUtf8();
m_debuggerRunControl = qobject_cast<Debugger::DebuggerRunControl *>
(Debugger::DebuggerPlugin::createDebugger(*m_startParams.data()));
m_debuggerRunControl = DebuggerPlugin::createDebugger(*m_startParams.data());
connect(m_debuggerRunControl, SIGNAL(finished()), this,
SLOT(debuggingFinished()), Qt::QueuedConnection);
}
......@@ -453,7 +453,7 @@ void MaemoDebugRunControl::handleRemoteOutput(const QString &output)
void MaemoDebugRunControl::startDebugging()
{
Debugger::DebuggerPlugin::startDebugger(m_debuggerRunControl);
DebuggerPlugin::startDebugger(m_debuggerRunControl);
}
void MaemoDebugRunControl::stopInternal()
......@@ -464,7 +464,7 @@ void MaemoDebugRunControl::stopInternal()
bool MaemoDebugRunControl::isRunning() const
{
return AbstractMaemoRunControl::isRunning()
|| m_debuggerRunControl->state() != Debugger::DebuggerNotReady;
|| m_debuggerRunControl->state() != DebuggerNotReady;
}
void MaemoDebugRunControl::debuggingFinished()
......
......@@ -886,20 +886,13 @@ void S60DeviceRunControl::printRunFailNotice(const QString &errorMessage) {
// ======== S60DeviceDebugRunControl
S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *runConfiguration, QString mode) :
S60DeviceRunControlBase(runConfiguration, mode),
m_startParams(new Debugger::DebuggerStartParameters)
S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *rc, QString mode) :
S60DeviceRunControlBase(rc, mode),
m_startParams(new Debugger::DebuggerStartParameters),
m_debuggerRunControl(0)
{
setReleaseDeviceAfterLauncherFinish(true); // Debugger controls device after install
Debugger::DebuggerPlugin *dm = Debugger::DebuggerPlugin::instance();
S60DeviceRunConfiguration *rc = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
QTC_ASSERT(dm && rc, return);
connect(dm, SIGNAL(debuggingFinished()),
this, SLOT(debuggingFinished()), Qt::QueuedConnection);
connect(dm, SIGNAL(applicationOutputAvailable(QString, bool)),
this, SLOT(printApplicationOutput(QString, bool)),
Qt::QueuedConnection);
QTC_ASSERT(rc, return);
m_startParams->remoteChannel = rc->serialPortName();
m_startParams->processArgs = rc->commandLineArguments();
......@@ -913,19 +906,17 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *ru
}
}
void S60DeviceDebugRunControl::stop()
S60DeviceDebugRunControl::~S60DeviceDebugRunControl()
{
S60DeviceRunControlBase::stop();
Debugger::DebuggerPlugin *dm = Debugger::DebuggerPlugin::instance();
QTC_ASSERT(dm, return)
// FIXME: ABC: that should use the RunControl present in
// handleLauncherFinished
if (dm->state() == Debugger::DebuggerNotReady)
dm->exitDebugger();
// FIXME: Needed? m_debuggerRunControl->deleteLater();
}
S60DeviceDebugRunControl::~S60DeviceDebugRunControl()
void S60DeviceDebugRunControl::stop()
{
S60DeviceRunControlBase::stop();
QTC_ASSERT(m_debuggerRunControl, return)
if (m_debuggerRunControl->state() == Debugger::DebuggerNotReady)
m_debuggerRunControl->stop();
}
void S60DeviceDebugRunControl::initLauncher(const QString &executable, trk::Launcher *launcher)
......@@ -949,9 +940,18 @@ void S60DeviceDebugRunControl::handleLauncherFinished()
{
using namespace Debugger;
emit appendMessage(this, tr("Launching debugger..."), false);
ProjectExplorer::RunControl *rc
= DebuggerPlugin::createDebugger(*m_startParams.data());
DebuggerPlugin::startDebugger(rc);
QTC_ASSERT(m_debuggerRunControl == 0, /* Should happen only once. */);
m_debuggerRunControl = DebuggerPlugin::createDebugger(*m_startParams.data());
connect(m_debuggerRunControl,
SIGNAL(finished()),
SLOT(debuggingFinished()),
Qt::QueuedConnection);
connect(m_debuggerRunControl,
SIGNAL(addToOutputWindowInline(ProjectExplorer::RunControl,QString,bool)),
SIGNAL(addToOutputWindowInline(ProjectExplorer::RunControl,QString,bool)),
Qt::QueuedConnection);
DebuggerPlugin::startDebugger(m_debuggerRunControl);
}
void S60DeviceDebugRunControl::debuggingFinished()
......
......@@ -45,6 +45,7 @@ QT_END_NAMESPACE
namespace Debugger {
class DebuggerStartParameters;
class DebuggerRunControl;
}
namespace SymbianUtils {
......@@ -245,6 +246,7 @@ private slots:
void debuggingFinished();
private:
QSharedPointer<Debugger::DebuggerStartParameters> m_startParams;
Debugger::DebuggerRunControl *m_debuggerRunControl;
QString m_localExecutableFileName;
};
......
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