forked from qt-creator/qt-creator
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
This commit is contained in:
@@ -1685,25 +1685,21 @@ bool CdbDebugEnginePrivate::setSymbolPaths(const QStringList &s, QString *errorM
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Debugger
|
|
||||||
|
|
||||||
// Accessed by DebuggerManager
|
// Accessed by DebuggerManager
|
||||||
Debugger::Internal::IDebuggerEngine *createWinEngine(Debugger::Internal::DebuggerManager *parent,
|
IDebuggerEngine *createWinEngine(DebuggerManager *parent,
|
||||||
bool cmdLineEnabled,
|
bool cmdLineEnabled,
|
||||||
QList<Core::IOptionsPage*> *opts)
|
QList<Core::IOptionsPage*> *opts)
|
||||||
{
|
{
|
||||||
// Create options page
|
// Create options page
|
||||||
QSharedPointer<Debugger::Internal::CdbOptions> options(new Debugger::Internal::CdbOptions);
|
QSharedPointer<CdbOptions> options(new CdbOptions);
|
||||||
options->fromSettings(Core::ICore::instance()->settings());
|
options->fromSettings(Core::ICore::instance()->settings());
|
||||||
Debugger::Internal::CdbOptionsPage *optionsPage = new Debugger::Internal::CdbOptionsPage(options);
|
CdbOptionsPage *optionsPage = new CdbOptionsPage(options);
|
||||||
opts->push_back(optionsPage);
|
opts->push_back(optionsPage);
|
||||||
if (!cmdLineEnabled || !options->enabled)
|
if (!cmdLineEnabled || !options->enabled)
|
||||||
return 0;
|
return 0;
|
||||||
// Create engine
|
// Create engine
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
Debugger::Internal::IDebuggerEngine *engine =
|
IDebuggerEngine *engine = CdbDebugEngine::create(parent, options, &errorMessage);
|
||||||
Debugger::Internal::CdbDebugEngine::create(parent, options, &errorMessage);
|
|
||||||
if (!engine) {
|
if (!engine) {
|
||||||
optionsPage->setFailureMessage(errorMessage);
|
optionsPage->setFailureMessage(errorMessage);
|
||||||
qWarning("%s\n" ,qPrintable(errorMessage));
|
qWarning("%s\n" ,qPrintable(errorMessage));
|
||||||
@@ -1711,3 +1707,7 @@ Debugger::Internal::IDebuggerEngine *createWinEngine(Debugger::Internal::Debugge
|
|||||||
QObject::connect(optionsPage, SIGNAL(debuggerPathsChanged()), engine, SLOT(syncDebuggerPaths()));
|
QObject::connect(optionsPage, SIGNAL(debuggerPathsChanged()), engine, SLOT(syncDebuggerPaths()));
|
||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Debugger
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public:
|
|||||||
virtual void reloadRegisters();
|
virtual void reloadRegisters();
|
||||||
virtual void reloadSourceFiles();
|
virtual void reloadSourceFiles();
|
||||||
virtual void reloadFullStack() {}
|
virtual void reloadFullStack() {}
|
||||||
|
virtual void addOptionPages(QList<Core::IOptionsPage*> *) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void syncDebuggerPaths();
|
void syncDebuggerPaths();
|
||||||
|
|||||||
@@ -82,11 +82,17 @@
|
|||||||
#include <QtGui/QToolButton>
|
#include <QtGui/QToolButton>
|
||||||
#include <QtGui/QToolTip>
|
#include <QtGui/QToolTip>
|
||||||
|
|
||||||
|
namespace Debugger {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
// The creation functions take a list of options pages they can add to.
|
IDebuggerEngine *createGdbEngine(DebuggerManager *parent);
|
||||||
// This allows for having a "enabled" toggle on the page indepently
|
IDebuggerEngine *createScriptEngine(DebuggerManager *parent);
|
||||||
// of the engine.
|
IDebuggerEngine *createTcfEngine(DebuggerManager *parent);
|
||||||
using namespace Debugger::Internal;
|
|
||||||
|
// The createWinEngine function takes a list of options pages it can add to.
|
||||||
|
// This allows for having a "enabled" toggle on the page independently
|
||||||
|
// of the engine. That's good for not enabling the related ActiveX control
|
||||||
|
// unnecessarily.
|
||||||
|
|
||||||
IDebuggerEngine *createWinEngine(DebuggerManager *, bool /* cmdLineEnabled */, QList<Core::IOptionsPage*> *)
|
IDebuggerEngine *createWinEngine(DebuggerManager *, bool /* cmdLineEnabled */, QList<Core::IOptionsPage*> *)
|
||||||
#ifdef CDB_ENABLED
|
#ifdef CDB_ENABLED
|
||||||
@@ -94,17 +100,8 @@ IDebuggerEngine *createWinEngine(DebuggerManager *, bool /* cmdLineEnabled */, Q
|
|||||||
#else
|
#else
|
||||||
{ return 0; }
|
{ return 0; }
|
||||||
#endif
|
#endif
|
||||||
IDebuggerEngine *createScriptEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
|
|
||||||
IDebuggerEngine *createTcfEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
|
|
||||||
|
|
||||||
|
|
||||||
namespace Debugger {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
IDebuggerEngine *createGdbEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
|
|
||||||
|
|
||||||
IDebuggerEngine *createSymbianEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug str, const DebuggerStartParameters &p)
|
QDebug operator<<(QDebug str, const DebuggerStartParameters &p)
|
||||||
{
|
{
|
||||||
QDebug nospace = str.nospace();
|
QDebug nospace = str.nospace();
|
||||||
@@ -185,7 +182,6 @@ void DebuggerStartParameters::clear()
|
|||||||
|
|
||||||
static IDebuggerEngine *gdbEngine = 0;
|
static IDebuggerEngine *gdbEngine = 0;
|
||||||
static IDebuggerEngine *scriptEngine = 0;
|
static IDebuggerEngine *scriptEngine = 0;
|
||||||
static IDebuggerEngine *symbianEngine = 0;
|
|
||||||
static IDebuggerEngine *tcfEngine = 0;
|
static IDebuggerEngine *tcfEngine = 0;
|
||||||
static IDebuggerEngine *winEngine = 0;
|
static IDebuggerEngine *winEngine = 0;
|
||||||
|
|
||||||
@@ -201,7 +197,6 @@ DebuggerManager::~DebuggerManager()
|
|||||||
#define doDelete(ptr) delete ptr; ptr = 0
|
#define doDelete(ptr) delete ptr; ptr = 0
|
||||||
doDelete(gdbEngine);
|
doDelete(gdbEngine);
|
||||||
doDelete(scriptEngine);
|
doDelete(scriptEngine);
|
||||||
doDelete(symbianEngine);
|
|
||||||
doDelete(tcfEngine);
|
doDelete(tcfEngine);
|
||||||
doDelete(winEngine);
|
doDelete(winEngine);
|
||||||
#undef doDelete
|
#undef doDelete
|
||||||
@@ -372,10 +367,8 @@ void DebuggerManager::init()
|
|||||||
m_reverseDirectionAction->setChecked(false);
|
m_reverseDirectionAction->setChecked(false);
|
||||||
//m_reverseDirectionAction->setIcon(QIcon(":/debugger/images/debugger_stepoverproc_small.png"));
|
//m_reverseDirectionAction->setIcon(QIcon(":/debugger/images/debugger_stepoverproc_small.png"));
|
||||||
|
|
||||||
// For usuage hints oin focus{In,Out}
|
|
||||||
connect(m_continueAction, SIGNAL(triggered()),
|
connect(m_continueAction, SIGNAL(triggered()),
|
||||||
this, SLOT(continueExec()));
|
this, SLOT(continueExec()));
|
||||||
|
|
||||||
connect(m_stopAction, SIGNAL(triggered()),
|
connect(m_stopAction, SIGNAL(triggered()),
|
||||||
this, SLOT(interruptDebuggingRequest()));
|
this, SLOT(interruptDebuggingRequest()));
|
||||||
connect(m_resetAction, SIGNAL(triggered()),
|
connect(m_resetAction, SIGNAL(triggered()),
|
||||||
@@ -446,15 +439,24 @@ void DebuggerManager::init()
|
|||||||
QList<Core::IOptionsPage*> DebuggerManager::initializeEngines(unsigned enabledTypeFlags)
|
QList<Core::IOptionsPage*> DebuggerManager::initializeEngines(unsigned enabledTypeFlags)
|
||||||
{
|
{
|
||||||
QList<Core::IOptionsPage*> rc;
|
QList<Core::IOptionsPage*> rc;
|
||||||
if (enabledTypeFlags & GdbEngineType)
|
|
||||||
gdbEngine = createGdbEngine(this, &rc);
|
if (enabledTypeFlags & GdbEngineType) {
|
||||||
if (enabledTypeFlags & SymbianEngineType)
|
gdbEngine = createGdbEngine(this);
|
||||||
symbianEngine = createSymbianEngine(this, &rc);
|
gdbEngine->addOptionPages(&rc);
|
||||||
|
}
|
||||||
|
|
||||||
winEngine = createWinEngine(this, (enabledTypeFlags & CdbEngineType), &rc);
|
winEngine = createWinEngine(this, (enabledTypeFlags & CdbEngineType), &rc);
|
||||||
if (enabledTypeFlags & ScriptEngineType)
|
|
||||||
scriptEngine = createScriptEngine(this, &rc);
|
if (enabledTypeFlags & ScriptEngineType) {
|
||||||
if (enabledTypeFlags & TcfEngineType)
|
scriptEngine = createScriptEngine(this);
|
||||||
tcfEngine = createTcfEngine(this, &rc);
|
scriptEngine->addOptionPages(&rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enabledTypeFlags & TcfEngineType) {
|
||||||
|
tcfEngine = createTcfEngine(this);
|
||||||
|
tcfEngine->addOptionPages(&rc);
|
||||||
|
}
|
||||||
|
|
||||||
m_engine = 0;
|
m_engine = 0;
|
||||||
if (Debugger::Constants::Internal::debug)
|
if (Debugger::Constants::Internal::debug)
|
||||||
qDebug() << Q_FUNC_INFO << gdbEngine << winEngine << scriptEngine << rc.size();
|
qDebug() << Q_FUNC_INFO << gdbEngine << winEngine << scriptEngine << rc.size();
|
||||||
@@ -565,7 +567,7 @@ void DebuggerManager::notifyInferiorRunning()
|
|||||||
void DebuggerManager::notifyInferiorExited()
|
void DebuggerManager::notifyInferiorExited()
|
||||||
{
|
{
|
||||||
setStatus(DebuggerProcessNotReady);
|
setStatus(DebuggerProcessNotReady);
|
||||||
showStatusMessage(tr("Stopped."), 5000);
|
showStatusMessage(tr("Exited."), 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::notifyInferiorPidChanged(qint64 pid)
|
void DebuggerManager::notifyInferiorPidChanged(qint64 pid)
|
||||||
@@ -744,13 +746,15 @@ static IDebuggerEngine *determineDebuggerEngine(const QString &executable,
|
|||||||
return scriptEngine;
|
return scriptEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (executable.endsWith(_(".sym"))) {
|
if (executable.endsWith(_(".sym"))) {
|
||||||
if (!symbianEngine) {
|
if (!gdbEngine) {
|
||||||
*errorMessage = msgEngineNotAvailable("Symbian Engine");
|
*errorMessage = msgEngineNotAvailable("Gdb Engine");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return symbianEngine;
|
return gdbEngine;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (IDebuggerEngine *tce = debuggerEngineForToolChain(
|
if (IDebuggerEngine *tce = debuggerEngineForToolChain(
|
||||||
static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChainType)))
|
static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChainType)))
|
||||||
@@ -1096,7 +1100,7 @@ static bool isAllowedTransition(int from, int to)
|
|||||||
{
|
{
|
||||||
return (from == -1)
|
return (from == -1)
|
||||||
|| (from == DebuggerProcessNotReady && to == DebuggerProcessStartingUp)
|
|| (from == DebuggerProcessNotReady && to == DebuggerProcessStartingUp)
|
||||||
//|| (from == DebuggerProcessStartingUp && to == DebuggerInferiorStopped)
|
|| (from == DebuggerProcessStartingUp && to == DebuggerInferiorStopped)
|
||||||
|| (from == DebuggerInferiorStopped && to == DebuggerInferiorRunningRequested)
|
|| (from == DebuggerInferiorStopped && to == DebuggerInferiorRunningRequested)
|
||||||
|| (from == DebuggerInferiorRunningRequested && to == DebuggerInferiorRunning)
|
|| (from == DebuggerInferiorRunningRequested && to == DebuggerInferiorRunning)
|
||||||
|| (from == DebuggerInferiorRunning && to == DebuggerInferiorStopRequested)
|
|| (from == DebuggerInferiorRunning && to == DebuggerInferiorStopRequested)
|
||||||
@@ -1114,7 +1118,7 @@ void DebuggerManager::setStatus(int status)
|
|||||||
if (status == m_status)
|
if (status == m_status)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (0 && !isAllowedTransition(m_status, status)) {
|
if (1 && !isAllowedTransition(m_status, status)) {
|
||||||
const QString msg = QString::fromLatin1("%1: UNEXPECTED TRANSITION: %2 -> %3")
|
const QString msg = QString::fromLatin1("%1: UNEXPECTED TRANSITION: %2 -> %3")
|
||||||
.arg(_(Q_FUNC_INFO), _(stateName(m_status)), _(stateName(status)));
|
.arg(_(Q_FUNC_INFO), _(stateName(m_status)), _(stateName(status)));
|
||||||
qWarning("%s", qPrintable(msg));
|
qWarning("%s", qPrintable(msg));
|
||||||
@@ -1155,7 +1159,8 @@ void DebuggerManager::setStatus(int status)
|
|||||||
m_runToFunctionAction->setEnabled(ready);
|
m_runToFunctionAction->setEnabled(ready);
|
||||||
m_jumpToLineAction->setEnabled(ready);
|
m_jumpToLineAction->setEnabled(ready);
|
||||||
m_nextAction->setEnabled(ready);
|
m_nextAction->setEnabled(ready);
|
||||||
//showStatusMessage(QString("started: %1, running: %2").arg(started).arg(running));
|
//showStatusMessage(QString("started: %1, running: %2")
|
||||||
|
// .arg(started).arg(running));
|
||||||
emit statusChanged(m_status);
|
emit statusChanged(m_status);
|
||||||
const bool notbusy = ready || status == DebuggerProcessNotReady;
|
const bool notbusy = ready || status == DebuggerProcessNotReady;
|
||||||
setBusyCursor(!notbusy);
|
setBusyCursor(!notbusy);
|
||||||
@@ -1467,6 +1472,15 @@ void DebuggerManager::setSessionValue(const QString &name, const QVariant &value
|
|||||||
emit setSessionValueRequested(name, value);
|
emit setSessionValueRequested(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerManager::showMessageBox(int icon,
|
||||||
|
const QString &title, const QString &text)
|
||||||
|
{
|
||||||
|
QMessageBox *mb = new QMessageBox(QMessageBox::Icon(icon),
|
||||||
|
title, text, QMessageBox::NoButton, mainWindow());
|
||||||
|
mb->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
mb->show();
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Testing
|
// Testing
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class QAction;
|
|||||||
class QAbstractItemModel;
|
class QAbstractItemModel;
|
||||||
class QDockWidget;
|
class QDockWidget;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
|
class QMessageBox;
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
class QPoint;
|
class QPoint;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
@@ -183,12 +184,10 @@ enum DebuggerEngineTypeFlags
|
|||||||
ScriptEngineType = 0x02,
|
ScriptEngineType = 0x02,
|
||||||
CdbEngineType = 0x04,
|
CdbEngineType = 0x04,
|
||||||
TcfEngineType = 0x08,
|
TcfEngineType = 0x08,
|
||||||
SymbianEngineType = 0x10,
|
|
||||||
AllEngineTypes = GdbEngineType
|
AllEngineTypes = GdbEngineType
|
||||||
| ScriptEngineType
|
| ScriptEngineType
|
||||||
| CdbEngineType
|
| CdbEngineType
|
||||||
| TcfEngineType
|
| TcfEngineType
|
||||||
| SymbianEngineType
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// The construct below is not nice but enforces a bit of order. The
|
// The construct below is not nice but enforces a bit of order. The
|
||||||
@@ -279,6 +278,8 @@ public:
|
|||||||
virtual DebuggerStartParametersPtr startParameters() const;
|
virtual DebuggerStartParametersPtr startParameters() const;
|
||||||
virtual qint64 inferiorPid() const;
|
virtual qint64 inferiorPid() const;
|
||||||
|
|
||||||
|
void showMessageBox(int icon, const QString &title, const QString &text);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void startNewDebugger(const DebuggerStartParametersPtr &sp);
|
void startNewDebugger(const DebuggerStartParametersPtr &sp);
|
||||||
void exitDebugger();
|
void exitDebugger();
|
||||||
|
|||||||
@@ -81,12 +81,15 @@ public:
|
|||||||
virtual void setEnvironment(const QStringList &env) = 0;
|
virtual void setEnvironment(const QStringList &env) = 0;
|
||||||
virtual bool isTrkAdapter() const = 0;
|
virtual bool isTrkAdapter() const = 0;
|
||||||
|
|
||||||
virtual void startAdapter(const DebuggerStartParametersPtr &sp) = 0;
|
virtual void startAdapter() = 0;
|
||||||
virtual void prepareInferior() = 0;
|
virtual void prepareInferior() = 0;
|
||||||
virtual void startInferior() = 0;
|
virtual void startInferior() = 0;
|
||||||
virtual void interruptInferior() = 0;
|
virtual void interruptInferior() = 0;
|
||||||
virtual void shutdown() = 0;
|
virtual void shutdown() = 0;
|
||||||
|
|
||||||
|
virtual const DebuggerStartParameters &startParameters() const
|
||||||
|
{ return m_engine->startParameters(); }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void adapterStarted();
|
void adapterStarted();
|
||||||
void adapterStartFailed(const QString &msg);
|
void adapterStartFailed(const QString &msg);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "trkoptionspage.h"
|
#include "trkoptionspage.h"
|
||||||
#include "plaingdbadapter.h"
|
#include "plaingdbadapter.h"
|
||||||
#include "trkgdbadapter.h"
|
#include "trkgdbadapter.h"
|
||||||
|
#include "remotegdbadapter.h"
|
||||||
|
|
||||||
#include "watchutils.h"
|
#include "watchutils.h"
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
@@ -173,6 +174,47 @@ GdbEngine::GdbEngine(DebuggerManager *parent) :
|
|||||||
qq(parent->engineInterface())
|
qq(parent->engineInterface())
|
||||||
{
|
{
|
||||||
m_gdbAdapter = 0;
|
m_gdbAdapter = 0;
|
||||||
|
QSharedPointer<TrkOptions> options(new TrkOptions);
|
||||||
|
options->fromSettings(Core::ICore::instance()->settings());
|
||||||
|
m_plainAdapter = new PlainGdbAdapter(this);
|
||||||
|
m_trkAdapter = new TrkGdbAdapter(this, options);
|
||||||
|
m_remoteAdapter = 0; // FIXME
|
||||||
|
|
||||||
|
// Output
|
||||||
|
connect(&m_outputCollector, SIGNAL(byteDelivery(QByteArray)),
|
||||||
|
this, SLOT(readDebugeeOutput(QByteArray)));
|
||||||
|
|
||||||
|
connect(this, SIGNAL(gdbOutputAvailable(int,QString)),
|
||||||
|
m_manager, SLOT(showDebuggerOutput(int,QString)),
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
connect(this, SIGNAL(gdbInputAvailable(int,QString)),
|
||||||
|
m_manager, SLOT(showDebuggerInput(int,QString)),
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
connect(this, SIGNAL(applicationOutputAvailable(QString)),
|
||||||
|
m_manager, SLOT(showApplicationOutput(QString)),
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GdbEngine::connectDebuggingHelperActions(bool on)
|
||||||
|
{
|
||||||
|
if (on) {
|
||||||
|
connect(theDebuggerAction(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
|
||||||
|
this, SLOT(setUseDebuggingHelpers(QVariant)));
|
||||||
|
connect(theDebuggerAction(DebugDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
|
||||||
|
this, SLOT(setDebugDebuggingHelpers(QVariant)));
|
||||||
|
connect(theDebuggerAction(RecheckDebuggingHelpers), SIGNAL(triggered()),
|
||||||
|
this, SLOT(recheckDebuggingHelperAvailability()));
|
||||||
|
} else {
|
||||||
|
disconnect(theDebuggerAction(UseDebuggingHelpers), 0, this, 0);
|
||||||
|
disconnect(theDebuggerAction(DebugDebuggingHelpers), 0, this, 0);
|
||||||
|
disconnect(theDebuggerAction(RecheckDebuggingHelpers), 0, this, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DebuggerStartMode GdbEngine::startMode() const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(!m_startParameters.isNull(), return NoStartMode);
|
||||||
|
return m_startParameters->startMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdbEngine::~GdbEngine()
|
GdbEngine::~GdbEngine()
|
||||||
@@ -180,19 +222,15 @@ GdbEngine::~GdbEngine()
|
|||||||
// prevent sending error messages afterwards
|
// prevent sending error messages afterwards
|
||||||
if (m_gdbAdapter) {
|
if (m_gdbAdapter) {
|
||||||
m_gdbAdapter->disconnect(this);
|
m_gdbAdapter->disconnect(this);
|
||||||
delete m_gdbAdapter;
|
//delete m_gdbAdapter;
|
||||||
m_gdbAdapter = 0;
|
m_gdbAdapter = 0;
|
||||||
}
|
}
|
||||||
|
delete m_plainAdapter;
|
||||||
|
delete m_trkAdapter;
|
||||||
|
delete m_remoteAdapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::setGdbAdapter(AbstractGdbAdapter *gdbAdapter)
|
void GdbEngine::connectAdapter()
|
||||||
{
|
|
||||||
m_gdbAdapter = gdbAdapter;
|
|
||||||
initializeVariables();
|
|
||||||
initializeConnections();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbEngine::initializeConnections()
|
|
||||||
{
|
{
|
||||||
// Gdb Process interaction
|
// Gdb Process interaction
|
||||||
connect(m_gdbAdapter, SIGNAL(error(QProcess::ProcessError)),
|
connect(m_gdbAdapter, SIGNAL(error(QProcess::ProcessError)),
|
||||||
@@ -227,28 +265,44 @@ void GdbEngine::initializeConnections()
|
|||||||
|
|
||||||
connect(m_gdbAdapter, SIGNAL(adapterCrashed()),
|
connect(m_gdbAdapter, SIGNAL(adapterCrashed()),
|
||||||
m_manager, SLOT(exitDebugger()));
|
m_manager, SLOT(exitDebugger()));
|
||||||
|
}
|
||||||
|
|
||||||
// Output
|
|
||||||
connect(&m_outputCollector, SIGNAL(byteDelivery(QByteArray)),
|
|
||||||
this, SLOT(readDebugeeOutput(QByteArray)));
|
|
||||||
|
|
||||||
connect(this, SIGNAL(gdbOutputAvailable(int,QString)),
|
void GdbEngine::disconnectAdapter()
|
||||||
m_manager, SLOT(showDebuggerOutput(int,QString)),
|
{
|
||||||
Qt::QueuedConnection);
|
// Gdb Process interaction
|
||||||
connect(this, SIGNAL(gdbInputAvailable(int,QString)),
|
disconnect(m_gdbAdapter, SIGNAL(error(QProcess::ProcessError)),
|
||||||
m_manager, SLOT(showDebuggerInput(int,QString)),
|
this, SLOT(gdbProcError(QProcess::ProcessError)));
|
||||||
Qt::QueuedConnection);
|
disconnect(m_gdbAdapter, SIGNAL(readyReadStandardOutput()),
|
||||||
connect(this, SIGNAL(applicationOutputAvailable(QString)),
|
this, SLOT(readGdbStandardOutput()));
|
||||||
m_manager, SLOT(showApplicationOutput(QString)),
|
disconnect(m_gdbAdapter, SIGNAL(readyReadStandardError()),
|
||||||
Qt::QueuedConnection);
|
this, SLOT(readGdbStandardError()));
|
||||||
|
|
||||||
// FIXME: These trigger even if the engine is not active
|
disconnect(m_gdbAdapter, SIGNAL(adapterStarted()),
|
||||||
connect(theDebuggerAction(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
|
this, SLOT(handleAdapterStarted()));
|
||||||
this, SLOT(setUseDebuggingHelpers(QVariant)));
|
disconnect(m_gdbAdapter, SIGNAL(adapterStartFailed(QString)),
|
||||||
connect(theDebuggerAction(DebugDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
|
this, SLOT(handleAdapterStartFailed(QString)));
|
||||||
this, SLOT(setDebugDebuggingHelpers(QVariant)));
|
disconnect(m_gdbAdapter, SIGNAL(adapterShutDown()),
|
||||||
connect(theDebuggerAction(RecheckDebuggingHelpers), SIGNAL(triggered()),
|
this, SLOT(handleAdapterShutDown()));
|
||||||
this, SLOT(recheckDebuggingHelperAvailability()));
|
disconnect(m_gdbAdapter, SIGNAL(adapterShutdownFailed(QString)),
|
||||||
|
this, SLOT(handleAdapterShutdownFailed(QString)));
|
||||||
|
|
||||||
|
disconnect(m_gdbAdapter, SIGNAL(inferiorPrepared()),
|
||||||
|
this, SLOT(handleInferiorPrepared()));
|
||||||
|
disconnect(m_gdbAdapter, SIGNAL(inferiorPreparationFailed(QString)),
|
||||||
|
this, SLOT(handleInferiorPreparationFailed(QString)));
|
||||||
|
|
||||||
|
disconnect(m_gdbAdapter, SIGNAL(inferiorStarted()),
|
||||||
|
this, SLOT(handleInferiorStarted()));
|
||||||
|
disconnect(m_gdbAdapter, SIGNAL(inferiorStartFailed(QString)),
|
||||||
|
this, SLOT(handleInferiorStartFailed(QString)));
|
||||||
|
disconnect(m_gdbAdapter, SIGNAL(inferiorShutDown()),
|
||||||
|
this, SLOT(handleInferiorShutDown()));
|
||||||
|
disconnect(m_gdbAdapter, SIGNAL(inferiorShutdownFailed(QString)),
|
||||||
|
this, SLOT(handleInferiorShutdownFailed(QString)));
|
||||||
|
|
||||||
|
disconnect(m_gdbAdapter, SIGNAL(adapterCrashed()),
|
||||||
|
m_manager, SLOT(exitDebugger()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::initializeVariables()
|
void GdbEngine::initializeVariables()
|
||||||
@@ -292,13 +346,13 @@ void GdbEngine::gdbProcError(QProcess::ProcessError error)
|
|||||||
bool kill = true;
|
bool kill = true;
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case QProcess::FailedToStart:
|
case QProcess::FailedToStart:
|
||||||
kill = false;
|
//kill = false;
|
||||||
msg = tr("The Gdb process failed to start. Either the "
|
msg = tr("The Gdb process failed to start. Either the "
|
||||||
"invoked program '%1' is missing, or you may have insufficient "
|
"invoked program '%1' is missing, or you may have insufficient "
|
||||||
"permissions to invoke the program.")
|
"permissions to invoke the program.")
|
||||||
.arg(theDebuggerStringSetting(GdbLocation));
|
.arg(theDebuggerStringSetting(GdbLocation));
|
||||||
emit startFailed();
|
//emit startFailed();
|
||||||
shutdown();
|
//shutdown();
|
||||||
break;
|
break;
|
||||||
case QProcess::Crashed:
|
case QProcess::Crashed:
|
||||||
kill = false;
|
kill = false;
|
||||||
@@ -325,9 +379,9 @@ void GdbEngine::gdbProcError(QProcess::ProcessError error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
showStatusMessage(msg);
|
showStatusMessage(msg);
|
||||||
QMessageBox::critical(mainWindow(), tr("Error"), msg);
|
showMessageBox(QMessageBox::Critical, tr("Error"), msg);
|
||||||
// act as if it was closed by the core
|
// act as if it was closed by the core
|
||||||
if (kill)
|
//if (kill)
|
||||||
m_manager->exitDebugger();
|
m_manager->exitDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,13 +543,27 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case '~': {
|
case '~': {
|
||||||
static QRegExp re(_("New .hread 0x[0-9a-f]* \\(LWP ([0-9]*)\\)"));
|
|
||||||
QByteArray data = GdbMi::parseCString(from, to);
|
QByteArray data = GdbMi::parseCString(from, to);
|
||||||
m_pendingConsoleStreamOutput += data;
|
m_pendingConsoleStreamOutput += data;
|
||||||
if (re.indexIn(_(data)) != -1)
|
|
||||||
maybeHandleInferiorPidChanged(re.cap(1));
|
// Parse pid from noise.
|
||||||
|
if (!inferiorPid()) {
|
||||||
|
// Linux/Mac gdb: [New [Tt]hread 0x545 (LWP 4554)]
|
||||||
|
static QRegExp re1(_("New .hread 0x[0-9a-f]+ \\(LWP ([0-9]*)\\)"));
|
||||||
|
// MinGW 6.8: [New thread 2437.0x435345]
|
||||||
|
static QRegExp re2(_("New .hread ([0-9]+)\\.0x[0-9a-f]*"));
|
||||||
|
QTC_ASSERT(re1.isValid() && re2.isValid(), return);
|
||||||
|
if (re1.indexIn(_(data)) != -1)
|
||||||
|
maybeHandleInferiorPidChanged(re1.cap(1));
|
||||||
|
else if (re2.indexIn(_(data)) != -1)
|
||||||
|
maybeHandleInferiorPidChanged(re2.cap(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show some messages to give the impression something happens.
|
||||||
if (data.startsWith("Reading symbols from "))
|
if (data.startsWith("Reading symbols from "))
|
||||||
showStatusMessage(tr("Reading %1...").arg(_(data.mid(21))));
|
showStatusMessage(tr("Reading %1...").arg(_(data.mid(21))), 1000);
|
||||||
|
if (data.startsWith("[New "))
|
||||||
|
showStatusMessage(_(data), 1000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -756,8 +824,8 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
|
|||||||
// msg="Cannot find new threads: generic error"
|
// msg="Cannot find new threads: generic error"
|
||||||
if (record.resultClass == GdbResultError) {
|
if (record.resultClass == GdbResultError) {
|
||||||
QByteArray msg = record.data.findChild("msg").data();
|
QByteArray msg = record.data.findChild("msg").data();
|
||||||
QMessageBox::critical(mainWindow(), tr("Error"),
|
showMessageBox(QMessageBox::Critical,
|
||||||
tr("Executable failed:\n") + QString::fromLocal8Bit(msg));
|
tr("Executable failed"), QString::fromLocal8Bit(msg));
|
||||||
showStatusMessage(tr("Process failed to start."));
|
showStatusMessage(tr("Process failed to start."));
|
||||||
exitDebugger();
|
exitDebugger();
|
||||||
//qq->notifyInferiorStopped();
|
//qq->notifyInferiorStopped();
|
||||||
@@ -775,7 +843,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
|
|||||||
|
|
||||||
if (record.token < m_oldestAcceptableToken && (cmd.flags & Discardable)) {
|
if (record.token < m_oldestAcceptableToken && (cmd.flags & Discardable)) {
|
||||||
//qDebug() << "### SKIPPING OLD RESULT" << record.toString();
|
//qDebug() << "### SKIPPING OLD RESULT" << record.toString();
|
||||||
//QMessageBox::information(mainWindow(), tr("Skipped"), "xxx");
|
//showMessageBox(QMessageBox::Information(tr("Skipped"), "xxx"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1253,11 +1321,8 @@ void GdbEngine::handleStop1(const GdbResultRecord &, const QVariant &cookie)
|
|||||||
"<tr><td>Signal meaning : </td><td>%2</td></tr></table>")
|
"<tr><td>Signal meaning : </td><td>%2</td></tr></table>")
|
||||||
.arg(name.isEmpty() ? tr(" <Unknown> ") : _(name))
|
.arg(name.isEmpty() ? tr(" <Unknown> ") : _(name))
|
||||||
.arg(meaning.isEmpty() ? tr(" <Unknown> ") : _(meaning));
|
.arg(meaning.isEmpty() ? tr(" <Unknown> ") : _(meaning));
|
||||||
QMessageBox *mb = new QMessageBox(QMessageBox::Information,
|
showMessageBox(QMessageBox::Information,
|
||||||
tr("Signal received"), msg, QMessageBox::NoButton,
|
tr("Signal received"), msg);
|
||||||
mainWindow());
|
|
||||||
mb->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
mb->show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1344,7 +1409,7 @@ void GdbEngine::handleShowVersion(const GdbResultRecord &response, const QVarian
|
|||||||
err->setMinimumSize(400, 300);
|
err->setMinimumSize(400, 300);
|
||||||
err->showMessage(msg);
|
err->showMessage(msg);
|
||||||
#else
|
#else
|
||||||
//QMessageBox::information(mainWindow(), tr("Warning"), msg);
|
//showMessageBox(QMessageBox::Information, tr("Warning"), msg);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
m_gdbVersion = 10000 * supported.cap(2).toInt()
|
m_gdbVersion = 10000 * supported.cap(2).toInt()
|
||||||
@@ -1364,8 +1429,7 @@ void GdbEngine::handleFileExecAndSymbols(const GdbResultRecord &response, const
|
|||||||
//m_breakHandler->clearBreakMarkers();
|
//m_breakHandler->clearBreakMarkers();
|
||||||
} else if (response.resultClass == GdbResultError) {
|
} else if (response.resultClass == GdbResultError) {
|
||||||
QString msg = __(response.data.findChild("msg").data());
|
QString msg = __(response.data.findChild("msg").data());
|
||||||
QMessageBox::critical(mainWindow(), tr("Error"),
|
showMessageBox(QMessageBox::Critical, tr("Starting executable failed"), msg);
|
||||||
tr("Starting executable failed:\n") + msg);
|
|
||||||
QTC_ASSERT(status() == DebuggerInferiorRunning, /**/);
|
QTC_ASSERT(status() == DebuggerInferiorRunning, /**/);
|
||||||
//interruptInferior();
|
//interruptInferior();
|
||||||
qq->notifyInferiorExited();
|
qq->notifyInferiorExited();
|
||||||
@@ -1380,8 +1444,8 @@ void GdbEngine::handleExecRun(const GdbResultRecord &response, const QVariant &)
|
|||||||
} else {
|
} else {
|
||||||
QTC_ASSERT(response.resultClass == GdbResultError, /**/);
|
QTC_ASSERT(response.resultClass == GdbResultError, /**/);
|
||||||
const QByteArray &msg = response.data.findChild("msg").data();
|
const QByteArray &msg = response.data.findChild("msg").data();
|
||||||
QMessageBox::critical(mainWindow(), tr("Error"),
|
showMessageBox(QMessageBox::Critical, tr("Starting executable failed",
|
||||||
tr("Starting executable failed:\n") + QString::fromLocal8Bit(msg));
|
QString::fromLocal8Bit(msg)));
|
||||||
QTC_ASSERT(status() == DebuggerInferiorRunning, /**/);
|
QTC_ASSERT(status() == DebuggerInferiorRunning, /**/);
|
||||||
//interruptInferior();
|
//interruptInferior();
|
||||||
qq->notifyInferiorExited();
|
qq->notifyInferiorExited();
|
||||||
@@ -1402,8 +1466,8 @@ void GdbEngine::handleExecContinue(const GdbResultRecord &response, const QVaria
|
|||||||
// "Leaving function..."));
|
// "Leaving function..."));
|
||||||
//stepOutExec();
|
//stepOutExec();
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::critical(mainWindow(), tr("Error"),
|
showMessageBox(QMessageBox::Critical, tr("Starting executable failed"),
|
||||||
tr("Starting executable failed:\n") + QString::fromLocal8Bit(msg));
|
QString::fromLocal8Bit(msg));
|
||||||
QTC_ASSERT(status() == DebuggerInferiorRunning, /**/);
|
QTC_ASSERT(status() == DebuggerInferiorRunning, /**/);
|
||||||
//interruptInferior();
|
//interruptInferior();
|
||||||
qq->notifyInferiorExited();
|
qq->notifyInferiorExited();
|
||||||
@@ -1457,48 +1521,22 @@ void GdbEngine::shutdown()
|
|||||||
|
|
||||||
void GdbEngine::detachDebugger()
|
void GdbEngine::detachDebugger()
|
||||||
{
|
{
|
||||||
postCommand(_("detach"));
|
postCommand(_("detach"), CB(handleDetach));
|
||||||
// FIXME: use postCommand(_("detach"), CB(handleExitHelper)) ?
|
|
||||||
postCommand(_("-gdb-exit"), CB(handleExit));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::exitDebugger()
|
void GdbEngine::exitDebugger()
|
||||||
{
|
{
|
||||||
|
connectDebuggingHelperActions(false);
|
||||||
m_outputCollector.shutdown();
|
m_outputCollector.shutdown();
|
||||||
initializeVariables();
|
initializeVariables();
|
||||||
m_gdbAdapter->shutdown();
|
m_gdbAdapter->shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleExitHelper(const GdbResultRecord &, const QVariant &)
|
void GdbEngine::handleDetach(const GdbResultRecord &, const QVariant &)
|
||||||
{
|
{
|
||||||
exitDebugger2();
|
exitDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::exitDebugger2()
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
postCommand(_("-gdb-exit"), CB(handleExit));
|
|
||||||
// 20s can easily happen when loading webkit debug information
|
|
||||||
if (!m_gdbAdapter->waitForFinished(20000)) {
|
|
||||||
debugMessage(_("FORCING TERMINATION: %1")
|
|
||||||
.arg(m_gdbAdapter->state()));
|
|
||||||
m_gdbAdapter->terminate();
|
|
||||||
m_gdbAdapter->waitForFinished(20000);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_gdbAdapter->state() != QProcess::NotRunning) {
|
|
||||||
debugMessage(_("PROBLEM STOPPING DEBUGGER: STATE %1")
|
|
||||||
.arg(m_gdbAdapter->state()));
|
|
||||||
m_gdbAdapter->kill();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
m_outputCollector.shutdown();
|
|
||||||
initializeVariables();
|
|
||||||
//m_manager->settings()->m_debugDebuggingHelpers = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int GdbEngine::currentFrame() const
|
int GdbEngine::currentFrame() const
|
||||||
{
|
{
|
||||||
return qq->stackHandler()->currentIndex();
|
return qq->stackHandler()->currentIndex();
|
||||||
@@ -1506,20 +1544,30 @@ int GdbEngine::currentFrame() const
|
|||||||
|
|
||||||
void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
|
void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
|
||||||
{
|
{
|
||||||
|
// This should be set by the constructor or in exitDebugger()
|
||||||
|
// via initializeVariables()
|
||||||
|
//QTC_ASSERT(m_debuggingHelperState == DebuggingHelperUninitialized,
|
||||||
|
// initializeVariables());
|
||||||
|
//QTC_ASSERT(m_gdbAdapter == 0, delete m_gdbAdapter; m_gdbAdapter = 0);
|
||||||
|
|
||||||
m_startParameters = sp;
|
m_startParameters = sp;
|
||||||
m_gdbAdapter->startAdapter(sp);
|
if (startModeAllowsDumpers())
|
||||||
|
connectDebuggingHelperActions(true);
|
||||||
|
|
||||||
|
if (m_gdbAdapter)
|
||||||
|
disconnectAdapter();
|
||||||
|
|
||||||
|
if (sp->executable.endsWith(_(".sym")))
|
||||||
|
m_gdbAdapter = m_trkAdapter;
|
||||||
|
else
|
||||||
|
m_gdbAdapter = m_plainAdapter;
|
||||||
|
|
||||||
|
initializeVariables();
|
||||||
|
connectAdapter();
|
||||||
|
|
||||||
|
m_gdbAdapter->startAdapter();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// This should be set by the constructor or in exitDebugger().
|
|
||||||
QTC_ASSERT(m_debuggingHelperState == DebuggingHelperUninitialized,
|
|
||||||
initializeVariables());
|
|
||||||
|
|
||||||
if (m_gdbAdapter->state() != QProcess::NotRunning) {
|
|
||||||
debugMessage(_("GDB IS ALREADY RUNNING, STATE: %1").arg(m_gdbAdapter->state()));
|
|
||||||
m_gdbAdapter->kill();
|
|
||||||
emitStartFailed();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList gdbArgs;
|
QStringList gdbArgs;
|
||||||
gdbArgs.prepend(_("mi"));
|
gdbArgs.prepend(_("mi"));
|
||||||
gdbArgs.prepend(_("-i"));
|
gdbArgs.prepend(_("-i"));
|
||||||
@@ -1527,19 +1575,6 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
|
|||||||
if (startMode() == AttachCore || startMode() == AttachExternal
|
if (startMode() == AttachCore || startMode() == AttachExternal
|
||||||
|| startMode() == AttachCrashedExternal) {
|
|| startMode() == AttachCrashedExternal) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
} else if (startMode() == StartRemote) {
|
|
||||||
// Start the remote server
|
|
||||||
if (m_startParameters->serverStartScript.isEmpty()) {
|
|
||||||
showStatusMessage(_("No server start script given. "
|
|
||||||
"Assuming server runs already."));
|
|
||||||
} else {
|
|
||||||
if (!m_startParameters->workingDir.isEmpty())
|
|
||||||
m_uploadProc.setWorkingDirectory(m_startParameters->workingDir);
|
|
||||||
if (!m_startParameters->environment.isEmpty())
|
|
||||||
m_uploadProc.setEnvironment(m_startParameters->environment);
|
|
||||||
m_uploadProc.start(_("/bin/sh ") + m_startParameters->serverStartScript);
|
|
||||||
m_uploadProc.waitForStarted();
|
|
||||||
}
|
|
||||||
} else if (m_startParameters->useTerminal) {
|
} else if (m_startParameters->useTerminal) {
|
||||||
m_stubProc.stop(); // We leave the console open, so recycle it now.
|
m_stubProc.stop(); // We leave the console open, so recycle it now.
|
||||||
|
|
||||||
@@ -1553,7 +1588,7 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!m_outputCollector.listen()) {
|
if (!m_outputCollector.listen()) {
|
||||||
QMessageBox::critical(mainWindow(), tr("Debugger Startup Failure"),
|
showMessageBox(QMessageBox::Critical, tr("Debugger Startup Failure"),
|
||||||
tr("Cannot set up communication with child process: %1")
|
tr("Cannot set up communication with child process: %1")
|
||||||
.arg(m_outputCollector.errorString()));
|
.arg(m_outputCollector.errorString()));
|
||||||
emitStartFailed();
|
emitStartFailed();
|
||||||
@@ -1566,19 +1601,6 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
|
|||||||
if (!m_startParameters->environment.isEmpty())
|
if (!m_startParameters->environment.isEmpty())
|
||||||
m_gdbAdapter->setEnvironment(m_startParameters->environment);
|
m_gdbAdapter->setEnvironment(m_startParameters->environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
qDebug() << "Command:" << m_manager->settings()->m_gdbCmd;
|
|
||||||
qDebug() << "WorkingDirectory:" << m_gdbAdapter->workingDirectory();
|
|
||||||
qDebug() << "ScriptFile:" << m_manager->settings()->m_scriptFile;
|
|
||||||
qDebug() << "Environment:" << m_gdbAdapter->environment();
|
|
||||||
qDebug() << "Arguments:" << gdbArgs;
|
|
||||||
qDebug() << "BuildDir:" << m_startParameters->buildDir;
|
|
||||||
qDebug() << "ExeFile:" << m_startParameters->executable;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString loc = theDebuggerStringSetting(GdbLocation);
|
|
||||||
showStatusMessage(tr("Starting Debugger: ") + loc + _c(' ') + gdbArgs.join(_(" ")));
|
|
||||||
m_gdbAdapter->start(loc, gdbArgs);
|
m_gdbAdapter->start(loc, gdbArgs);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@@ -1591,6 +1613,7 @@ void GdbEngine::continueInferior()
|
|||||||
postCommand(_("-exec-continue"), CB(handleExecContinue));
|
postCommand(_("-exec-continue"), CB(handleExecContinue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
void GdbEngine::handleAttach(const GdbResultRecord &, const QVariant &)
|
void GdbEngine::handleAttach(const GdbResultRecord &, const QVariant &)
|
||||||
{
|
{
|
||||||
qq->notifyInferiorStopped();
|
qq->notifyInferiorStopped();
|
||||||
@@ -1644,10 +1667,11 @@ void GdbEngine::handleTargetRemote(const GdbResultRecord &record, const QVariant
|
|||||||
QString msg = __(record.data.findChild("msg").data());
|
QString msg = __(record.data.findChild("msg").data());
|
||||||
QString msg1 = tr("Connecting to remote server failed:");
|
QString msg1 = tr("Connecting to remote server failed:");
|
||||||
showStatusMessage(msg1 + _c(' ') + msg);
|
showStatusMessage(msg1 + _c(' ') + msg);
|
||||||
QMessageBox::critical(mainWindow(), tr("Error"), msg1 + _c('\n') + msg);
|
showMessageBox(QMessageBox::Critical, tr("Error"), msg1 + _c('\n') + msg);
|
||||||
postCommand(_("-gdb-exit"), CB(handleExit));
|
postCommand(_("-gdb-exit"), CB(handleExit));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void GdbEngine::handleExit(const GdbResultRecord &, const QVariant &)
|
void GdbEngine::handleExit(const GdbResultRecord &, const QVariant &)
|
||||||
{
|
{
|
||||||
@@ -3845,9 +3869,8 @@ void GdbEngine::recheckDebuggingHelperAvailability()
|
|||||||
|
|
||||||
bool GdbEngine::startModeAllowsDumpers() const
|
bool GdbEngine::startModeAllowsDumpers() const
|
||||||
{
|
{
|
||||||
return startMode() == StartInternal
|
const DebuggerStartMode m = startMode();
|
||||||
|| startMode() == StartExternal
|
return m == StartInternal || m == StartExternal || m == AttachExternal;
|
||||||
|| startMode() == AttachExternal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::watchPoint(const QPoint &pnt)
|
void GdbEngine::watchPoint(const QPoint &pnt)
|
||||||
@@ -4081,28 +4104,31 @@ void GdbEngine::gotoLocation(const StackFrame &frame, bool setMarker)
|
|||||||
void GdbEngine::handleAdapterStartFailed(const QString &msg)
|
void GdbEngine::handleAdapterStartFailed(const QString &msg)
|
||||||
{
|
{
|
||||||
debugMessage(_("ADAPTER START FAILED"));
|
debugMessage(_("ADAPTER START FAILED"));
|
||||||
m_outputCollector.shutdown();
|
showMessageBox(QMessageBox::Critical, tr("Adapter start failed"), msg);
|
||||||
QMessageBox::critical(mainWindow(), tr("Error"), msg);
|
qq->notifyInferiorExited();
|
||||||
QTC_ASSERT(status() == DebuggerInferiorRunning, /**/);
|
m_manager->exitDebugger();
|
||||||
//interruptInferior();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleAdapterStarted()
|
void GdbEngine::handleAdapterStarted()
|
||||||
{
|
{
|
||||||
debugMessage(_("ADAPTER SUCCESSFULLY STARTED, PREPARING INFERIOR"));
|
debugMessage(_("ADAPTER SUCCESSFULLY STARTED, PREPARING INFERIOR"));
|
||||||
|
qq->notifyInferiorStopped();
|
||||||
m_gdbAdapter->prepareInferior();
|
m_gdbAdapter->prepareInferior();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleInferiorPreparationFailed(const QString &msg)
|
void GdbEngine::handleInferiorPreparationFailed(const QString &msg)
|
||||||
{
|
{
|
||||||
debugMessage(_("INFERIOR PREPARATION FAILD"));
|
debugMessage(_("INFERIOR PREPARATION FAILD"));
|
||||||
m_outputCollector.shutdown();
|
showMessageBox(QMessageBox::Critical,
|
||||||
QMessageBox::critical(mainWindow(), tr("Error"),
|
tr("Inferior start preparation failed"), msg);
|
||||||
tr("Inferior start preparation failed:\n") + msg);
|
shutdown();
|
||||||
|
qq->notifyInferiorExited();
|
||||||
|
m_manager->exitDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleInferiorPrepared()
|
void GdbEngine::handleInferiorPrepared()
|
||||||
{
|
{
|
||||||
|
debugMessage(_("INFERIOR PREPARED"));
|
||||||
// FIXME: Check that inferior is in "stopped" state
|
// FIXME: Check that inferior is in "stopped" state
|
||||||
qq->notifyInferiorStopped();
|
qq->notifyInferiorStopped();
|
||||||
showStatusMessage(tr("Inferior prepared for startup."));
|
showStatusMessage(tr("Inferior prepared for startup."));
|
||||||
@@ -4175,7 +4201,7 @@ void GdbEngine::handleInferiorPrepared()
|
|||||||
if (QFileInfo(scriptFileName).isReadable()) {
|
if (QFileInfo(scriptFileName).isReadable()) {
|
||||||
postCommand(_("source ") + scriptFileName);
|
postCommand(_("source ") + scriptFileName);
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::warning(mainWindow(),
|
showMessageBox(QMessageBox::Warning,
|
||||||
tr("Cannot find debugger initialization script"),
|
tr("Cannot find debugger initialization script"),
|
||||||
tr("The debugger settings point to a script file at '%1' "
|
tr("The debugger settings point to a script file at '%1' "
|
||||||
"which is not accessible. If a script file is not needed, "
|
"which is not accessible. If a script file is not needed, "
|
||||||
@@ -4230,7 +4256,7 @@ void GdbEngine::handleInferiorPrepared()
|
|||||||
|
|
||||||
void GdbEngine::handleInitialBreakpointsSet()
|
void GdbEngine::handleInitialBreakpointsSet()
|
||||||
{
|
{
|
||||||
showStatusMessage(tr("Finishing initial breakpoint setting."));
|
showStatusMessage(tr("Initial breakpoint setting finished."), 1000);
|
||||||
qq->notifyInferiorRunningRequested();
|
qq->notifyInferiorRunningRequested();
|
||||||
m_gdbAdapter->startInferior();
|
m_gdbAdapter->startInferior();
|
||||||
}
|
}
|
||||||
@@ -4238,69 +4264,64 @@ void GdbEngine::handleInitialBreakpointsSet()
|
|||||||
void GdbEngine::handleInferiorStartFailed(const QString &msg)
|
void GdbEngine::handleInferiorStartFailed(const QString &msg)
|
||||||
{
|
{
|
||||||
debugMessage(_("INFERIOR START FAILED"));
|
debugMessage(_("INFERIOR START FAILED"));
|
||||||
QMessageBox::critical(mainWindow(), tr("Error"),
|
showMessageBox(QMessageBox::Critical, tr("Inferior start failed"), msg);
|
||||||
tr("Inferior start failed:\n") + msg);
|
|
||||||
qq->notifyInferiorExited();
|
qq->notifyInferiorExited();
|
||||||
|
m_manager->exitDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleInferiorStarted()
|
void GdbEngine::handleInferiorStarted()
|
||||||
{
|
{
|
||||||
|
debugMessage(_("INFERIOR STARTED"));
|
||||||
qq->notifyInferiorRunning();
|
qq->notifyInferiorRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleInferiorShutDown()
|
void GdbEngine::handleInferiorShutDown()
|
||||||
{
|
{
|
||||||
debugMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));
|
debugMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));
|
||||||
qq->notifyInferiorExited();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleInferiorShutdownFailed(const QString &msg)
|
void GdbEngine::handleInferiorShutdownFailed(const QString &msg)
|
||||||
{
|
{
|
||||||
debugMessage(_("INFERIOR SHUTDOWN FAILED"));
|
debugMessage(_("INFERIOR SHUTDOWN FAILED"));
|
||||||
QMessageBox::critical(mainWindow(), tr("Error"),
|
showMessageBox(QMessageBox::Critical,
|
||||||
tr("Inferior shutdown failed:\n") + msg);
|
tr("Inferior shutdown failed"), msg);
|
||||||
|
qq->notifyInferiorExited();
|
||||||
|
m_manager->exitDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleAdapterShutDown()
|
void GdbEngine::handleAdapterShutDown()
|
||||||
{
|
{
|
||||||
debugMessage(_("ADAPTER SUCCESSFULLY SHUT DOWN"));
|
debugMessage(_("ADAPTER SUCCESSFULLY SHUT DOWN"));
|
||||||
|
qq->notifyInferiorExited();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleAdapterShutdownFailed(const QString &msg)
|
void GdbEngine::handleAdapterShutdownFailed(const QString &msg)
|
||||||
{
|
{
|
||||||
debugMessage(_("ADAPTER SHUTDOWN FAILED"));
|
debugMessage(_("ADAPTER SHUTDOWN FAILED"));
|
||||||
QMessageBox::critical(mainWindow(), tr("Error"),
|
showMessageBox(QMessageBox::Critical,
|
||||||
tr("Inferior shutdown failed:\n") + msg);
|
tr("Inferior shutdown failed"), msg);
|
||||||
|
qq->notifyInferiorExited();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GdbEngine::addOptionPages(QList<Core::IOptionsPage*> *opts) const
|
||||||
|
{
|
||||||
|
opts->push_back(new GdbOptionsPage);
|
||||||
|
if (!qgetenv("QTCREATOR_WITH_S60").isEmpty())
|
||||||
|
opts->push_back(new TrkOptionsPage(m_trkAdapter->options()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GdbEngine::showMessageBox(int icon, const QString &title, const QString &text)
|
||||||
|
{
|
||||||
|
m_manager->showMessageBox(icon, title, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Factory
|
// Factory
|
||||||
//
|
//
|
||||||
|
|
||||||
IDebuggerEngine *createGdbEngine(DebuggerManager *parent,
|
IDebuggerEngine *createGdbEngine(DebuggerManager *parent)
|
||||||
QList<Core::IOptionsPage*> *opts)
|
|
||||||
{
|
{
|
||||||
opts->push_back(new GdbOptionsPage);
|
return new GdbEngine(parent);
|
||||||
GdbEngine *engine = new GdbEngine(parent);
|
|
||||||
PlainGdbAdapter *adapter = new PlainGdbAdapter(engine);
|
|
||||||
engine->setGdbAdapter(adapter);
|
|
||||||
return engine;
|
|
||||||
}
|
|
||||||
|
|
||||||
IDebuggerEngine *createSymbianEngine(DebuggerManager *parent,
|
|
||||||
QList<Core::IOptionsPage*> *opts)
|
|
||||||
{
|
|
||||||
QSharedPointer<TrkOptions> options(new TrkOptions);
|
|
||||||
options->fromSettings(Core::ICore::instance()->settings());
|
|
||||||
|
|
||||||
if (!qgetenv("QTCREATOR_WITH_S60").isEmpty())
|
|
||||||
opts->push_back(new TrkOptionsPage(options));
|
|
||||||
GdbEngine *engine = new GdbEngine(parent);
|
|
||||||
TrkGdbAdapter *adapter = new TrkGdbAdapter(engine, options);
|
|
||||||
engine->setGdbAdapter(adapter);
|
|
||||||
QObject::connect(adapter, SIGNAL(output(QString)),
|
|
||||||
parent, SLOT(showDebuggerOutput(QString)));
|
|
||||||
return engine;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ class GdbMi;
|
|||||||
class WatchData;
|
class WatchData;
|
||||||
class BreakpointData;
|
class BreakpointData;
|
||||||
|
|
||||||
|
class PlainGdbAdapter;
|
||||||
|
class TrkGdbAdapter;
|
||||||
|
class RemoteGdbAdapter;
|
||||||
|
|
||||||
enum DebuggingHelperState
|
enum DebuggingHelperState
|
||||||
{
|
{
|
||||||
DebuggingHelperUninitialized,
|
DebuggingHelperUninitialized,
|
||||||
@@ -80,7 +84,6 @@ class GdbEngine : public IDebuggerEngine
|
|||||||
public:
|
public:
|
||||||
explicit GdbEngine(DebuggerManager *parent);
|
explicit GdbEngine(DebuggerManager *parent);
|
||||||
~GdbEngine();
|
~GdbEngine();
|
||||||
void setGdbAdapter(AbstractGdbAdapter *adapter);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void gdbInputAvailable(int channel, const QString &msg);
|
void gdbInputAvailable(int channel, const QString &msg);
|
||||||
@@ -92,8 +95,6 @@ private:
|
|||||||
friend class TrkGdbAdapter;
|
friend class TrkGdbAdapter;
|
||||||
friend class RemoteGdbAdapter;
|
friend class RemoteGdbAdapter;
|
||||||
|
|
||||||
const DebuggerStartParameters &startParameters() const
|
|
||||||
{ return *m_startParameters; }
|
|
||||||
//
|
//
|
||||||
// IDebuggerEngine implementation
|
// IDebuggerEngine implementation
|
||||||
//
|
//
|
||||||
@@ -107,7 +108,6 @@ private:
|
|||||||
void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
|
void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
|
||||||
void startDebugger(const DebuggerStartParametersPtr &sp);
|
void startDebugger(const DebuggerStartParametersPtr &sp);
|
||||||
void exitDebugger();
|
void exitDebugger();
|
||||||
void exitDebugger2();
|
|
||||||
void detachDebugger();
|
void detachDebugger();
|
||||||
|
|
||||||
void continueInferior();
|
void continueInferior();
|
||||||
@@ -156,7 +156,8 @@ private:
|
|||||||
bool supportsThreads() const;
|
bool supportsThreads() const;
|
||||||
void gotoLocation(const StackFrame &frame, bool setLocationMarker);
|
void gotoLocation(const StackFrame &frame, bool setLocationMarker);
|
||||||
|
|
||||||
void initializeConnections();
|
void connectAdapter();
|
||||||
|
void disconnectAdapter();
|
||||||
void initializeVariables();
|
void initializeVariables();
|
||||||
QString fullName(const QString &fileName);
|
QString fullName(const QString &fileName);
|
||||||
// get one usable name out of these, try full names first
|
// get one usable name out of these, try full names first
|
||||||
@@ -248,7 +249,7 @@ private:
|
|||||||
int terminationIndex(const QByteArray &buffer, int &length);
|
int terminationIndex(const QByteArray &buffer, int &length);
|
||||||
void handleResponse(const QByteArray &buff);
|
void handleResponse(const QByteArray &buff);
|
||||||
void handleStart(const GdbResultRecord &response, const QVariant &);
|
void handleStart(const GdbResultRecord &response, const QVariant &);
|
||||||
void handleAttach(const GdbResultRecord &, const QVariant &);
|
//void handleAttach(const GdbResultRecord &, const QVariant &);
|
||||||
void handleAqcuiredInferior();
|
void handleAqcuiredInferior();
|
||||||
void handleAsyncOutput(const GdbMi &data);
|
void handleAsyncOutput(const GdbMi &data);
|
||||||
void handleStop1(const GdbResultRecord &, const QVariant &cookie);
|
void handleStop1(const GdbResultRecord &, const QVariant &cookie);
|
||||||
@@ -268,9 +269,9 @@ private:
|
|||||||
void handleQuerySources(const GdbResultRecord &response, const QVariant &);
|
void handleQuerySources(const GdbResultRecord &response, const QVariant &);
|
||||||
void handleTargetCore(const GdbResultRecord &, const QVariant &);
|
void handleTargetCore(const GdbResultRecord &, const QVariant &);
|
||||||
void handleExit(const GdbResultRecord &, const QVariant &);
|
void handleExit(const GdbResultRecord &, const QVariant &);
|
||||||
void handleExitHelper(const GdbResultRecord &, const QVariant &);
|
void handleDetach(const GdbResultRecord &, const QVariant &);
|
||||||
void handleSetTargetAsync(const GdbResultRecord &, const QVariant &);
|
//void handleSetTargetAsync(const GdbResultRecord &, const QVariant &);
|
||||||
void handleTargetRemote(const GdbResultRecord &, const QVariant &);
|
//void handleTargetRemote(const GdbResultRecord &, const QVariant &);
|
||||||
void handleWatchPoint(const GdbResultRecord &, const QVariant &);
|
void handleWatchPoint(const GdbResultRecord &, const QVariant &);
|
||||||
bool showToolTip();
|
bool showToolTip();
|
||||||
|
|
||||||
@@ -280,7 +281,7 @@ private:
|
|||||||
{ m_manager->showStatusMessage(msg, timeout); }
|
{ m_manager->showStatusMessage(msg, timeout); }
|
||||||
int status() const { return m_manager->status(); }
|
int status() const { return m_manager->status(); }
|
||||||
QMainWindow *mainWindow() const { return m_manager->mainWindow(); }
|
QMainWindow *mainWindow() const { return m_manager->mainWindow(); }
|
||||||
DebuggerStartMode startMode() const { return m_startParameters->startMode; }
|
DebuggerStartMode startMode() const;
|
||||||
qint64 inferiorPid() const { return m_manager->inferiorPid(); }
|
qint64 inferiorPid() const { return m_manager->inferiorPid(); }
|
||||||
|
|
||||||
void handleChildren(const WatchData &parent, const GdbMi &child,
|
void handleChildren(const WatchData &parent, const GdbMi &child,
|
||||||
@@ -411,6 +412,7 @@ private:
|
|||||||
void setWatchDataType(WatchData &data, const GdbMi &mi);
|
void setWatchDataType(WatchData &data, const GdbMi &mi);
|
||||||
void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi);
|
void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi);
|
||||||
void setLocals(const QList<GdbMi> &locals);
|
void setLocals(const QList<GdbMi> &locals);
|
||||||
|
void connectDebuggingHelperActions(bool on);
|
||||||
|
|
||||||
bool startModeAllowsDumpers() const;
|
bool startModeAllowsDumpers() const;
|
||||||
QString parseDisassembler(const GdbMi &lines);
|
QString parseDisassembler(const GdbMi &lines);
|
||||||
@@ -440,8 +442,18 @@ private:
|
|||||||
DebuggerStartParametersPtr m_startParameters;
|
DebuggerStartParametersPtr m_startParameters;
|
||||||
// make sure to re-initialize new members in initializeVariables();
|
// make sure to re-initialize new members in initializeVariables();
|
||||||
|
|
||||||
|
// only one of those is active at a given time
|
||||||
|
PlainGdbAdapter *m_plainAdapter;
|
||||||
|
TrkGdbAdapter *m_trkAdapter;
|
||||||
|
RemoteGdbAdapter *m_remoteAdapter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void showMessageBox(int icon, const QString &title, const QString &text);
|
||||||
void debugMessage(const QString &msg);
|
void debugMessage(const QString &msg);
|
||||||
|
void addOptionPages(QList<Core::IOptionsPage*> *opts) const;
|
||||||
|
const DebuggerStartParameters &startParameters() const
|
||||||
|
{ return *m_startParameters; }
|
||||||
|
|
||||||
OutputCollector m_outputCollector;
|
OutputCollector m_outputCollector;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -83,24 +83,23 @@ PlainGdbAdapter::PlainGdbAdapter(GdbEngine *engine, QObject *parent)
|
|||||||
// m_manager, SLOT(exitDebugger()));
|
// m_manager, SLOT(exitDebugger()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlainGdbAdapter::startAdapter(const DebuggerStartParametersPtr &sp)
|
void PlainGdbAdapter::startAdapter()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == AdapterNotRunning, qDebug() << state());
|
QTC_ASSERT(state() == AdapterNotRunning, qDebug() << state());
|
||||||
setState(AdapterStarting);
|
setState(AdapterStarting);
|
||||||
debugMessage(_("TRYING TO START ADAPTER"));
|
debugMessage(_("TRYING TO START ADAPTER"));
|
||||||
m_startParameters = sp;
|
|
||||||
|
|
||||||
QStringList gdbArgs;
|
QStringList gdbArgs;
|
||||||
gdbArgs.prepend(_("mi"));
|
gdbArgs.prepend(_("mi"));
|
||||||
gdbArgs.prepend(_("-i"));
|
gdbArgs.prepend(_("-i"));
|
||||||
|
|
||||||
if (m_startParameters->useTerminal) {
|
if (startParameters().useTerminal) {
|
||||||
m_stubProc.stop(); // We leave the console open, so recycle it now.
|
m_stubProc.stop(); // We leave the console open, so recycle it now.
|
||||||
|
|
||||||
m_stubProc.setWorkingDirectory(m_startParameters->workingDir);
|
m_stubProc.setWorkingDirectory(startParameters().workingDir);
|
||||||
m_stubProc.setEnvironment(m_startParameters->environment);
|
m_stubProc.setEnvironment(startParameters().environment);
|
||||||
if (!m_stubProc.start(m_startParameters->executable,
|
if (!m_stubProc.start(startParameters().executable,
|
||||||
m_startParameters->processArgs)) {
|
startParameters().processArgs)) {
|
||||||
// Error message for user is delivered via a signal.
|
// Error message for user is delivered via a signal.
|
||||||
emitAdapterStartFailed(QString());
|
emitAdapterStartFailed(QString());
|
||||||
return;
|
return;
|
||||||
@@ -113,10 +112,10 @@ void PlainGdbAdapter::startAdapter(const DebuggerStartParametersPtr &sp)
|
|||||||
}
|
}
|
||||||
gdbArgs.prepend(_("--tty=") + m_engine->m_outputCollector.serverName());
|
gdbArgs.prepend(_("--tty=") + m_engine->m_outputCollector.serverName());
|
||||||
|
|
||||||
if (!m_startParameters->workingDir.isEmpty())
|
if (!startParameters().workingDir.isEmpty())
|
||||||
setWorkingDirectory(m_startParameters->workingDir);
|
setWorkingDirectory(startParameters().workingDir);
|
||||||
if (!m_startParameters->environment.isEmpty())
|
if (!startParameters().environment.isEmpty())
|
||||||
setEnvironment(m_startParameters->environment);
|
setEnvironment(startParameters().environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString location = theDebuggerStringSetting(GdbLocation);
|
QString location = theDebuggerStringSetting(GdbLocation);
|
||||||
@@ -135,9 +134,9 @@ void PlainGdbAdapter::prepareInferior()
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
|
QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
|
||||||
setState(InferiorPreparing);
|
setState(InferiorPreparing);
|
||||||
if (!m_startParameters->processArgs.isEmpty())
|
if (!startParameters().processArgs.isEmpty())
|
||||||
m_engine->postCommand(_("-exec-arguments ")
|
m_engine->postCommand(_("-exec-arguments ")
|
||||||
+ m_startParameters->processArgs.join(_(" ")));
|
+ startParameters().processArgs.join(_(" ")));
|
||||||
QFileInfo fi(m_engine->startParameters().executable);
|
QFileInfo fi(m_engine->startParameters().executable);
|
||||||
m_engine->postCommand(_("-file-exec-and-symbols \"%1\"").arg(fi.absoluteFilePath()),
|
m_engine->postCommand(_("-file-exec-and-symbols \"%1\"").arg(fi.absoluteFilePath()),
|
||||||
CB(handleFileExecAndSymbols));
|
CB(handleFileExecAndSymbols));
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
void setEnvironment(const QStringList &env) { m_gdbProc.setEnvironment(env); }
|
void setEnvironment(const QStringList &env) { m_gdbProc.setEnvironment(env); }
|
||||||
bool isTrkAdapter() const { return false; }
|
bool isTrkAdapter() const { return false; }
|
||||||
|
|
||||||
void startAdapter(const DebuggerStartParametersPtr &sp);
|
void startAdapter();
|
||||||
void prepareInferior();
|
void prepareInferior();
|
||||||
void startInferior();
|
void startInferior();
|
||||||
void interruptInferior();
|
void interruptInferior();
|
||||||
@@ -83,7 +83,6 @@ private:
|
|||||||
Q_SLOT void stubError(const QString &msg);
|
Q_SLOT void stubError(const QString &msg);
|
||||||
|
|
||||||
QProcess m_gdbProc;
|
QProcess m_gdbProc;
|
||||||
DebuggerStartParametersPtr m_startParameters;
|
|
||||||
Core::Utils::ConsoleProcess m_stubProc;
|
Core::Utils::ConsoleProcess m_stubProc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,24 @@ void RemoteGdbAdapter::startAdapter(const DebuggerStartParametersPtr &sp)
|
|||||||
setEnvironment(m_startParameters->environment);
|
setEnvironment(m_startParameters->environment);
|
||||||
|
|
||||||
QString location = theDebuggerStringSetting(GdbLocation);
|
QString location = theDebuggerStringSetting(GdbLocation);
|
||||||
//showStatusMessage(tr("Starting Debugger: ") + loc + _c(' ') + gdbArgs.join(_(" ")));
|
|
||||||
|
/*
|
||||||
|
// FIXME: make asynchroneouis
|
||||||
|
// Start the remote server
|
||||||
|
if (m_startParameters->serverStartScript.isEmpty()) {
|
||||||
|
showStatusMessage(_("No server start script given. "
|
||||||
|
"Assuming server runs already."));
|
||||||
|
} else {
|
||||||
|
if (!m_startParameters->workingDir.isEmpty())
|
||||||
|
m_uploadProc.setWorkingDirectory(m_startParameters->workingDir);
|
||||||
|
if (!m_startParameters->environment.isEmpty())
|
||||||
|
m_uploadProc.setEnvironment(m_startParameters->environment);
|
||||||
|
m_uploadProc.start(_("/bin/sh ") + m_startParameters->serverStartScript);
|
||||||
|
m_uploadProc.waitForStarted();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Start the debugger
|
||||||
m_gdbProc.start(location, gdbArgs);
|
m_gdbProc.start(location, gdbArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ void TrkGdbAdapter::startInferiorEarly()
|
|||||||
if (!m_trkDevice.open(device, &errorMessage)) {
|
if (!m_trkDevice.open(device, &errorMessage)) {
|
||||||
logMessage(QString::fromLatin1("Waiting on %1 (%2)").arg(device, errorMessage));
|
logMessage(QString::fromLatin1("Waiting on %1 (%2)").arg(device, errorMessage));
|
||||||
// Do not loop forever
|
// Do not loop forever
|
||||||
if (m_waitCount++ < (m_options->mode == TrkOptions::BlueTooth ? 60 : 5)) {
|
if (m_waitCount++ < (m_options->mode == TrkOptions::BlueTooth ? 3 : 5)) {
|
||||||
QTimer::singleShot(1000, this, SLOT(startInferiorEarly()));
|
QTimer::singleShot(1000, this, SLOT(startInferiorEarly()));
|
||||||
} else {
|
} else {
|
||||||
QString msg = QString::fromLatin1("Failed to connect to %1 after "
|
QString msg = QString::fromLatin1("Failed to connect to %1 after "
|
||||||
@@ -275,8 +275,13 @@ void TrkGdbAdapter::startInferiorEarly()
|
|||||||
|
|
||||||
void TrkGdbAdapter::logMessage(const QString &msg)
|
void TrkGdbAdapter::logMessage(const QString &msg)
|
||||||
{
|
{
|
||||||
if (m_verbose)
|
if (m_verbose) {
|
||||||
|
#ifdef STANDALONE_RUNNER
|
||||||
emit output(msg);
|
emit output(msg);
|
||||||
|
#else
|
||||||
|
m_engine->debugMessage(msg);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1339,12 +1344,11 @@ void TrkGdbAdapter::handleGdbStateChanged(QProcess::ProcessState newState)
|
|||||||
logMessage(_("GDB: Process State %1").arg(newState));
|
logMessage(_("GDB: Process State %1").arg(newState));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrkGdbAdapter::startAdapter(const DebuggerStartParametersPtr &sp)
|
void TrkGdbAdapter::startAdapter()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == AdapterNotRunning, qDebug() << state());
|
QTC_ASSERT(state() == AdapterNotRunning, qDebug() << state());
|
||||||
setState(AdapterStarting);
|
setState(AdapterStarting);
|
||||||
debugMessage(_("TRYING TO START ADAPTER"));
|
debugMessage(_("TRYING TO START ADAPTER"));
|
||||||
m_startParameters = sp;
|
|
||||||
logMessage(QLatin1String("### Starting TrkGdbAdapter"));
|
logMessage(QLatin1String("### Starting TrkGdbAdapter"));
|
||||||
if (m_options->mode == TrkOptions::BlueTooth) {
|
if (m_options->mode == TrkOptions::BlueTooth) {
|
||||||
const QString device = effectiveTrkDevice();
|
const QString device = effectiveTrkDevice();
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "trkutils.h"
|
#include "trkutils.h"
|
||||||
#include "trkdevice.h"
|
#include "trkdevice.h"
|
||||||
|
#include "trkoptions.h"
|
||||||
#include "abstractgdbadapter.h"
|
#include "abstractgdbadapter.h"
|
||||||
|
|
||||||
#include <QtCore/QHash>
|
#include <QtCore/QHash>
|
||||||
@@ -48,8 +49,6 @@
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
struct TrkOptions;
|
|
||||||
|
|
||||||
struct GdbResult
|
struct GdbResult
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
@@ -85,6 +84,7 @@ public:
|
|||||||
// Set a device (from the project) to override the settings.
|
// Set a device (from the project) to override the settings.
|
||||||
QString overrideTrkDevice() const;
|
QString overrideTrkDevice() const;
|
||||||
void setOverrideTrkDevice(const QString &);
|
void setOverrideTrkDevice(const QString &);
|
||||||
|
const TrkOptionsPtr options() const { return m_options; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void output(const QString &msg);
|
void output(const QString &msg);
|
||||||
@@ -100,7 +100,6 @@ private:
|
|||||||
QProcess m_gdbProc;
|
QProcess m_gdbProc;
|
||||||
QProcess m_rfcommProc;
|
QProcess m_rfcommProc;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
DebuggerStartParametersPtr m_startParameters;
|
|
||||||
void debugMessage(const QString &msg) { m_engine->debugMessage(msg); }
|
void debugMessage(const QString &msg) { m_engine->debugMessage(msg); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -116,7 +115,7 @@ public:
|
|||||||
void setEnvironment(const QStringList &env);
|
void setEnvironment(const QStringList &env);
|
||||||
bool isTrkAdapter() const { return true; }
|
bool isTrkAdapter() const { return true; }
|
||||||
|
|
||||||
void startAdapter(const DebuggerStartParametersPtr &sp);
|
void startAdapter();
|
||||||
void prepareInferior();
|
void prepareInferior();
|
||||||
void startInferior();
|
void startInferior();
|
||||||
void interruptInferior();
|
void interruptInferior();
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ namespace TextEditor {
|
|||||||
class ITextEditor;
|
class ITextEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class IOptionsPage;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -105,6 +109,8 @@ public:
|
|||||||
virtual void setRegisterValue(int regnr, const QString &value)
|
virtual void setRegisterValue(int regnr, const QString &value)
|
||||||
{ Q_UNUSED(regnr); Q_UNUSED(value); }
|
{ Q_UNUSED(regnr); Q_UNUSED(value); }
|
||||||
|
|
||||||
|
virtual void addOptionPages(QList<Core::IOptionsPage*> *) const {}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void startSuccessful();
|
void startSuccessful();
|
||||||
void startFailed();
|
void startFailed();
|
||||||
|
|||||||
@@ -65,10 +65,6 @@
|
|||||||
#include <QtScript/QScriptValue>
|
#include <QtScript/QScriptValue>
|
||||||
#include <QtScript/QScriptValueIterator>
|
#include <QtScript/QScriptValueIterator>
|
||||||
|
|
||||||
using namespace Debugger;
|
|
||||||
using namespace Debugger::Internal;
|
|
||||||
using namespace Debugger::Constants;
|
|
||||||
|
|
||||||
//#define DEBUG_SCRIPT 1
|
//#define DEBUG_SCRIPT 1
|
||||||
#if DEBUG_SCRIPT
|
#if DEBUG_SCRIPT
|
||||||
# define SDEBUG(s) qDebug() << s
|
# define SDEBUG(s) qDebug() << s
|
||||||
@@ -77,13 +73,17 @@ using namespace Debugger::Constants;
|
|||||||
#endif
|
#endif
|
||||||
# define XSDEBUG(s) qDebug() << s
|
# define XSDEBUG(s) qDebug() << s
|
||||||
|
|
||||||
|
|
||||||
|
namespace Debugger {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// ScriptEngine
|
// ScriptEngine
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class Debugger::Internal::ScriptAgent : public QScriptEngineAgent
|
class ScriptAgent : public QScriptEngineAgent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScriptAgent(ScriptEngine *debugger, QScriptEngine *script);
|
ScriptAgent(ScriptEngine *debugger, QScriptEngine *script);
|
||||||
@@ -733,8 +733,10 @@ void ScriptEngine::updateSubItem(const WatchData &data0)
|
|||||||
QTC_ASSERT(false, return);
|
QTC_ASSERT(false, return);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDebuggerEngine *createScriptEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *)
|
IDebuggerEngine *createScriptEngine(DebuggerManager *parent)
|
||||||
{
|
{
|
||||||
return new ScriptEngine(parent);
|
return new ScriptEngine(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Debugger
|
||||||
|
|||||||
@@ -57,11 +57,6 @@
|
|||||||
|
|
||||||
#include <QtNetwork/QTcpSocket>
|
#include <QtNetwork/QTcpSocket>
|
||||||
|
|
||||||
|
|
||||||
using namespace Debugger;
|
|
||||||
using namespace Debugger::Internal;
|
|
||||||
using namespace Debugger::Constants;
|
|
||||||
|
|
||||||
#define DEBUG_TCF 1
|
#define DEBUG_TCF 1
|
||||||
#if DEBUG_TCF
|
#if DEBUG_TCF
|
||||||
# define SDEBUG(s) qDebug() << s
|
# define SDEBUG(s) qDebug() << s
|
||||||
@@ -74,7 +69,9 @@ using namespace Debugger::Constants;
|
|||||||
#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
|
#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
|
||||||
#define CB(callback) &TcfEngine::callback, STRINGIFY(callback)
|
#define CB(callback) &TcfEngine::callback, STRINGIFY(callback)
|
||||||
|
|
||||||
QByteArray C(const QByteArray &ba1,
|
//#define USE_CONGESTION_CONTROL
|
||||||
|
|
||||||
|
static QByteArray C(const QByteArray &ba1,
|
||||||
const QByteArray &ba2 = QByteArray(),
|
const QByteArray &ba2 = QByteArray(),
|
||||||
const QByteArray &ba3 = QByteArray(),
|
const QByteArray &ba3 = QByteArray(),
|
||||||
const QByteArray &ba4 = QByteArray(),
|
const QByteArray &ba4 = QByteArray(),
|
||||||
@@ -88,9 +85,8 @@ QByteArray C(const QByteArray &ba1,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Debugger {
|
||||||
//#define USE_CONGESTION_CONTROL
|
namespace Internal {
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -571,8 +567,10 @@ void TcfEngine::updateSubItem(const WatchData &data0)
|
|||||||
QTC_ASSERT(false, return);
|
QTC_ASSERT(false, return);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDebuggerEngine *createTcfEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *)
|
IDebuggerEngine *createTcfEngine(DebuggerManager *parent)
|
||||||
{
|
{
|
||||||
return new TcfEngine(parent);
|
return new TcfEngine(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Debugger
|
||||||
|
|||||||
Reference in New Issue
Block a user