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