Commit f7b19f81 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Debugger: Move DebuggerEngine/QmlEngine/QmlCppEngine into Debugger{}

namespace (from Debugger::Internal) as they are exported classes.
Introduce private classes to avoid exposing private JS debugger
headers.
parent 6dec1c6f
......@@ -56,7 +56,7 @@ static DebuggerPlugin *plugin() { return DebuggerPlugin::instance(); }
//
//////////////////////////////////////////////////////////////////
BreakHandler::BreakHandler(DebuggerEngine *engine)
BreakHandler::BreakHandler(Debugger::DebuggerEngine *engine)
: m_breakpointIcon(_(":/debugger/images/breakpoint_16.png")),
m_disabledBreakpointIcon(_(":/debugger/images/breakpoint_disabled_16.png")),
m_pendingBreakPointIcon(_(":/debugger/images/breakpoint_pending_16.png")),
......
......@@ -37,12 +37,12 @@
#include <QtGui/QIcon>
namespace Debugger {
namespace Internal {
class DebuggerEngine;
namespace Internal {
//////////////////////////////////////////////////////////////////
//
// BreakHandler
......@@ -125,7 +125,7 @@ private:
const QIcon m_emptyIcon;
const QIcon m_watchpointIcon;
DebuggerEngine *m_engine; // Not owned.
Debugger::DebuggerEngine *m_engine; // Not owned.
Breakpoints m_bp;
Breakpoints m_inserted; // Lately inserted breakpoints.
Breakpoints m_removed; // Lately removed breakpoints.
......
......@@ -79,14 +79,14 @@ namespace Internal {
namespace { const int DataRange = 1024 * 1024; }
MemoryViewAgent::MemoryViewAgent(DebuggerEngine *engine, quint64 addr)
MemoryViewAgent::MemoryViewAgent(Debugger::DebuggerEngine *engine, quint64 addr)
: QObject(engine), m_engine(engine)
{
QTC_ASSERT(engine, /**/);
createBinEditor(addr);
}
MemoryViewAgent::MemoryViewAgent(DebuggerEngine *engine, const QString &addr)
MemoryViewAgent::MemoryViewAgent(Debugger::DebuggerEngine *engine, const QString &addr)
: QObject(engine), m_engine(engine)
{
QTC_ASSERT(engine, /**/);
......
......@@ -38,9 +38,11 @@ class IEditor;
}
namespace Debugger {
namespace Internal {
class DebuggerEngine;
namespace Internal {
class StackFrame;
class MemoryViewAgent : public QObject
......@@ -49,8 +51,8 @@ class MemoryViewAgent : public QObject
public:
// Called from Gui
explicit MemoryViewAgent(DebuggerEngine *engine, quint64 startaddr);
explicit MemoryViewAgent(DebuggerEngine *engine, const QString &startaddr);
explicit MemoryViewAgent(Debugger::DebuggerEngine *engine, quint64 startaddr);
explicit MemoryViewAgent(Debugger::DebuggerEngine *engine, const QString &startaddr);
~MemoryViewAgent();
enum { BinBlockSize = 1024 };
......@@ -67,7 +69,7 @@ private:
Q_SLOT void handleEndOfFileRequested(Core::IEditor *editor);
QList<QPointer<Core::IEditor> > m_editors;
QPointer<DebuggerEngine> m_engine;
QPointer<Debugger::DebuggerEngine> m_engine;
};
struct DisassemblerViewAgentPrivate;
......@@ -78,7 +80,7 @@ class DisassemblerViewAgent : public QObject
Q_PROPERTY(QString mimeType READ mimeType WRITE setMimeType)
public:
// Called from Gui
explicit DisassemblerViewAgent(DebuggerEngine *engine);
explicit DisassemblerViewAgent(Debugger::DebuggerEngine *engine);
~DisassemblerViewAgent();
void setFrame(const StackFrame &frame, bool tryMixed = true);
......
......@@ -152,9 +152,6 @@ QDebug operator<<(QDebug str, const DebuggerStartParameters &sp)
return str;
}
namespace Internal {
const char *DebuggerEngine::stateName(int s)
{
# define SN(x) case x: return #x;
......@@ -1562,7 +1559,160 @@ DebuggerRunControl *DebuggerEngine::runControl() const
return d->m_runControl;
}
} // namespace Internal
void DebuggerEngine::setToolTipExpression(const QPoint &, TextEditor::ITextEditor *, int)
{
}
void DebuggerEngine::updateWatchData(const Internal::WatchData &, const Internal::WatchUpdateFlags &)
{
}
bool DebuggerEngine::isSessionEngine() const
{
return false;
}
void DebuggerEngine::watchPoint(const QPoint &)
{
}
void DebuggerEngine::fetchDisassembler(Internal::DisassemblerViewAgent *)
{
}
void DebuggerEngine::activateFrame(int)
{
}
void DebuggerEngine::reloadModules()
{
}
void DebuggerEngine::examineModules()
{
}
void DebuggerEngine::loadSymbols(const QString &)
{
}
void DebuggerEngine::loadAllSymbols()
{
}
void DebuggerEngine::requestModuleSymbols(const QString &)
{
}
void DebuggerEngine::reloadRegisters()
{
}
void DebuggerEngine::reloadSourceFiles()
{
}
void DebuggerEngine::reloadFullStack()
{
}
void DebuggerEngine::addOptionPages(QList<Core::IOptionsPage*> *) const
{
}
unsigned DebuggerEngine::debuggerCapabilities() const
{
return 0;
}
bool DebuggerEngine::isSynchronous() const
{
return false;
}
QByteArray DebuggerEngine::qtNamespace() const
{
return QByteArray();
}
void DebuggerEngine::createSnapshot()
{
}
void DebuggerEngine::updateAll()
{
}
void DebuggerEngine::attemptBreakpointSynchronization()
{
}
void DebuggerEngine::selectThread(int)
{
}
void DebuggerEngine::assignValueInDebugger(const QString &, const QString &)
{
}
void DebuggerEngine::detachDebugger()
{
}
void DebuggerEngine::executeStep()
{
}
void DebuggerEngine::executeStepOut()
{
}
void DebuggerEngine::executeNext()
{
}
void DebuggerEngine::executeStepI()
{
}
void DebuggerEngine::executeNextI()
{
}
void DebuggerEngine::executeReturn()
{
}
void DebuggerEngine::continueInferior()
{
}
void DebuggerEngine::interruptInferior()
{
}
void DebuggerEngine::executeRunToLine(const QString &, int)
{
}
void DebuggerEngine::executeRunToFunction(const QString &)
{
}
void DebuggerEngine::executeJumpToLine(const QString &, int)
{
}
void DebuggerEngine::executeDebuggerCommand(const QString &)
{
}
bool DebuggerEngine::isDying() const
{
return targetState() == DebuggerFinished;
}
} // namespace Debugger
#include "debuggerengine.moc"
......@@ -58,6 +58,8 @@ namespace Debugger {
class DebuggerRunControl;
class DebuggerPlugin;
class DebuggerEnginePrivate;
class QmlCppEngine;
class DEBUGGER_EXPORT DebuggerStartParameters
{
......@@ -128,13 +130,12 @@ class SourceFilesHandler;
class ThreadsHandler;
class WatchHandler;
class DebuggerEnginePrivate;
struct WatchUpdateFlags
{
WatchUpdateFlags() : tryIncremental(false) {}
bool tryIncremental;
};
} // namespace Internal
// FIXME: DEBUGGER_EXPORT?
class DEBUGGER_EXPORT DebuggerEngine : public QObject
......@@ -142,78 +143,72 @@ class DEBUGGER_EXPORT DebuggerEngine : public QObject
Q_OBJECT
public:
DebuggerEngine(const DebuggerStartParameters &sp);
explicit DebuggerEngine(const DebuggerStartParameters &sp);
virtual ~DebuggerEngine();
virtual void setToolTipExpression(const QPoint & /* mousePos */,
TextEditor::ITextEditor * /* editor */, int /* cursorPos */) {}
virtual void setToolTipExpression(const QPoint & mousePos,
TextEditor::ITextEditor * editor, int cursorPos);
void initializeFromTemplate(DebuggerEngine *other);
virtual void updateWatchData(const WatchData & /* data */,
const WatchUpdateFlags & /* flags */ = WatchUpdateFlags()) {}
virtual void updateWatchData(const Internal::WatchData &data,
const Internal::WatchUpdateFlags & flags = Internal::WatchUpdateFlags());
void startDebugger(DebuggerRunControl *runControl);
virtual bool isSessionEngine() const { return false; }
virtual void watchPoint(const QPoint &) {}
virtual void fetchMemory(MemoryViewAgent *, QObject *,
quint64 addr, quint64 length);
virtual void fetchDisassembler(DisassemblerViewAgent *) {}
virtual void activateFrame(int index) { Q_UNUSED(index); }
virtual void reloadModules() {}
virtual void examineModules() {}
virtual void loadSymbols(const QString &moduleName)
{ Q_UNUSED(moduleName); }
virtual void loadAllSymbols() {}
virtual void requestModuleSymbols(const QString &moduleName)
{ Q_UNUSED(moduleName); }
virtual void reloadRegisters() {}
virtual void reloadSourceFiles() {}
virtual void reloadFullStack() {}
virtual bool isSessionEngine() const;
virtual void watchPoint(const QPoint &);
virtual void fetchMemory(Internal::MemoryViewAgent *, QObject *,
quint64 addr, quint64 length);
virtual void fetchDisassembler(Internal::DisassemblerViewAgent *);
virtual void activateFrame(int index);
virtual void reloadModules();
virtual void examineModules();
virtual void loadSymbols(const QString &moduleName);
virtual void loadAllSymbols();
virtual void requestModuleSymbols(const QString &moduleName);
virtual void reloadRegisters();
virtual void reloadSourceFiles();
virtual void reloadFullStack();
virtual void setRegisterValue(int regnr, const QString &value);
virtual void addOptionPages(QList<Core::IOptionsPage*> *) const {}
virtual unsigned debuggerCapabilities() const { return 0; }
virtual void addOptionPages(QList<Core::IOptionsPage*> *) const;
virtual unsigned debuggerCapabilities() const;
virtual bool isSynchronous() const { return false; }
virtual QByteArray qtNamespace() const { return QByteArray(); }
virtual bool isSynchronous() const;
virtual QByteArray qtNamespace() const;
virtual void createSnapshot() {}
virtual void updateAll() {}
virtual void createSnapshot();
virtual void updateAll();
virtual void attemptBreakpointSynchronization() {}
virtual void selectThread(int index) { Q_UNUSED(index); }
virtual void attemptBreakpointSynchronization();
virtual void selectThread(int index);
virtual void assignValueInDebugger(const QString &expr, const QString &value)
{ Q_UNUSED(expr); Q_UNUSED(value); }
virtual void assignValueInDebugger(const QString &expr, const QString &value);
// Convenience
static QMessageBox *showMessageBox
(int icon, const QString &title, const QString &text, int buttons = 0);
protected:
virtual void detachDebugger() {}
virtual void executeStep() {}
virtual void executeStepOut() {}
virtual void executeNext() {}
virtual void executeStepI() {}
virtual void executeNextI() {}
virtual void executeReturn() {}
virtual void detachDebugger();
virtual void executeStep();
virtual void executeStepOut() ;
virtual void executeNext();
virtual void executeStepI();
virtual void executeNextI();
virtual void executeReturn();
virtual void continueInferior() {}
virtual void interruptInferior() {}
virtual void continueInferior();
virtual void interruptInferior();
virtual void requestInterruptInferior();
virtual void executeRunToLine(const QString &fileName, int lineNumber)
{ Q_UNUSED(fileName); Q_UNUSED(lineNumber); }
virtual void executeRunToFunction(const QString &functionName)
{ Q_UNUSED(functionName); }
virtual void executeJumpToLine(const QString &fileName, int lineNumber)
{ Q_UNUSED(fileName); Q_UNUSED(lineNumber); }
virtual void executeDebuggerCommand(const QString &command)
{ Q_UNUSED(command); }
virtual void executeRunToLine(const QString &fileName, int lineNumber);
virtual void executeRunToFunction(const QString &functionName);
virtual void executeJumpToLine(const QString &fileName, int lineNumber);
virtual void executeDebuggerCommand(const QString &command);
virtual void frameUp();
virtual void frameDown();
......@@ -223,13 +218,13 @@ public:
const DebuggerStartParameters &startParameters() const;
DebuggerStartParameters &startParameters();
ModulesHandler *modulesHandler() const;
BreakHandler *breakHandler() const;
RegisterHandler *registerHandler() const;
StackHandler *stackHandler() const;
ThreadsHandler *threadsHandler() const;
WatchHandler *watchHandler() const;
SourceFilesHandler *sourceFilesHandler() const;
Internal::ModulesHandler *modulesHandler() const;
Internal::BreakHandler *breakHandler() const;
Internal::RegisterHandler *registerHandler() const;
Internal::StackHandler *stackHandler() const;
Internal::ThreadsHandler *threadsHandler() const;
Internal::WatchHandler *watchHandler() const;
Internal::SourceFilesHandler *sourceFilesHandler() const;
virtual QAbstractItemModel *commandModel() const;
virtual QAbstractItemModel *modulesModel() const;
......@@ -248,7 +243,7 @@ public:
void handleStartFailed();
bool debuggerActionsEnabled() const;
static bool debuggerActionsEnabled(DebuggerState state);
void showModuleSymbols(const QString &moduleName, const Symbols &symbols);
void showModuleSymbols(const QString &moduleName, const Internal::Symbols &symbols);
void breakByFunction(const QString &functionName);
void breakByFunctionMain();
......@@ -261,7 +256,7 @@ public:
DebuggerState state() const;
DebuggerState lastGoodState() const;
DebuggerState targetState() const;
bool isDying() const { return targetState() == DebuggerFinished; }
bool isDying() const;
// Dumper stuff (common to cdb and gdb).
bool qtDumperLibraryEnabled() const;
......@@ -285,7 +280,7 @@ public:
void resetLocation();
void openFile(const QString &fileName, int lineNumber = -1);
virtual void gotoLocation(const QString &fileName, int lineNumber, bool setMarker);
virtual void gotoLocation(const StackFrame &frame, bool setMarker);
virtual void gotoLocation(const Internal::StackFrame &frame, bool setMarker);
virtual void quitDebugger(); // called by DebuggerRunControl
signals:
......@@ -353,7 +348,6 @@ private:
DebuggerEnginePrivate *d;
};
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGER_DEBUGGERENGINE_H
......@@ -50,13 +50,12 @@ class RunControl;
}
namespace Debugger {
class DebuggerEngine;
class DebuggerPluginPrivate;
class DebuggerRunControl;
class DebuggerStartParameters;
namespace Internal {
class DebuggerEngine;
class DebuggerListener;
}
......@@ -74,13 +73,13 @@ public:
ProjectExplorer::RunConfiguration *rc = 0);
static void startDebugger(ProjectExplorer::RunControl *runControl);
static void displayDebugger(ProjectExplorer::RunControl *runControl);
static void displayDebugger(Internal::DebuggerEngine *engine, bool updateEngine = true);
static void displayDebugger(DebuggerEngine *engine, bool updateEngine = true);
QVariant sessionValue(const QString &name);
void setSessionValue(const QString &name, const QVariant &value);
QVariant configValue(const QString &name) const;
void setConfigValue(const QString &name, const QVariant &value);
void updateState(Internal::DebuggerEngine *engine);
void updateState(DebuggerEngine *engine);
QIcon locationMarkIcon() const;
void activateDebugMode();
......@@ -99,7 +98,7 @@ public slots:
void showMessage(const QString &msg, int channel, int timeout = -1);
private:
friend class Internal::DebuggerEngine;
friend class DebuggerEngine;
friend class DebuggerPluginPrivate;
friend class DebuggerRunControl;
......@@ -116,7 +115,7 @@ private:
// This contains per-session data like breakpoints and watched
// expression. It serves as a template for new engine instantiations.
Internal::DebuggerEngine *sessionTemplate();
DebuggerEngine *sessionTemplate();
QMessageBox *showMessageBox(int icon, const QString &title,
const QString &text, int buttons = 0);
......
......@@ -404,22 +404,22 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams
initGdbEngine(qobject_cast<Internal::GdbEngine *>(m_engine));
break;
case ScriptEngineType:
m_engine = createScriptEngine(sp);
m_engine = Internal::createScriptEngine(sp);
break;
case CdbEngineType:
m_engine = createCdbEngine(sp);
m_engine = Internal::createCdbEngine(sp);
break;
case PdbEngineType:
m_engine = createPdbEngine(sp);
m_engine = Internal::createPdbEngine(sp);
break;
case TcfEngineType:
m_engine = createTcfEngine(sp);
m_engine = Internal::createTcfEngine(sp);
break;
case QmlEngineType:
m_engine = createQmlEngine(sp);
m_engine = Internal::createQmlEngine(sp);
break;
case QmlCppEngineType:
m_engine = createQmlCppEngine(sp);
m_engine = Internal::createQmlCppEngine(sp);
if (Internal::GdbEngine *embeddedGdbEngine = gdbEngine())
initGdbEngine(embeddedGdbEngine);
break;
......@@ -608,7 +608,7 @@ DebuggerState DebuggerRunControl::state() const
return m_engine->state();
}
Internal::DebuggerEngine *DebuggerRunControl::engine()
DebuggerEngine *DebuggerRunControl::engine()
{
QTC_ASSERT(m_engine, /**/);
return m_engine;
......@@ -620,7 +620,7 @@ Internal::GdbEngine *DebuggerRunControl::gdbEngine() const
if (GdbEngine *gdbEngine = qobject_cast<GdbEngine *>(m_engine))
return gdbEngine;
if (QmlCppEngine * const qmlEngine = qobject_cast<QmlCppEngine *>(m_engine))
if (GdbEngine *embeddedGdbEngine = qobject_cast<GdbEngine *>(qmlEngine->cppEngine()))
if (Internal::GdbEngine *embeddedGdbEngine = qobject_cast<GdbEngine *>(qmlEngine->cppEngine()))
return embeddedGdbEngine;
return 0;
}
......@@ -657,4 +657,14 @@ void DebuggerRunControl::remoteGdbHandleSetupFailed(const QString &message)
QTC_ASSERT(false, /* */ );
}
}
void DebuggerRunControl::emitAddToOutputWindow(const QString &line, bool onStdErr)
{
emit addToOutputWindow(this, line, onStdErr);
}
void DebuggerRunControl::emitAppendMessage(const QString &m, bool isError)
{
emit appendMessage(this, m, isError);
}
} // namespace Debugger
......@@ -39,15 +39,13 @@ namespace ProjectExplorer {
class Environment;
}
namespace Debugger {
class DebuggerEngine;
class DebuggerRunControl;
class QmlEngine;
class DebuggerStartParameters;
namespace Internal {
class DebuggerEngine;
class QmlEngine;
class GdbEngine;
class AbstractGdbAdapter;
}
......@@ -111,7 +109,7 @@ public:
RunConfiguration *runConfiguration() const { return m_myRunConfiguration.data(); }
DebuggerState state() const;
Internal::DebuggerEngine *engine();
DebuggerEngine *engine();