Commit 4d1602cb authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Debugger[CDB]: Re-introduce signal-slot connection for output.

...to fix multithread crash.
Fix exit crash by temporarily removing output.
parent 5b300727
......@@ -119,8 +119,7 @@ static QString msgFunctionFailed(const char *func, const QString &why)
// --- CdbDebugEnginePrivate
CdbDebugEnginePrivate::CdbDebugEnginePrivate(DebuggerManager *manager,
const QSharedPointer<CdbOptions> &options,
CdbDebugEnginePrivate::CdbDebugEnginePrivate(const QSharedPointer<CdbOptions> &options,
CdbDebugEngine *engine) :
m_options(options),
m_hDebuggeeProcess(0),
......@@ -149,7 +148,10 @@ bool CdbDebugEnginePrivate::init(QString *errorMessage)
if (!CdbCore::CoreEngine::init(m_options->path, errorMessage))
return false;
CdbDebugOutput *output = new CdbDebugOutput(m_engine);
CdbDebugOutput *output = new CdbDebugOutput;
connect(output, SIGNAL(showMessage(QString,int,int)),
m_engine, SLOT(showMessage(QString,int,int)),
Qt::QueuedConnection); // Multithread invocation when loading dumpers.
setDebugOutput(DebugOutputBasePtr(output));
setDebugEventCallback(DebugEventCallbackBasePtr(new CdbDebugEventCallback(m_engine)));
updateCodeLevel();
......@@ -212,7 +214,7 @@ void CdbDebugEnginePrivate::cleanStackTrace()
CdbDebugEngine::CdbDebugEngine(DebuggerManager *manager, const QSharedPointer<CdbOptions> &options) :
IDebuggerEngine(manager),
m_d(new CdbDebugEnginePrivate(manager, options, this))
m_d(new CdbDebugEnginePrivate(options, this))
{
m_d->m_consoleStubProc.setMode(Utils::ConsoleProcess::Suspend);
connect(&m_d->m_consoleStubProc, SIGNAL(processMessage(QString,bool)),
......
......@@ -68,8 +68,7 @@ public:
StoppedOther
};
explicit CdbDebugEnginePrivate(DebuggerManager *parent,
const QSharedPointer<CdbOptions> &options,
explicit CdbDebugEnginePrivate(const QSharedPointer<CdbOptions> &options,
CdbDebugEngine* engine);
~CdbDebugEnginePrivate();
bool init(QString *errorMessage);
......
......@@ -28,12 +28,9 @@
**************************************************************************/
#include "cdbdebugoutput.h"
#include "cdbdebugengine.h"
#include "debuggerrunner.h"
#include "cdbdebugengine_p.h"
#include "cdbcom.h"
#include "debuggerrunner.h"
#include <utils/qtcassert.h>
namespace Debugger {
namespace Internal {
......@@ -61,18 +58,15 @@ static int logChannel(ULONG mask)
return LogMisc;
}
CdbDebugOutput::CdbDebugOutput(CdbDebugEngine *engine)
: m_engine(engine)
CdbDebugOutput::CdbDebugOutput()
{
}
void CdbDebugOutput::output(ULONG mask, const QString &msg)
{
DebuggerRunControl *runControl = m_engine->runControl();
QTC_ASSERT(runControl, return);
if (debugCDB > 1)
qDebug() << Q_FUNC_INFO << "\n " << msg;
runControl->showMessage(msg, logChannel(mask));
emit showMessage(msg, logChannel(mask), -1);
}
} // namespace Internal
......
......@@ -37,19 +37,18 @@
namespace Debugger {
namespace Internal {
class CdbDebugEngine;
// Standard CDB output handler
class CdbDebugOutput : public CdbCore::DebugOutputBase
class CdbDebugOutput : public QObject, public CdbCore::DebugOutputBase
{
Q_OBJECT
public:
explicit CdbDebugOutput(CdbDebugEngine *engine);
CdbDebugOutput();
signals:
void showMessage(const QString &output, int channel, int timeout);
protected:
virtual void output(ULONG mask, const QString &message);
private:
CdbDebugEngine *m_engine;
};
} // namespace Internal
......
......@@ -874,7 +874,7 @@ void DebuggerManager::notifyInferiorPidChanged(qint64 pid)
void DebuggerManager::aboutToShutdown()
{
STATE_DEBUG(d->m_engine);
// TODO: STATE_DEBUG(d->m_engine);
if (d->m_engine)
d->m_engine->shutdown();
d->m_engine = 0;
......
......@@ -132,6 +132,7 @@ public:
virtual bool isSynchroneous() const { return false; }
virtual QString qtNamespace() const { return QString(); }
public slots:
// Convenience
void showMessage(const QString &msg, int channel = LogDebug, int timeout = -1) const;
void showStatusMessage(const QString &msg, int timeout = -1) const
......
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