forked from qt-creator/qt-creator
debugger: more of the RunControl refactoring
Pass output through the RunControl instead of the DebuggerManager.
This commit is contained in:
@@ -121,7 +121,7 @@ static QString msgFunctionFailed(const char *func, const QString &why)
|
|||||||
|
|
||||||
CdbDebugEnginePrivate::CdbDebugEnginePrivate(DebuggerManager *manager,
|
CdbDebugEnginePrivate::CdbDebugEnginePrivate(DebuggerManager *manager,
|
||||||
const QSharedPointer<CdbOptions> &options,
|
const QSharedPointer<CdbOptions> &options,
|
||||||
CdbDebugEngine* engine) :
|
CdbDebugEngine *engine) :
|
||||||
m_options(options),
|
m_options(options),
|
||||||
m_hDebuggeeProcess(0),
|
m_hDebuggeeProcess(0),
|
||||||
m_hDebuggeeThread(0),
|
m_hDebuggeeThread(0),
|
||||||
@@ -149,16 +149,12 @@ 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;
|
CdbDebugOutput *output = new CdbDebugOutput(m_engine);
|
||||||
setDebugOutput(DebugOutputBasePtr(output));
|
setDebugOutput(DebugOutputBasePtr(output));
|
||||||
connect(output, SIGNAL(debuggerOutput(int,QString)),
|
connect(output, SIGNAL(debuggerOutput(int,QString)),
|
||||||
manager(), SLOT(showDebuggerOutput(int,QString)));
|
manager(), SLOT(showDebuggerOutput(int,QString)));
|
||||||
connect(output, SIGNAL(debuggerInputPrompt(int,QString)),
|
connect(output, SIGNAL(debuggerInputPrompt(int,QString)),
|
||||||
manager(), SLOT(showDebuggerInput(int,QString)));
|
manager(), SLOT(showDebuggerInput(int,QString)));
|
||||||
connect(output, SIGNAL(debuggeeOutput(QString,bool)),
|
|
||||||
manager(), SLOT(showApplicationOutput(QString,bool)));
|
|
||||||
connect(output, SIGNAL(debuggeeInputPrompt(QString,bool)),
|
|
||||||
manager(), SLOT(showApplicationOutput(QString,bool)));
|
|
||||||
|
|
||||||
setDebugEventCallback(DebugEventCallbackBasePtr(new CdbDebugEventCallback(m_engine)));
|
setDebugEventCallback(DebugEventCallbackBasePtr(new CdbDebugEventCallback(m_engine)));
|
||||||
updateCodeLevel();
|
updateCodeLevel();
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "cdbdebugengine.h"
|
#include "cdbdebugengine.h"
|
||||||
#include "cdbdebugengine_p.h"
|
#include "cdbdebugengine_p.h"
|
||||||
#include "cdbcom.h"
|
#include "cdbcom.h"
|
||||||
|
#include "debuggerrunner.h"
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -62,27 +63,30 @@ static inline OutputKind outputKind(ULONG mask)
|
|||||||
return DebuggerOutput;
|
return DebuggerOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
CdbDebugOutput::CdbDebugOutput()
|
CdbDebugOutput::CdbDebugOutput(CdbDebugEngine *engine)
|
||||||
|
: 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_ASSER(runControl, return);
|
||||||
if (debugCDB > 1)
|
if (debugCDB > 1)
|
||||||
qDebug() << Q_FUNC_INFO << "\n " << msg;
|
qDebug() << Q_FUNC_INFO << "\n " << msg;
|
||||||
|
|
||||||
switch (outputKind(mask)) {
|
switch (outputKind(mask)) {
|
||||||
case DebuggerOutput:
|
case DebuggerOutput:
|
||||||
debuggerOutput(logChannel(mask), msg);
|
runControl->showDebuggerOutput(msg, logChannel(mask));
|
||||||
break;
|
break;
|
||||||
case DebuggerPromptOutput:
|
case DebuggerPromptOutput:
|
||||||
emit debuggerInputPrompt(logChannel(mask), msg);
|
runControl->showDebuggerInput(msg, logChannel(mask));
|
||||||
break;
|
break;
|
||||||
case DebuggeeOutput:
|
case DebuggeeOutput:
|
||||||
emit debuggeeOutput(msg, true);
|
runControl->showApplicationOutput(msg, true);
|
||||||
break;
|
break;
|
||||||
case DebuggeePromptOutput:
|
case DebuggeePromptOutput:
|
||||||
emit debuggeeInputPrompt(msg, false);
|
runControl->showApplicationOutput(msg, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,20 +38,16 @@ namespace Debugger {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
// Standard CDB output handler
|
// Standard CDB output handler
|
||||||
class CdbDebugOutput : public QObject, public CdbCore::DebugOutputBase
|
class CdbDebugOutput : public CdbCore::DebugOutputBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
CdbDebugOutput();
|
explicit CdbDebugOutput(CdbDebugEngine *engine);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void output(ULONG mask, const QString &message);
|
virtual void output(ULONG mask, const QString &message);
|
||||||
|
|
||||||
signals:
|
private:
|
||||||
void debuggerOutput(int channel, const QString &message);
|
CdbDebugEngine *m_engine;
|
||||||
void debuggerInputPrompt(int channel, const QString &message);
|
|
||||||
void debuggeeOutput(const QString &message, bool onStderr);
|
|
||||||
void debuggeeInputPrompt(const QString &message, bool onStderr);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -261,7 +261,9 @@ void DisassemblerViewAgent::setFrame(const StackFrame &frame, bool tryMixed)
|
|||||||
if (it != d->cache.end()) {
|
if (it != d->cache.end()) {
|
||||||
QString msg = _("Use cache disassembler for '%1' in '%2'")
|
QString msg = _("Use cache disassembler for '%1' in '%2'")
|
||||||
.arg(frame.function).arg(frame.file);
|
.arg(frame.function).arg(frame.file);
|
||||||
d->manager->showDebuggerOutput(msg);
|
QTC_ASSERT(d->manager->runControl(), /**/);
|
||||||
|
if (d->manager->runControl())
|
||||||
|
d->manager->runControl()->showDebuggerOutput(msg);
|
||||||
setContents(*it);
|
setContents(*it);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -107,7 +107,7 @@
|
|||||||
// use Q_FUNC_INFO?
|
// use Q_FUNC_INFO?
|
||||||
# define STATE_DEBUG(s) \
|
# define STATE_DEBUG(s) \
|
||||||
do { QString msg; QTextStream ts(&msg); ts << s; \
|
do { QString msg; QTextStream ts(&msg); ts << s; \
|
||||||
showDebuggerOutput(LogDebug, msg); } while (0)
|
showDebuggerOutput(msg, LogDebug); } while (0)
|
||||||
#else
|
#else
|
||||||
# define STATE_DEBUG(s)
|
# define STATE_DEBUG(s)
|
||||||
#endif
|
#endif
|
||||||
@@ -504,12 +504,6 @@ void DebuggerManager::init()
|
|||||||
connect(localsView->header(), SIGNAL(sectionResized(int,int,int)),
|
connect(localsView->header(), SIGNAL(sectionResized(int,int,int)),
|
||||||
this, SLOT(updateWatchersHeader(int,int,int)), Qt::QueuedConnection);
|
this, SLOT(updateWatchersHeader(int,int,int)), Qt::QueuedConnection);
|
||||||
|
|
||||||
// Log
|
|
||||||
connect(this, SIGNAL(emitShowInput(int, QString)),
|
|
||||||
d->m_outputWindow, SLOT(showInput(int, QString)), Qt::QueuedConnection);
|
|
||||||
connect(this, SIGNAL(emitShowOutput(int, QString)),
|
|
||||||
d->m_outputWindow, SLOT(showOutput(int, QString)), Qt::QueuedConnection);
|
|
||||||
|
|
||||||
// Tooltip
|
// Tooltip
|
||||||
qRegisterMetaType<WatchData>("WatchData");
|
qRegisterMetaType<WatchData>("WatchData");
|
||||||
qRegisterMetaType<StackCookie>("StackCookie");
|
qRegisterMetaType<StackCookie>("StackCookie");
|
||||||
@@ -836,7 +830,7 @@ void DebuggerManager::clearStatusMessage()
|
|||||||
void DebuggerManager::showStatusMessage(const QString &msg0, int timeout)
|
void DebuggerManager::showStatusMessage(const QString &msg0, int timeout)
|
||||||
{
|
{
|
||||||
Q_UNUSED(timeout)
|
Q_UNUSED(timeout)
|
||||||
showDebuggerOutput(LogStatus, msg0);
|
showDebuggerOutput(msg0, LogStatus);
|
||||||
QString msg = msg0;
|
QString msg = msg0;
|
||||||
msg.replace(QLatin1Char('\n'), QString());
|
msg.replace(QLatin1Char('\n'), QString());
|
||||||
d->m_statusLabel->setText(msg);
|
d->m_statusLabel->setText(msg);
|
||||||
@@ -877,11 +871,6 @@ void DebuggerManager::notifyInferiorPidChanged(qint64 pid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::showApplicationOutput(const QString &str, bool onStdErr)
|
|
||||||
{
|
|
||||||
emit applicationOutputAvailable(str, onStdErr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerManager::aboutToShutdown()
|
void DebuggerManager::aboutToShutdown()
|
||||||
{
|
{
|
||||||
STATE_DEBUG(d->m_engine);
|
STATE_DEBUG(d->m_engine);
|
||||||
@@ -1071,9 +1060,8 @@ void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl)
|
|||||||
ProjectExplorer::ToolChain::ToolChainType(sp->toolChainType));
|
ProjectExplorer::ToolChain::ToolChainType(sp->toolChainType));
|
||||||
|
|
||||||
d->m_plugin->activateDebugMode();
|
d->m_plugin->activateDebugMode();
|
||||||
showDebuggerOutput(LogStatus,
|
showDebuggerOutput(tr("Starting debugger for tool chain '%1'...").arg(toolChainName), LogStatus);
|
||||||
tr("Starting debugger for tool chain '%1'...").arg(toolChainName));
|
showDebuggerOutput(DebuggerSettings::instance()->dump(), LogDebug);
|
||||||
showDebuggerOutput(LogDebug, DebuggerSettings::instance()->dump());
|
|
||||||
|
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
QString settingsIdHint;
|
QString settingsIdHint;
|
||||||
@@ -1583,31 +1571,12 @@ void DebuggerManager::modulesDockToggled(bool on)
|
|||||||
reloadModules();
|
reloadModules();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerManager::showDebuggerOutput(const QString &msg, int channel)
|
||||||
//////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Output specific stuff
|
|
||||||
//
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void DebuggerManager::showDebuggerOutput(int channel, const QString &msg)
|
|
||||||
{
|
{
|
||||||
if (d->m_outputWindow) {
|
if (runControl())
|
||||||
emit emitShowOutput(channel, msg);
|
runControl()->showDebuggerOutput(msg, channel);
|
||||||
if (channel == LogError)
|
|
||||||
ensureLogVisible();
|
|
||||||
} else {
|
|
||||||
qDebug() << "OUTPUT: " << channel << msg;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerManager::showDebuggerInput(int channel, const QString &msg)
|
|
||||||
{
|
|
||||||
if (d->m_outputWindow)
|
|
||||||
emit emitShowInput(channel, msg);
|
|
||||||
else
|
else
|
||||||
qDebug() << "INPUT: " << channel << msg;
|
qDebug() << "OUTPUT: " << channel << msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1807,7 +1776,7 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
|
|||||||
if (!forced && !isAllowedTransition(d->m_state, state))
|
if (!forced && !isAllowedTransition(d->m_state, state))
|
||||||
qDebug() << "UNEXPECTED STATE TRANSITION: " << msg;
|
qDebug() << "UNEXPECTED STATE TRANSITION: " << msg;
|
||||||
|
|
||||||
showDebuggerOutput(LogDebug, msg);
|
showDebuggerOutput(msg, LogDebug);
|
||||||
|
|
||||||
//resetLocation();
|
//resetLocation();
|
||||||
if (state == d->m_state)
|
if (state == d->m_state)
|
||||||
@@ -2034,6 +2003,12 @@ DebuggerRunControl *DebuggerManager::runControl() const
|
|||||||
return const_cast<DebuggerRunControl *>(d->m_runControl);
|
return const_cast<DebuggerRunControl *>(d->m_runControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebuggerOutputWindow *DebuggerManager::debuggerOutputWindow() const
|
||||||
|
{
|
||||||
|
return d->m_outputWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// AbstractDebuggerEngine
|
// AbstractDebuggerEngine
|
||||||
@@ -2055,6 +2030,7 @@ void IDebuggerEngine::setState(DebuggerState state, bool forced)
|
|||||||
m_manager->setState(state, forced);
|
m_manager->setState(state, forced);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Testing
|
// Testing
|
||||||
|
@@ -235,18 +235,12 @@ public slots:
|
|||||||
static const char *stateName(int s);
|
static const char *stateName(int s);
|
||||||
|
|
||||||
public slots: // FIXME
|
public slots: // FIXME
|
||||||
void showDebuggerOutput(const QString &msg)
|
|
||||||
{ showDebuggerOutput(LogDebug, msg); }
|
|
||||||
void ensureLogVisible();
|
void ensureLogVisible();
|
||||||
void updateWatchersWindow();
|
void updateWatchersWindow();
|
||||||
void updateWatchersHeader(int section, int oldSize, int newSize);
|
void updateWatchersHeader(int section, int oldSize, int newSize);
|
||||||
void activateBreakpoint(int index);
|
void activateBreakpoint(int index);
|
||||||
|
|
||||||
//private slots: // FIXME
|
//private slots: // FIXME
|
||||||
void showDebuggerOutput(int channel, const QString &msg);
|
|
||||||
void showDebuggerInput(int channel, const QString &msg);
|
|
||||||
void showApplicationOutput(const QString &data, bool onStdErr);
|
|
||||||
|
|
||||||
void reloadSourceFiles();
|
void reloadSourceFiles();
|
||||||
void sourceFilesDockToggled(bool on);
|
void sourceFilesDockToggled(bool on);
|
||||||
|
|
||||||
@@ -271,6 +265,7 @@ public:
|
|||||||
Internal::ThreadsHandler *threadsHandler() const;
|
Internal::ThreadsHandler *threadsHandler() const;
|
||||||
Internal::WatchHandler *watchHandler() const;
|
Internal::WatchHandler *watchHandler() const;
|
||||||
Internal::SnapshotHandler *snapshotHandler() const;
|
Internal::SnapshotHandler *snapshotHandler() const;
|
||||||
|
Internal::DebuggerOutputWindow *debuggerOutputWindow() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Internal::SourceFilesWindow *sourceFileWindow() const;
|
Internal::SourceFilesWindow *sourceFileWindow() const;
|
||||||
@@ -316,12 +311,11 @@ signals:
|
|||||||
void statusMessageRequested(const QString &msg, int timeout); // -1 for 'forever'
|
void statusMessageRequested(const QString &msg, int timeout); // -1 for 'forever'
|
||||||
void applicationOutputAvailable(const QString &output, bool onStdErr);
|
void applicationOutputAvailable(const QString &output, bool onStdErr);
|
||||||
void messageAvailable(const QString &output, bool isError);
|
void messageAvailable(const QString &output, bool isError);
|
||||||
void emitShowOutput(int channel, const QString &output);
|
|
||||||
void emitShowInput(int channel, const QString &input);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
// void runTest(const QString &fileName);
|
// void runTest(const QString &fileName);
|
||||||
|
void showDebuggerOutput(const QString &msg, int channel);
|
||||||
Q_SLOT void createNewDock(QWidget *widget);
|
Q_SLOT void createNewDock(QWidget *widget);
|
||||||
|
|
||||||
void aboutToShutdown();
|
void aboutToShutdown();
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "debuggerrunner.h"
|
#include "debuggerrunner.h"
|
||||||
#include "debuggermanager.h"
|
#include "debuggermanager.h"
|
||||||
|
#include "debuggeroutputwindow.h"
|
||||||
|
|
||||||
#include <projectexplorer/debugginghelper.h>
|
#include <projectexplorer/debugginghelper.h>
|
||||||
#include <projectexplorer/environment.h>
|
#include <projectexplorer/environment.h>
|
||||||
@@ -48,6 +49,8 @@
|
|||||||
#include <QtGui/QTextDocument>
|
#include <QtGui/QTextDocument>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Debugger::Internal;
|
||||||
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
|
|
||||||
@@ -147,9 +150,6 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
|
|||||||
connect(m_manager, SIGNAL(debuggingFinished()),
|
connect(m_manager, SIGNAL(debuggingFinished()),
|
||||||
this, SLOT(debuggingFinished()),
|
this, SLOT(debuggingFinished()),
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
connect(m_manager, SIGNAL(applicationOutputAvailable(QString, bool)),
|
|
||||||
this, SLOT(slotAddToOutputWindowInline(QString, bool)),
|
|
||||||
Qt::QueuedConnection);
|
|
||||||
connect(m_manager, SIGNAL(messageAvailable(QString, bool)),
|
connect(m_manager, SIGNAL(messageAvailable(QString, bool)),
|
||||||
this, SLOT(slotMessageAvailable(QString, bool)));
|
this, SLOT(slotMessageAvailable(QString, bool)));
|
||||||
connect(m_manager, SIGNAL(inferiorPidChanged(qint64)),
|
connect(m_manager, SIGNAL(inferiorPidChanged(qint64)),
|
||||||
@@ -161,6 +161,7 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
|
|||||||
if (m_startParameters.environment.empty())
|
if (m_startParameters.environment.empty())
|
||||||
m_startParameters.environment = ProjectExplorer::Environment().toStringList();
|
m_startParameters.environment = ProjectExplorer::Environment().toStringList();
|
||||||
m_startParameters.useTerminal = false;
|
m_startParameters.useTerminal = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DebuggerRunControl::displayName() const
|
QString DebuggerRunControl::displayName() const
|
||||||
@@ -183,21 +184,19 @@ void DebuggerRunControl::start()
|
|||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
QString settingsCategory;
|
QString settingsCategory;
|
||||||
QString settingsPage;
|
QString settingsPage;
|
||||||
if (m_manager->checkDebugConfiguration(m_startParameters.toolChainType, &errorMessage,
|
if (m_manager->checkDebugConfiguration(m_startParameters.toolChainType,
|
||||||
&settingsCategory, &settingsPage)) {
|
&errorMessage, &settingsCategory, &settingsPage)) {
|
||||||
m_manager->startNewDebugger(this);
|
m_manager->startNewDebugger(this);
|
||||||
emit started();
|
emit started();
|
||||||
} else {
|
} else {
|
||||||
appendMessage(this, errorMessage, true);
|
appendMessage(this, errorMessage, true);
|
||||||
emit finished();
|
emit finished();
|
||||||
Core::ICore::instance()->showWarningWithOptions(tr("Debugger"), errorMessage,
|
Core::ICore::instance()->showWarningWithOptions(tr("Debugger"),
|
||||||
QString(),
|
errorMessage, QString(), settingsCategory, settingsPage);
|
||||||
settingsCategory, settingsPage);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data,
|
void DebuggerRunControl::showApplicationOutput(const QString &data, bool onStdErr)
|
||||||
bool onStdErr)
|
|
||||||
{
|
{
|
||||||
emit addToOutputWindowInline(this, data, onStdErr);
|
emit addToOutputWindowInline(this, data, onStdErr);
|
||||||
}
|
}
|
||||||
@@ -207,6 +206,20 @@ void DebuggerRunControl::slotMessageAvailable(const QString &data, bool isError)
|
|||||||
emit appendMessage(this, data, isError);
|
emit appendMessage(this, data, isError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerRunControl::showDebuggerOutput(const QString &output, int channel)
|
||||||
|
{
|
||||||
|
DebuggerOutputWindow *ow = m_manager->debuggerOutputWindow();
|
||||||
|
QTC_ASSERT(ow, return);
|
||||||
|
ow->showOutput(channel, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerRunControl::showDebuggerInput(const QString &input, int channel)
|
||||||
|
{
|
||||||
|
DebuggerOutputWindow *ow = m_manager->debuggerOutputWindow();
|
||||||
|
QTC_ASSERT(ow, return);
|
||||||
|
ow->showInput(channel, input);
|
||||||
|
}
|
||||||
|
|
||||||
void DebuggerRunControl::stop()
|
void DebuggerRunControl::stop()
|
||||||
{
|
{
|
||||||
m_running = false;
|
m_running = false;
|
||||||
|
@@ -129,14 +129,20 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void stopRequested();
|
void stopRequested();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void showDebuggerOutput(const QString &msg)
|
||||||
|
{ showDebuggerOutput(msg, LogDebug); }
|
||||||
|
void showApplicationOutput(const QString &output, bool onStdErr);
|
||||||
|
void showDebuggerOutput(const QString &output, int channel);
|
||||||
|
void showDebuggerInput(const QString &input, int channel);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotAddToOutputWindowInline(const QString &output, bool onStdErr);
|
|
||||||
void slotMessageAvailable(const QString &data, bool isError);
|
void slotMessageAvailable(const QString &data, bool isError);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
DebuggerManager *m_manager;
|
|
||||||
DebuggerStartParameters m_startParameters;
|
DebuggerStartParameters m_startParameters;
|
||||||
|
DebuggerManager *m_manager;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -107,7 +107,7 @@ protected:
|
|||||||
{ m_engine->setState(state); }
|
{ m_engine->setState(state); }
|
||||||
const DebuggerStartParameters &startParameters() const
|
const DebuggerStartParameters &startParameters() const
|
||||||
{ return m_engine->startParameters(); }
|
{ return m_engine->startParameters(); }
|
||||||
const DebuggerRunControl *runControl() const
|
DebuggerRunControl *runControl() const
|
||||||
{ return m_engine->runControl(); }
|
{ return m_engine->runControl(); }
|
||||||
void debugMessage(const QString &msg) const
|
void debugMessage(const QString &msg) const
|
||||||
{ m_engine->debugMessage(msg); }
|
{ m_engine->debugMessage(msg); }
|
||||||
|
@@ -160,8 +160,8 @@ void GdbEngine::runDebuggingHelperClassic(const WatchData &data0, bool dumpChild
|
|||||||
// Avoid endless loops created by faulty dumpers.
|
// Avoid endless loops created by faulty dumpers.
|
||||||
QByteArray processedName = QByteArray::number(dumpChildren) + '-' + data.iname;
|
QByteArray processedName = QByteArray::number(dumpChildren) + '-' + data.iname;
|
||||||
if (m_processedNames.contains(processedName)) {
|
if (m_processedNames.contains(processedName)) {
|
||||||
showDebuggerInput(LogStatus,
|
showDebuggerInput(
|
||||||
_("<Breaking endless loop for " + data.iname + '>'));
|
_("<Breaking endless loop for " + data.iname + '>'), LogStatus);
|
||||||
data.setAllUnneeded();
|
data.setAllUnneeded();
|
||||||
data.setValue(_("<unavailable>"));
|
data.setValue(_("<unavailable>"));
|
||||||
data.setHasChildren(false);
|
data.setHasChildren(false);
|
||||||
|
@@ -343,7 +343,7 @@ void GdbEngine::readDebugeeOutput(const QByteArray &data)
|
|||||||
|
|
||||||
void GdbEngine::debugMessage(const QString &msg)
|
void GdbEngine::debugMessage(const QString &msg)
|
||||||
{
|
{
|
||||||
showDebuggerOutput(LogDebug, msg);
|
showDebuggerOutput(msg, LogDebug);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleResponse(const QByteArray &buff)
|
void GdbEngine::handleResponse(const QByteArray &buff)
|
||||||
@@ -351,8 +351,8 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
static QTime lastTime;
|
static QTime lastTime;
|
||||||
|
|
||||||
if (theDebuggerBoolSetting(LogTimeStamps))
|
if (theDebuggerBoolSetting(LogTimeStamps))
|
||||||
showDebuggerOutput(LogTime, currentTime());
|
showDebuggerOutput(currentTime(), LogTime);
|
||||||
showDebuggerOutput(LogOutput, QString::fromLocal8Bit(buff, buff.length()));
|
showDebuggerOutput(QString::fromLocal8Bit(buff, buff.length()), LogOutput);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
qDebug() // << "#### start response handling #### "
|
qDebug() // << "#### start response handling #### "
|
||||||
@@ -824,7 +824,7 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0)
|
|||||||
{
|
{
|
||||||
GdbCommand cmd = cmd0;
|
GdbCommand cmd = cmd0;
|
||||||
if (state() == DebuggerNotReady) {
|
if (state() == DebuggerNotReady) {
|
||||||
showDebuggerInput(LogInput, _(cmd.command));
|
showDebuggerInput(_(cmd.command), LogInput);
|
||||||
debugMessage(_("GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: " + cmd.command));
|
debugMessage(_("GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: " + cmd.command));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -833,7 +833,7 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0)
|
|||||||
cmd.postTime = QTime::currentTime();
|
cmd.postTime = QTime::currentTime();
|
||||||
m_cookieForToken[currentToken()] = cmd;
|
m_cookieForToken[currentToken()] = cmd;
|
||||||
cmd.command = QByteArray::number(currentToken()) + cmd.command;
|
cmd.command = QByteArray::number(currentToken()) + cmd.command;
|
||||||
showDebuggerInput(LogInput, _(cmd.command));
|
showDebuggerInput(_(cmd.command), LogInput);
|
||||||
|
|
||||||
m_gdbAdapter->write(cmd.command + "\r\n");
|
m_gdbAdapter->write(cmd.command + "\r\n");
|
||||||
|
|
||||||
@@ -958,9 +958,10 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
|
|||||||
|
|
||||||
GdbCommand cmd = m_cookieForToken.take(token);
|
GdbCommand cmd = m_cookieForToken.take(token);
|
||||||
if (theDebuggerBoolSetting(LogTimeStamps)) {
|
if (theDebuggerBoolSetting(LogTimeStamps)) {
|
||||||
showDebuggerOutput(LogTime, _("Response time: %1: %2 s")
|
showDebuggerOutput(_("Response time: %1: %2 s")
|
||||||
.arg(_(cmd.command))
|
.arg(_(cmd.command))
|
||||||
.arg(cmd.postTime.msecsTo(QTime::currentTime()) / 1000.));
|
.arg(cmd.postTime.msecsTo(QTime::currentTime()) / 1000.),
|
||||||
|
LogTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response->token < m_oldestAcceptableToken && (cmd.flags & Discardable)) {
|
if (response->token < m_oldestAcceptableToken && (cmd.flags & Discardable)) {
|
||||||
@@ -2049,9 +2050,9 @@ void GdbEngine::setTokenBarrier()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
PENDING_DEBUG("\n--- token barrier ---\n");
|
PENDING_DEBUG("\n--- token barrier ---\n");
|
||||||
showDebuggerInput(LogMisc, _("--- token barrier ---"));
|
showDebuggerInput(_("--- token barrier ---"), LogMisc);
|
||||||
if (theDebuggerBoolSetting(LogTimeStamps))
|
if (theDebuggerBoolSetting(LogTimeStamps))
|
||||||
showDebuggerInput(LogMisc, currentTime());
|
showDebuggerInput(currentTime(), LogMisc);
|
||||||
m_oldestAcceptableToken = currentToken();
|
m_oldestAcceptableToken = currentToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3375,8 +3376,8 @@ void GdbEngine::updateWatchData(const WatchData &data)
|
|||||||
//qDebug() << "PROCESSED NAMES: " << processedName << m_processedNames;
|
//qDebug() << "PROCESSED NAMES: " << processedName << m_processedNames;
|
||||||
if (m_processedNames.contains(processedName)) {
|
if (m_processedNames.contains(processedName)) {
|
||||||
WatchData data1 = data;
|
WatchData data1 = data;
|
||||||
showDebuggerInput(LogStatus,
|
showDebuggerInput(_("<Breaking endless loop for " + data.iname + '>'),
|
||||||
_("<Breaking endless loop for " + data.iname + '>'));
|
LogStatus);
|
||||||
data1.setAllUnneeded();
|
data1.setAllUnneeded();
|
||||||
data1.setValue(_("<unavailable>"));
|
data1.setValue(_("<unavailable>"));
|
||||||
data1.setHasChildren(false);
|
data1.setHasChildren(false);
|
||||||
@@ -3427,8 +3428,8 @@ void GdbEngine::rebuildWatchModel()
|
|||||||
m_processedNames.clear();
|
m_processedNames.clear();
|
||||||
PENDING_DEBUG("REBUILDING MODEL" << count);
|
PENDING_DEBUG("REBUILDING MODEL" << count);
|
||||||
if (theDebuggerBoolSetting(LogTimeStamps))
|
if (theDebuggerBoolSetting(LogTimeStamps))
|
||||||
showDebuggerInput(LogMisc, currentTime());
|
showDebuggerInput(currentTime(), LogMisc);
|
||||||
showDebuggerInput(LogStatus, _("<Rebuild Watchmodel %1>").arg(count));
|
showDebuggerInput(_("<Rebuild Watchmodel %1>").arg(count), LogStatus);
|
||||||
showStatusMessage(tr("Finished retrieving data"), 400);
|
showStatusMessage(tr("Finished retrieving data"), 400);
|
||||||
manager()->watchHandler()->endCycle();
|
manager()->watchHandler()->endCycle();
|
||||||
showToolTip();
|
showToolTip();
|
||||||
@@ -3456,7 +3457,7 @@ void GdbEngine::sendWatchParameters(const QByteArray ¶ms0)
|
|||||||
const QByteArray inBufferCmd = arrayFillCommand("qDumpInBuffer", params);
|
const QByteArray inBufferCmd = arrayFillCommand("qDumpInBuffer", params);
|
||||||
|
|
||||||
params.replace('\0','!');
|
params.replace('\0','!');
|
||||||
showDebuggerInput(LogMisc, QString::fromUtf8(params));
|
showDebuggerInput(QString::fromUtf8(params), LogMisc);
|
||||||
|
|
||||||
params.clear();
|
params.clear();
|
||||||
params.append('\0');
|
params.append('\0');
|
||||||
@@ -4033,14 +4034,13 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
|
|||||||
// Check for existing values.
|
// Check for existing values.
|
||||||
if (environment.contains(pythonPathVariable)) {
|
if (environment.contains(pythonPathVariable)) {
|
||||||
const QString oldPythonPath = environment.value(pythonPathVariable);
|
const QString oldPythonPath = environment.value(pythonPathVariable);
|
||||||
manager()->showDebuggerOutput(LogMisc,
|
showDebuggerOutput(_("Using existing python path: %1")
|
||||||
_("Using existing python path: %1").arg(oldPythonPath));
|
.arg(oldPythonPath), LogMisc);
|
||||||
} else {
|
} else {
|
||||||
const QString pythonPath =
|
const QString pythonPath =
|
||||||
QDir::toNativeSeparators(dir.absoluteFilePath(winPythonVersion));
|
QDir::toNativeSeparators(dir.absoluteFilePath(winPythonVersion));
|
||||||
environment.insert(pythonPathVariable, pythonPath);
|
environment.insert(pythonPathVariable, pythonPath);
|
||||||
manager()->showDebuggerOutput(LogMisc,
|
showDebuggerOutput(_("Python path: %1").arg(pythonPath), LogMisc);
|
||||||
_("Python path: %1").arg(pythonPath));
|
|
||||||
gdbProc()->setProcessEnvironment(environment);
|
gdbProc()->setProcessEnvironment(environment);
|
||||||
}
|
}
|
||||||
foundPython = true;
|
foundPython = true;
|
||||||
|
@@ -142,13 +142,13 @@ void RemoteGdbServerAdapter::uploadProcError(QProcess::ProcessError error)
|
|||||||
void RemoteGdbServerAdapter::readUploadStandardOutput()
|
void RemoteGdbServerAdapter::readUploadStandardOutput()
|
||||||
{
|
{
|
||||||
QByteArray ba = m_uploadProc.readAllStandardOutput();
|
QByteArray ba = m_uploadProc.readAllStandardOutput();
|
||||||
m_engine->showDebuggerOutput(LogOutput, QString::fromLocal8Bit(ba, ba.length()));
|
runControl()->showDebuggerOutput(QString::fromLocal8Bit(ba, ba.length()), LogOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteGdbServerAdapter::readUploadStandardError()
|
void RemoteGdbServerAdapter::readUploadStandardError()
|
||||||
{
|
{
|
||||||
QByteArray ba = m_uploadProc.readAllStandardError();
|
QByteArray ba = m_uploadProc.readAllStandardError();
|
||||||
m_engine->showDebuggerOutput(LogError, QString::fromLocal8Bit(ba, ba.length()));
|
runControl()->showDebuggerOutput(QString::fromLocal8Bit(ba, ba.length()), LogError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteGdbServerAdapter::startInferior()
|
void RemoteGdbServerAdapter::startInferior()
|
||||||
|
@@ -86,7 +86,8 @@ QString RemotePlainGdbAdapter::fromLocalEncoding(const QByteArray &b) const
|
|||||||
|
|
||||||
void RemotePlainGdbAdapter::handleApplicationOutput(const QByteArray &output)
|
void RemotePlainGdbAdapter::handleApplicationOutput(const QByteArray &output)
|
||||||
{
|
{
|
||||||
m_engine->manager()->showApplicationOutput(output, false);
|
QTC_ASSERT(m_engine->runControl(), return);
|
||||||
|
m_engine->runControl()->showApplicationOutput(output, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -1139,7 +1139,7 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result)
|
|||||||
trk::Launcher::parseNotifyStopped(result.data, &pid, &tid, &addr, &reason);
|
trk::Launcher::parseNotifyStopped(result.data, &pid, &tid, &addr, &reason);
|
||||||
const QString msg = trk::Launcher::msgStopped(pid, tid, addr, reason);
|
const QString msg = trk::Launcher::msgStopped(pid, tid, addr, reason);
|
||||||
logMessage(prefix + msg);
|
logMessage(prefix + msg);
|
||||||
m_engine->manager()->showDebuggerOutput(LogMisc, msg);
|
runControl()->showDebuggerOutput(msg, LogMisc);
|
||||||
sendTrkAck(result.token);
|
sendTrkAck(result.token);
|
||||||
if (addr) {
|
if (addr) {
|
||||||
// Todo: Do not send off GdbMessages if a synced gdb
|
// Todo: Do not send off GdbMessages if a synced gdb
|
||||||
|
@@ -30,6 +30,8 @@
|
|||||||
#include "idebuggerengine.h"
|
#include "idebuggerengine.h"
|
||||||
#include "debuggermanager.h"
|
#include "debuggermanager.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -56,14 +58,16 @@ bool IDebuggerEngine::checkConfiguration(int toolChain,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDebuggerEngine::showDebuggerInput(int channel, const QString &msg)
|
void IDebuggerEngine::showDebuggerInput(const QString &msg, int channel) const
|
||||||
{
|
{
|
||||||
m_manager->showDebuggerInput(channel, msg);
|
QTC_ASSERT(runControl(), return);
|
||||||
|
runControl()->showDebuggerInput(msg, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDebuggerEngine::showDebuggerOutput(int channel, const QString &msg)
|
void IDebuggerEngine::showDebuggerOutput(const QString &msg, int channel) const
|
||||||
{
|
{
|
||||||
m_manager->showDebuggerOutput(channel, msg);
|
QTC_ASSERT(runControl(), return);
|
||||||
|
runControl()->showDebuggerOutput(msg, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -133,8 +133,8 @@ public:
|
|||||||
virtual QString qtNamespace() const { return QString(); }
|
virtual QString qtNamespace() const { return QString(); }
|
||||||
|
|
||||||
// Convenience
|
// Convenience
|
||||||
void showDebuggerInput(int channel, const QString &msg);
|
void showDebuggerInput(const QString &msg, int channel = LogDebug) const;
|
||||||
void showDebuggerOutput(int channel, const QString &msg);
|
void showDebuggerOutput(const QString &msg, int channel = LogDebug) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showStatusMessage(const QString &msg, int timeout = -1);
|
void showStatusMessage(const QString &msg, int timeout = -1);
|
||||||
|
@@ -94,7 +94,7 @@ void PdbEngine::executeDebuggerCommand(const QString &command)
|
|||||||
{
|
{
|
||||||
XSDEBUG("PdbEngine::executeDebuggerCommand:" << command);
|
XSDEBUG("PdbEngine::executeDebuggerCommand:" << command);
|
||||||
if (state() == DebuggerNotReady) {
|
if (state() == DebuggerNotReady) {
|
||||||
debugMessage(_("PDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: ") + command);
|
showDebuggerOutput(_("PDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: ") + command);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_pdbProc.write(command.toLatin1() + "\n");
|
m_pdbProc.write(command.toLatin1() + "\n");
|
||||||
@@ -112,7 +112,7 @@ void PdbEngine::postCommand(const QByteArray &command,
|
|||||||
cmd.callbackName = callbackName;
|
cmd.callbackName = callbackName;
|
||||||
cmd.cookie = cookie;
|
cmd.cookie = cookie;
|
||||||
m_commands.enqueue(cmd);
|
m_commands.enqueue(cmd);
|
||||||
showDebuggerInput(LogMisc, _(cmd.command));
|
showDebuggerInput(_(cmd.command), LogInput);
|
||||||
m_pdbProc.write(cmd.command + "\n");
|
m_pdbProc.write(cmd.command + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,9 +144,9 @@ void PdbEngine::startDebugger()
|
|||||||
m_scriptFileName = QFileInfo(runControl()->sp().executable).absoluteFilePath();
|
m_scriptFileName = QFileInfo(runControl()->sp().executable).absoluteFilePath();
|
||||||
QFile scriptFile(m_scriptFileName);
|
QFile scriptFile(m_scriptFileName);
|
||||||
if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
|
if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
|
||||||
//debugMessage("STARTING " +m_scriptFileName + "FAILED");
|
//showDebuggerOutput("STARTING " +m_scriptFileName + "FAILED");
|
||||||
manager()->showDebuggerOutput(LogError, QString::fromLatin1("Cannot open %1: %2").
|
showDebuggerOutput(QString::fromLatin1("Cannot open %1: %2").
|
||||||
arg(m_scriptFileName, scriptFile.errorString()));
|
arg(m_scriptFileName, scriptFile.errorString()), LogError);
|
||||||
emit startFailed();
|
emit startFailed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -158,7 +158,7 @@ void PdbEngine::startDebugger()
|
|||||||
m_pdbProc.disconnect(); // From any previous runs
|
m_pdbProc.disconnect(); // From any previous runs
|
||||||
|
|
||||||
m_pdb = _("/usr/bin/python");
|
m_pdb = _("/usr/bin/python");
|
||||||
debugMessage(_("STARTING PDB ") + m_pdb);
|
showDebuggerOutput(_("STARTING PDB ") + m_pdb);
|
||||||
QStringList gdbArgs;
|
QStringList gdbArgs;
|
||||||
gdbArgs += _("-i");
|
gdbArgs += _("-i");
|
||||||
gdbArgs += _("/usr/bin/pdb");
|
gdbArgs += _("/usr/bin/pdb");
|
||||||
@@ -186,7 +186,7 @@ void PdbEngine::startDebugger()
|
|||||||
const QString msg = tr("Unable to start pdb '%1': %2")
|
const QString msg = tr("Unable to start pdb '%1': %2")
|
||||||
.arg(m_pdb, m_pdbProc.errorString());
|
.arg(m_pdb, m_pdbProc.errorString());
|
||||||
setState(AdapterStartFailed);
|
setState(AdapterStartFailed);
|
||||||
debugMessage(_("ADAPTER START FAILED"));
|
showDebuggerOutput(_("ADAPTER START FAILED"));
|
||||||
if (!msg.isEmpty()) {
|
if (!msg.isEmpty()) {
|
||||||
const QString title = tr("Adapter start failed");
|
const QString title = tr("Adapter start failed");
|
||||||
Core::ICore::instance()->showWarningWithOptions(title, msg);
|
Core::ICore::instance()->showWarningWithOptions(title, msg);
|
||||||
@@ -200,7 +200,7 @@ void PdbEngine::startDebugger()
|
|||||||
setState(InferiorRunning);
|
setState(InferiorRunning);
|
||||||
attemptBreakpointSynchronization();
|
attemptBreakpointSynchronization();
|
||||||
|
|
||||||
debugMessage(_("PDB STARTED, INITIALIZING IT"));
|
showDebuggerOutput(_("PDB STARTED, INITIALIZING IT"));
|
||||||
const QByteArray dumperSourcePath =
|
const QByteArray dumperSourcePath =
|
||||||
Core::ICore::instance()->resourcePath().toLocal8Bit() + "/gdbmacros/";
|
Core::ICore::instance()->resourcePath().toLocal8Bit() + "/gdbmacros/";
|
||||||
postCommand("execfile('" + dumperSourcePath + "pdumper.py')",
|
postCommand("execfile('" + dumperSourcePath + "pdumper.py')",
|
||||||
@@ -556,7 +556,7 @@ void PdbEngine::updateWatchData(const WatchData &data)
|
|||||||
|
|
||||||
void PdbEngine::handlePdbError(QProcess::ProcessError error)
|
void PdbEngine::handlePdbError(QProcess::ProcessError error)
|
||||||
{
|
{
|
||||||
debugMessage(_("HANDLE PDB ERROR"));
|
showDebuggerOutput(_("HANDLE PDB ERROR"));
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case QProcess::Crashed:
|
case QProcess::Crashed:
|
||||||
break; // will get a processExited() as well
|
break; // will get a processExited() as well
|
||||||
@@ -602,7 +602,7 @@ QString PdbEngine::errorMessage(QProcess::ProcessError error) const
|
|||||||
|
|
||||||
void PdbEngine::handlePdbFinished(int code, QProcess::ExitStatus type)
|
void PdbEngine::handlePdbFinished(int code, QProcess::ExitStatus type)
|
||||||
{
|
{
|
||||||
debugMessage(_("PDB PROCESS FINISHED, status %1, code %2").arg(type).arg(code));
|
showDebuggerOutput(_("PDB PROCESS FINISHED, status %1, code %2").arg(type).arg(code));
|
||||||
//shutdown();
|
//shutdown();
|
||||||
//initializeVariables();
|
//initializeVariables();
|
||||||
setState(DebuggerNotReady, true);
|
setState(DebuggerNotReady, true);
|
||||||
@@ -612,7 +612,7 @@ void PdbEngine::readPdbStandardError()
|
|||||||
{
|
{
|
||||||
QByteArray err = m_pdbProc.readAllStandardError();
|
QByteArray err = m_pdbProc.readAllStandardError();
|
||||||
qWarning() << "Unexpected pdb stderr:" << err;
|
qWarning() << "Unexpected pdb stderr:" << err;
|
||||||
showDebuggerOutput(LogDebug, _("Unexpected pdb stderr: " + err));
|
showDebuggerOutput(_("Unexpected pdb stderr: " + err));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdbEngine::readPdbStandardOutput()
|
void PdbEngine::readPdbStandardOutput()
|
||||||
@@ -623,7 +623,7 @@ void PdbEngine::readPdbStandardOutput()
|
|||||||
while ((pos = m_inbuffer.indexOf("(Pdb)")) != -1) {
|
while ((pos = m_inbuffer.indexOf("(Pdb)")) != -1) {
|
||||||
PdbResponse response;
|
PdbResponse response;
|
||||||
response.data = m_inbuffer.left(pos).trimmed();
|
response.data = m_inbuffer.left(pos).trimmed();
|
||||||
showDebuggerOutput(LogDebug, _(response.data));
|
showDebuggerOutput(_(response.data));
|
||||||
m_inbuffer = m_inbuffer.mid(pos + 6);
|
m_inbuffer = m_inbuffer.mid(pos + 6);
|
||||||
QTC_ASSERT(!m_commands.isEmpty(),
|
QTC_ASSERT(!m_commands.isEmpty(),
|
||||||
qDebug() << "RESPONSE: " << response.data; return)
|
qDebug() << "RESPONSE: " << response.data; return)
|
||||||
@@ -806,11 +806,6 @@ void PdbEngine::handleLoadDumper(const PdbResponse &response)
|
|||||||
continueInferior();
|
continueInferior();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdbEngine::debugMessage(const QString &msg)
|
|
||||||
{
|
|
||||||
showDebuggerOutput(LogDebug, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned PdbEngine::debuggerCapabilities() const
|
unsigned PdbEngine::debuggerCapabilities() const
|
||||||
{
|
{
|
||||||
return ReloadModuleCapability;
|
return ReloadModuleCapability;
|
||||||
|
@@ -105,7 +105,6 @@ private:
|
|||||||
void updateWatchData(const WatchData &data);
|
void updateWatchData(const WatchData &data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void debugMessage(const QString &msg);
|
|
||||||
QString errorMessage(QProcess::ProcessError error) const;
|
QString errorMessage(QProcess::ProcessError error) const;
|
||||||
unsigned debuggerCapabilities() const;
|
unsigned debuggerCapabilities() const;
|
||||||
|
|
||||||
|
@@ -460,7 +460,7 @@ void QmlEngine::sendCommandNow(const QmlCommand &cmd)
|
|||||||
int result = m_socket->write(cmd.command);
|
int result = m_socket->write(cmd.command);
|
||||||
Q_UNUSED(result)
|
Q_UNUSED(result)
|
||||||
m_socket->flush();
|
m_socket->flush();
|
||||||
showDebuggerInput(LogInput, QString::number(cmd.token) + " " + cmd.toString());
|
showDebuggerInput(QString::number(cmd.token) + " " + cmd.toString(), LogInput);
|
||||||
SDEBUG("SEND " << cmd.toString()); //<< " " << QString::number(result));
|
SDEBUG("SEND " << cmd.toString()); //<< " " << QString::number(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -536,11 +536,6 @@ void QmlEngine::updateSubItem(const WatchData &data0)
|
|||||||
QTC_ASSERT(false, return);
|
QTC_ASSERT(false, return);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::debugMessage(const QString &msg)
|
|
||||||
{
|
|
||||||
showDebuggerOutput(LogDebug, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
IDebuggerEngine *createQmlEngine(DebuggerManager *manager)
|
IDebuggerEngine *createQmlEngine(DebuggerManager *manager)
|
||||||
{
|
{
|
||||||
return new QmlEngine(manager);
|
return new QmlEngine(manager);
|
||||||
|
@@ -141,7 +141,6 @@ private:
|
|||||||
void postCommand(const QByteArray &cmd,
|
void postCommand(const QByteArray &cmd,
|
||||||
QmlCommandCallback callback = 0, const char *callbackName = 0);
|
QmlCommandCallback callback = 0, const char *callbackName = 0);
|
||||||
void sendCommandNow(const QmlCommand &command);
|
void sendCommandNow(const QmlCommand &command);
|
||||||
void debugMessage(const QString &msg);
|
|
||||||
|
|
||||||
QHash<int, QmlCommand> m_cookieForToken;
|
QHash<int, QmlCommand> m_cookieForToken;
|
||||||
|
|
||||||
|
@@ -128,7 +128,7 @@ void ScriptAgent::exceptionCatch(qint64 scriptId, const QScriptValue & exception
|
|||||||
const QString msg = QString::fromLatin1("An exception was caught on %1: '%2'").
|
const QString msg = QString::fromLatin1("An exception was caught on %1: '%2'").
|
||||||
arg(scriptId).arg(exception.toString());
|
arg(scriptId).arg(exception.toString());
|
||||||
SDEBUG(msg);
|
SDEBUG(msg);
|
||||||
q->showDebuggerOutput(LogMisc, msg);
|
q->showDebuggerOutput(msg, LogMisc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptAgent::exceptionThrow(qint64 scriptId, const QScriptValue &exception,
|
void ScriptAgent::exceptionThrow(qint64 scriptId, const QScriptValue &exception,
|
||||||
@@ -140,13 +140,13 @@ void ScriptAgent::exceptionThrow(qint64 scriptId, const QScriptValue &exception,
|
|||||||
const QString msg = QString::fromLatin1("An exception occurred on %1: '%2'").
|
const QString msg = QString::fromLatin1("An exception occurred on %1: '%2'").
|
||||||
arg(scriptId).arg(exception.toString());
|
arg(scriptId).arg(exception.toString());
|
||||||
SDEBUG(msg);
|
SDEBUG(msg);
|
||||||
q->showDebuggerOutput(LogMisc, msg);
|
q->showDebuggerOutput(msg, LogMisc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptAgent::functionEntry(qint64 scriptId)
|
void ScriptAgent::functionEntry(qint64 scriptId)
|
||||||
{
|
{
|
||||||
Q_UNUSED(scriptId)
|
Q_UNUSED(scriptId)
|
||||||
q->showDebuggerOutput(LogMisc, QString::fromLatin1("Function entry occurred on %1").arg(scriptId));
|
q->showDebuggerOutput(QString::fromLatin1("Function entry occurred on %1").arg(scriptId), LogMisc);
|
||||||
q->checkForBreakCondition(true);
|
q->checkForBreakCondition(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ void ScriptAgent::functionExit(qint64 scriptId, const QScriptValue &returnValue)
|
|||||||
Q_UNUSED(returnValue)
|
Q_UNUSED(returnValue)
|
||||||
const QString msg = QString::fromLatin1("Function exit occurred on %1: '%2'").arg(scriptId).arg(returnValue.toString());
|
const QString msg = QString::fromLatin1("Function exit occurred on %1: '%2'").arg(scriptId).arg(returnValue.toString());
|
||||||
SDEBUG(msg);
|
SDEBUG(msg);
|
||||||
q->showDebuggerOutput(LogMisc, msg);
|
q->showDebuggerOutput(msg, LogMisc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptAgent::positionChange(qint64 scriptId, int lineNumber, int columnNumber)
|
void ScriptAgent::positionChange(qint64 scriptId, int lineNumber, int columnNumber)
|
||||||
@@ -175,7 +175,8 @@ void ScriptAgent::scriptLoad(qint64 scriptId, const QString &program,
|
|||||||
Q_UNUSED(program)
|
Q_UNUSED(program)
|
||||||
Q_UNUSED(fileName)
|
Q_UNUSED(fileName)
|
||||||
Q_UNUSED(baseLineNumber)
|
Q_UNUSED(baseLineNumber)
|
||||||
q->showDebuggerOutput(LogMisc, QString::fromLatin1("Loaded: %1 id: %2").arg(fileName).arg(scriptId));
|
q->showDebuggerOutput(QString::fromLatin1("Loaded: %1 id: %2")
|
||||||
|
.arg(fileName).arg(scriptId), LogMisc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptAgent::scriptUnload(qint64 scriptId)
|
void ScriptAgent::scriptUnload(qint64 scriptId)
|
||||||
@@ -251,8 +252,8 @@ void ScriptEngine::startDebugger()
|
|||||||
m_scriptFileName = QFileInfo(runControl()->sp().executable).absoluteFilePath();
|
m_scriptFileName = QFileInfo(runControl()->sp().executable).absoluteFilePath();
|
||||||
QFile scriptFile(m_scriptFileName);
|
QFile scriptFile(m_scriptFileName);
|
||||||
if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
|
if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
|
||||||
manager()->showDebuggerOutput(LogError, QString::fromLatin1("Cannot open %1: %2").
|
showDebuggerOutput(QString::fromLatin1("Cannot open %1: %2").
|
||||||
arg(m_scriptFileName, scriptFile.errorString()));
|
arg(m_scriptFileName, scriptFile.errorString()), LogError);
|
||||||
emit startFailed();
|
emit startFailed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -262,7 +263,7 @@ void ScriptEngine::startDebugger()
|
|||||||
attemptBreakpointSynchronization();
|
attemptBreakpointSynchronization();
|
||||||
setState(InferiorRunningRequested);
|
setState(InferiorRunningRequested);
|
||||||
showStatusMessage(tr("Running requested..."), 5000);
|
showStatusMessage(tr("Running requested..."), 5000);
|
||||||
manager()->showDebuggerOutput(LogMisc, QLatin1String("Running: ") + m_scriptFileName);
|
showDebuggerOutput(QLatin1String("Running: ") + m_scriptFileName, LogMisc);
|
||||||
QTimer::singleShot(0, this, SLOT(runInferior()));
|
QTimer::singleShot(0, this, SLOT(runInferior()));
|
||||||
emit startSuccessful();
|
emit startSuccessful();
|
||||||
}
|
}
|
||||||
@@ -329,14 +330,18 @@ void ScriptEngine::runInferior()
|
|||||||
const QScriptValue result = m_scriptEngine->evaluate(m_scriptContents, m_scriptFileName);
|
const QScriptValue result = m_scriptEngine->evaluate(m_scriptContents, m_scriptFileName);
|
||||||
setState(InferiorStopping);
|
setState(InferiorStopping);
|
||||||
setState(InferiorStopped);
|
setState(InferiorStopped);
|
||||||
|
QString msg;
|
||||||
if (m_scriptEngine->hasUncaughtException()) {
|
if (m_scriptEngine->hasUncaughtException()) {
|
||||||
QString msg = QString::fromLatin1("An exception occurred during execution at line: %1\n%2\n").
|
msg = QString::fromLatin1("An exception occurred during execution at line: %1\n%2\n")
|
||||||
arg(m_scriptEngine->uncaughtExceptionLineNumber()).arg(m_scriptEngine->uncaughtException().toString());
|
.arg(m_scriptEngine->uncaughtExceptionLineNumber())
|
||||||
msg += m_scriptEngine->uncaughtExceptionBacktrace().join(QString(QLatin1Char('\n')));
|
.arg(m_scriptEngine->uncaughtException().toString());
|
||||||
showDebuggerOutput(LogMisc, msg);
|
msg += m_scriptEngine->uncaughtExceptionBacktrace()
|
||||||
|
.join(QString(QLatin1Char('\n')));
|
||||||
} else {
|
} else {
|
||||||
showDebuggerOutput(LogMisc, QString::fromLatin1("Evaluation returns '%1'").arg(result.toString()));
|
msg = QString::fromLatin1("Evaluation returns '%1'")
|
||||||
|
.arg(result.toString());
|
||||||
}
|
}
|
||||||
|
showDebuggerOutput(msg, LogMisc);
|
||||||
exitDebugger();
|
exitDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -789,11 +794,6 @@ void ScriptEngine::updateSubItem(const WatchData &data0)
|
|||||||
manager()->watchHandler()->insertBulkData(children);
|
manager()->watchHandler()->insertBulkData(children);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEngine::showDebuggerOutput(int channel, const QString &m)
|
|
||||||
{
|
|
||||||
manager()->showDebuggerOutput(channel, m);
|
|
||||||
}
|
|
||||||
|
|
||||||
IDebuggerEngine *createScriptEngine(DebuggerManager *manager)
|
IDebuggerEngine *createScriptEngine(DebuggerManager *manager)
|
||||||
{
|
{
|
||||||
return new ScriptEngine(manager);
|
return new ScriptEngine(manager);
|
||||||
|
@@ -104,8 +104,6 @@ private:
|
|||||||
void updateLocals();
|
void updateLocals();
|
||||||
void updateSubItem(const WatchData &data);
|
void updateSubItem(const WatchData &data);
|
||||||
|
|
||||||
Q_SLOT void showDebuggerOutput(int channel, const QString &m);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class ScriptAgent;
|
friend class ScriptAgent;
|
||||||
|
|
||||||
|
@@ -328,8 +328,9 @@ void TcfEngine::handleResponse(const QByteArray &response)
|
|||||||
int token = parts.at(1).toInt();
|
int token = parts.at(1).toInt();
|
||||||
TcfCommand tcf = m_cookieForToken[token];
|
TcfCommand tcf = m_cookieForToken[token];
|
||||||
SDEBUG("COMMAND NOT RECOGNIZED FOR TOKEN" << token << tcf.toString());
|
SDEBUG("COMMAND NOT RECOGNIZED FOR TOKEN" << token << tcf.toString());
|
||||||
showDebuggerOutput(LogOutput, QString::number(token) + "^"
|
showDebuggerOutput(QString::number(token) + "^"
|
||||||
+ "NOT RECOQNIZED: " + quoteUnprintableLatin1(response));
|
+ "NOT RECOQNIZED: " + quoteUnprintableLatin1(response),
|
||||||
|
LogOutput);
|
||||||
acknowledgeResult();
|
acknowledgeResult();
|
||||||
} else if (n == 2 && tag == "F") { // flow control
|
} else if (n == 2 && tag == "F") { // flow control
|
||||||
m_congestion = parts.at(1).toInt();
|
m_congestion = parts.at(1).toInt();
|
||||||
@@ -339,9 +340,9 @@ void TcfEngine::handleResponse(const QByteArray &response)
|
|||||||
int token = parts.at(1).toInt();
|
int token = parts.at(1).toInt();
|
||||||
QByteArray message = parts.at(2);
|
QByteArray message = parts.at(2);
|
||||||
JsonValue data(parts.at(3));
|
JsonValue data(parts.at(3));
|
||||||
showDebuggerOutput(LogOutput, QString("%1^%2%3").arg(token)
|
showDebuggerOutput(QString("%1^%2%3").arg(token)
|
||||||
.arg(quoteUnprintableLatin1(response))
|
.arg(quoteUnprintableLatin1(response))
|
||||||
.arg(QString::fromUtf8(data.toString())));
|
.arg(QString::fromUtf8(data.toString())), LogOutput);
|
||||||
TcfCommand tcf = m_cookieForToken[token];
|
TcfCommand tcf = m_cookieForToken[token];
|
||||||
JsonValue result(data);
|
JsonValue result(data);
|
||||||
SDEBUG("GOOD RESPONSE: " << quoteUnprintableLatin1(response));
|
SDEBUG("GOOD RESPONSE: " << quoteUnprintableLatin1(response));
|
||||||
@@ -481,7 +482,7 @@ void TcfEngine::sendCommandNow(const TcfCommand &cmd)
|
|||||||
int result = m_socket->write(cmd.command);
|
int result = m_socket->write(cmd.command);
|
||||||
Q_UNUSED(result)
|
Q_UNUSED(result)
|
||||||
m_socket->flush();
|
m_socket->flush();
|
||||||
showDebuggerInput(LogInput, QString::number(cmd.token) + " " + cmd.toString());
|
showDebuggerInput(QString::number(cmd.token) + " " + cmd.toString(), LogInput);
|
||||||
SDEBUG("SEND " << cmd.toString()); //<< " " << QString::number(result));
|
SDEBUG("SEND " << cmd.toString()); //<< " " << QString::number(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,11 +558,6 @@ void TcfEngine::updateSubItem(const WatchData &data0)
|
|||||||
QTC_ASSERT(false, return);
|
QTC_ASSERT(false, return);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TcfEngine::debugMessage(const QString &msg)
|
|
||||||
{
|
|
||||||
showDebuggerOutput(LogDebug, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
IDebuggerEngine *createTcfEngine(DebuggerManager *manager)
|
IDebuggerEngine *createTcfEngine(DebuggerManager *manager)
|
||||||
{
|
{
|
||||||
return new TcfEngine(manager);
|
return new TcfEngine(manager);
|
||||||
|
@@ -141,7 +141,6 @@ private:
|
|||||||
void postCommand(const QByteArray &cmd,
|
void postCommand(const QByteArray &cmd,
|
||||||
TcfCommandCallback callback = 0, const char *callbackName = 0);
|
TcfCommandCallback callback = 0, const char *callbackName = 0);
|
||||||
void sendCommandNow(const TcfCommand &command);
|
void sendCommandNow(const TcfCommand &command);
|
||||||
void debugMessage(const QString &msg);
|
|
||||||
|
|
||||||
QHash<int, TcfCommand> m_cookieForToken;
|
QHash<int, TcfCommand> m_cookieForToken;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user