Commit f7b19f81 authored by Friedemann Kleint's avatar Friedemann Kleint

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(); } ...@@ -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_breakpointIcon(_(":/debugger/images/breakpoint_16.png")),
m_disabledBreakpointIcon(_(":/debugger/images/breakpoint_disabled_16.png")), m_disabledBreakpointIcon(_(":/debugger/images/breakpoint_disabled_16.png")),
m_pendingBreakPointIcon(_(":/debugger/images/breakpoint_pending_16.png")), m_pendingBreakPointIcon(_(":/debugger/images/breakpoint_pending_16.png")),
......
...@@ -37,12 +37,12 @@ ...@@ -37,12 +37,12 @@
#include <QtGui/QIcon> #include <QtGui/QIcon>
namespace Debugger { namespace Debugger {
namespace Internal {
class DebuggerEngine; class DebuggerEngine;
namespace Internal {
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// //
// BreakHandler // BreakHandler
...@@ -125,7 +125,7 @@ private: ...@@ -125,7 +125,7 @@ private:
const QIcon m_emptyIcon; const QIcon m_emptyIcon;
const QIcon m_watchpointIcon; const QIcon m_watchpointIcon;
DebuggerEngine *m_engine; // Not owned. Debugger::DebuggerEngine *m_engine; // Not owned.
Breakpoints m_bp; Breakpoints m_bp;
Breakpoints m_inserted; // Lately inserted breakpoints. Breakpoints m_inserted; // Lately inserted breakpoints.
Breakpoints m_removed; // Lately removed breakpoints. Breakpoints m_removed; // Lately removed breakpoints.
......
...@@ -79,14 +79,14 @@ namespace Internal { ...@@ -79,14 +79,14 @@ namespace Internal {
namespace { const int DataRange = 1024 * 1024; } namespace { const int DataRange = 1024 * 1024; }
MemoryViewAgent::MemoryViewAgent(DebuggerEngine *engine, quint64 addr) MemoryViewAgent::MemoryViewAgent(Debugger::DebuggerEngine *engine, quint64 addr)
: QObject(engine), m_engine(engine) : QObject(engine), m_engine(engine)
{ {
QTC_ASSERT(engine, /**/); QTC_ASSERT(engine, /**/);
createBinEditor(addr); createBinEditor(addr);
} }
MemoryViewAgent::MemoryViewAgent(DebuggerEngine *engine, const QString &addr) MemoryViewAgent::MemoryViewAgent(Debugger::DebuggerEngine *engine, const QString &addr)
: QObject(engine), m_engine(engine) : QObject(engine), m_engine(engine)
{ {
QTC_ASSERT(engine, /**/); QTC_ASSERT(engine, /**/);
......
...@@ -38,9 +38,11 @@ class IEditor; ...@@ -38,9 +38,11 @@ class IEditor;
} }
namespace Debugger { namespace Debugger {
namespace Internal {
class DebuggerEngine; class DebuggerEngine;
namespace Internal {
class StackFrame; class StackFrame;
class MemoryViewAgent : public QObject class MemoryViewAgent : public QObject
...@@ -49,8 +51,8 @@ class MemoryViewAgent : public QObject ...@@ -49,8 +51,8 @@ class MemoryViewAgent : public QObject
public: public:
// Called from Gui // Called from Gui
explicit MemoryViewAgent(DebuggerEngine *engine, quint64 startaddr); explicit MemoryViewAgent(Debugger::DebuggerEngine *engine, quint64 startaddr);
explicit MemoryViewAgent(DebuggerEngine *engine, const QString &startaddr); explicit MemoryViewAgent(Debugger::DebuggerEngine *engine, const QString &startaddr);
~MemoryViewAgent(); ~MemoryViewAgent();
enum { BinBlockSize = 1024 }; enum { BinBlockSize = 1024 };
...@@ -67,7 +69,7 @@ private: ...@@ -67,7 +69,7 @@ private:
Q_SLOT void handleEndOfFileRequested(Core::IEditor *editor); Q_SLOT void handleEndOfFileRequested(Core::IEditor *editor);
QList<QPointer<Core::IEditor> > m_editors; QList<QPointer<Core::IEditor> > m_editors;
QPointer<DebuggerEngine> m_engine; QPointer<Debugger::DebuggerEngine> m_engine;
}; };
struct DisassemblerViewAgentPrivate; struct DisassemblerViewAgentPrivate;
...@@ -78,7 +80,7 @@ class DisassemblerViewAgent : public QObject ...@@ -78,7 +80,7 @@ class DisassemblerViewAgent : public QObject
Q_PROPERTY(QString mimeType READ mimeType WRITE setMimeType) Q_PROPERTY(QString mimeType READ mimeType WRITE setMimeType)
public: public:
// Called from Gui // Called from Gui
explicit DisassemblerViewAgent(DebuggerEngine *engine); explicit DisassemblerViewAgent(Debugger::DebuggerEngine *engine);
~DisassemblerViewAgent(); ~DisassemblerViewAgent();
void setFrame(const StackFrame &frame, bool tryMixed = true); void setFrame(const StackFrame &frame, bool tryMixed = true);
......
...@@ -152,9 +152,6 @@ QDebug operator<<(QDebug str, const DebuggerStartParameters &sp) ...@@ -152,9 +152,6 @@ QDebug operator<<(QDebug str, const DebuggerStartParameters &sp)
return str; return str;
} }
namespace Internal {
const char *DebuggerEngine::stateName(int s) const char *DebuggerEngine::stateName(int s)
{ {
# define SN(x) case x: return #x; # define SN(x) case x: return #x;
...@@ -1562,7 +1559,160 @@ DebuggerRunControl *DebuggerEngine::runControl() const ...@@ -1562,7 +1559,160 @@ DebuggerRunControl *DebuggerEngine::runControl() const
return d->m_runControl; 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 } // namespace Debugger
#include "debuggerengine.moc" #include "debuggerengine.moc"
...@@ -58,6 +58,8 @@ namespace Debugger { ...@@ -58,6 +58,8 @@ namespace Debugger {
class DebuggerRunControl; class DebuggerRunControl;
class DebuggerPlugin; class DebuggerPlugin;
class DebuggerEnginePrivate;
class QmlCppEngine;
class DEBUGGER_EXPORT DebuggerStartParameters class DEBUGGER_EXPORT DebuggerStartParameters
{ {
...@@ -128,13 +130,12 @@ class SourceFilesHandler; ...@@ -128,13 +130,12 @@ class SourceFilesHandler;
class ThreadsHandler; class ThreadsHandler;
class WatchHandler; class WatchHandler;
class DebuggerEnginePrivate;
struct WatchUpdateFlags struct WatchUpdateFlags
{ {
WatchUpdateFlags() : tryIncremental(false) {} WatchUpdateFlags() : tryIncremental(false) {}
bool tryIncremental; bool tryIncremental;
}; };
} // namespace Internal
// FIXME: DEBUGGER_EXPORT? // FIXME: DEBUGGER_EXPORT?
class DEBUGGER_EXPORT DebuggerEngine : public QObject class DEBUGGER_EXPORT DebuggerEngine : public QObject
...@@ -142,78 +143,72 @@ class DEBUGGER_EXPORT DebuggerEngine : public QObject ...@@ -142,78 +143,72 @@ class DEBUGGER_EXPORT DebuggerEngine : public QObject
Q_OBJECT Q_OBJECT
public: public:
DebuggerEngine(const DebuggerStartParameters &sp); explicit DebuggerEngine(const DebuggerStartParameters &sp);
virtual ~DebuggerEngine(); virtual ~DebuggerEngine();
virtual void setToolTipExpression(const QPoint & /* mousePos */, virtual void setToolTipExpression(const QPoint & mousePos,
TextEditor::ITextEditor * /* editor */, int /* cursorPos */) {} TextEditor::ITextEditor * editor, int cursorPos);
void initializeFromTemplate(DebuggerEngine *other); void initializeFromTemplate(DebuggerEngine *other);
virtual void updateWatchData(const WatchData & /* data */, virtual void updateWatchData(const Internal::WatchData &data,
const WatchUpdateFlags & /* flags */ = WatchUpdateFlags()) {} const Internal::WatchUpdateFlags & flags = Internal::WatchUpdateFlags());
void startDebugger(DebuggerRunControl *runControl); void startDebugger(DebuggerRunControl *runControl);
virtual bool isSessionEngine() const { return false; } virtual bool isSessionEngine() const;
virtual void watchPoint(const QPoint &) {} virtual void watchPoint(const QPoint &);
virtual void fetchMemory(MemoryViewAgent *, QObject *, virtual void fetchMemory(Internal::MemoryViewAgent *, QObject *,
quint64 addr, quint64 length); quint64 addr, quint64 length);
virtual void fetchDisassembler(DisassemblerViewAgent *) {} virtual void fetchDisassembler(Internal::DisassemblerViewAgent *);
virtual void activateFrame(int index) { Q_UNUSED(index); } virtual void activateFrame(int index);
virtual void reloadModules() {} virtual void reloadModules();
virtual void examineModules() {} virtual void examineModules();
virtual void loadSymbols(const QString &moduleName) virtual void loadSymbols(const QString &moduleName);
{ Q_UNUSED(moduleName); } virtual void loadAllSymbols();
virtual void loadAllSymbols() {} virtual void requestModuleSymbols(const QString &moduleName);
virtual void requestModuleSymbols(const QString &moduleName)
{ Q_UNUSED(moduleName); } virtual void reloadRegisters();
virtual void reloadSourceFiles();
virtual void reloadRegisters() {} virtual void reloadFullStack();
virtual void reloadSourceFiles() {}
virtual void reloadFullStack() {}
virtual void setRegisterValue(int regnr, const QString &value); virtual void setRegisterValue(int regnr, const QString &value);
virtual void addOptionPages(QList<Core::IOptionsPage*> *) const {} virtual void addOptionPages(QList<Core::IOptionsPage*> *) const;
virtual unsigned debuggerCapabilities() const { return 0; } virtual unsigned debuggerCapabilities() const;
virtual bool isSynchronous() const { return false; } virtual bool isSynchronous() const;
virtual QByteArray qtNamespace() const { return QByteArray(); } virtual QByteArray qtNamespace() const;
virtual void createSnapshot() {} virtual void createSnapshot();
virtual void updateAll() {} virtual void updateAll();
virtual void attemptBreakpointSynchronization() {} virtual void attemptBreakpointSynchronization();
virtual void selectThread(int index) { Q_UNUSED(index); } virtual void selectThread(int index);
virtual void assignValueInDebugger(const QString &expr, const QString &value) virtual void assignValueInDebugger(const QString &expr, const QString &value);
{ Q_UNUSED(expr); Q_UNUSED(value); }
// Convenience // Convenience
static QMessageBox *showMessageBox static QMessageBox *showMessageBox
(int icon, const QString &title, const QString &text, int buttons = 0); (int icon, const QString &title, const QString &text, int buttons = 0);
protected: protected:
virtual void detachDebugger() {} virtual void detachDebugger();
virtual void executeStep() {} virtual void executeStep();
virtual void executeStepOut() {} virtual void executeStepOut() ;
virtual void executeNext() {} virtual void executeNext();
virtual void executeStepI() {} virtual void executeStepI();
virtual void executeNextI() {} virtual void executeNextI();
virtual void executeReturn() {} virtual void executeReturn();
virtual void continueInferior() {} virtual void continueInferior();
virtual void interruptInferior() {} virtual void interruptInferior();
virtual void requestInterruptInferior(); virtual void requestInterruptInferior();
virtual void executeRunToLine(const QString &fileName, int lineNumber) virtual void executeRunToLine(const QString &fileName, int lineNumber);
{ Q_UNUSED(fileName); Q_UNUSED(lineNumber); }
virtual void executeRunToFunction(const QString &functionName) virtual void executeRunToFunction(const QString &functionName);
{ Q_UNUSED(functionName); } virtual void executeJumpToLine(const QString &fileName, int lineNumber);
virtual void executeJumpToLine(const QString &fileName, int lineNumber) virtual void executeDebuggerCommand(const QString &command);
{ Q_UNUSED(fileName); Q_UNUSED(lineNumber); }
virtual void executeDebuggerCommand(const QString &command)
{ Q_UNUSED(command); }
virtual void frameUp(); virtual void frameUp();
virtual void frameDown(); virtual void frameDown();
...@@ -223,13 +218,13 @@ public: ...@@ -223,13 +218,13 @@ public:
const DebuggerStartParameters &startParameters() const; const DebuggerStartParameters &startParameters() const;
DebuggerStartParameters &startParameters(); DebuggerStartParameters &startParameters();
ModulesHandler *modulesHandler() const; Internal::ModulesHandler *modulesHandler() const;
BreakHandler *breakHandler() const; Internal::BreakHandler *breakHandler() const;
RegisterHandler *registerHandler() const; Internal::RegisterHandler *registerHandler() const;
StackHandler *stackHandler() const; Internal::StackHandler *stackHandler() const;
ThreadsHandler *threadsHandler() const; Internal::ThreadsHandler *threadsHandler() const;
WatchHandler *watchHandler() const; Internal::WatchHandler *watchHandler() const;
SourceFilesHandler *sourceFilesHandler() const; Internal::SourceFilesHandler *sourceFilesHandler() const;
virtual QAbstractItemModel *commandModel() const; virtual QAbstractItemModel *commandModel() const;
virtual QAbstractItemModel *modulesModel() const; virtual QAbstractItemModel *modulesModel() const;
...@@ -248,7 +243,7 @@ public: ...@@ -248,7 +243,7 @@ public:
void handleStartFailed(); void handleStartFailed();
bool debuggerActionsEnabled() const; bool debuggerActionsEnabled() const;
static bool debuggerActionsEnabled(DebuggerState state); 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 breakByFunction(const QString &functionName);
void breakByFunctionMain(); void breakByFunctionMain();
...@@ -261,7 +256,7 @@ public: ...@@ -261,7 +256,7 @@ public:
DebuggerState state() const; DebuggerState state() const;
DebuggerState lastGoodState() const; DebuggerState lastGoodState() const;
DebuggerState targetState() const; DebuggerState targetState() const;
bool isDying() const { return targetState() == DebuggerFinished; } bool isDying() const;
// Dumper stuff (common to cdb and gdb). // Dumper stuff (common to cdb and gdb).
bool qtDumperLibraryEnabled() const; bool qtDumperLibraryEnabled() const;
...@@ -285,7 +280,7 @@ public: ...@@ -285,7 +280,7 @@ public:
void resetLocation(); void resetLocation();
void openFile(const QString &fileName, int lineNumber = -1); void openFile(const QString &fileName, int lineNumber = -1);
virtual void gotoLocation(const QString &fileName, int lineNumber, bool setMarker); 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 virtual void quitDebugger(); // called by DebuggerRunControl
signals: signals:
...@@ -353,7 +348,6 @@ private: ...@@ -353,7 +348,6 @@ private:
DebuggerEnginePrivate *d; DebuggerEnginePrivate *d;
}; };
} // namespace Internal
} // namespace Debugger } // namespace Debugger
#endif // DEBUGGER_DEBUGGERENGINE_H #endif // DEBUGGER_DEBUGGERENGINE_H
...@@ -50,13 +50,12 @@ class RunControl; ...@@ -50,13 +50,12 @@ class RunControl;
} }
namespace Debugger { namespace Debugger {
class DebuggerEngine;
class DebuggerPluginPrivate; class DebuggerPluginPrivate;
class DebuggerRunControl; class DebuggerRunControl;
class DebuggerStartParameters; class DebuggerStartParameters;
namespace Internal { namespace Internal {
class DebuggerEngine;
class DebuggerListener; class DebuggerListener;
} }
...@@ -74,13 +73,13 @@ public: ...@@ -74,13 +73,13 @@ public:
ProjectExplorer::RunConfiguration *rc = 0); ProjectExplorer::RunConfiguration *rc = 0);
static void startDebugger(ProjectExplorer::RunControl *runControl); static void startDebugger(ProjectExplorer::RunControl *runControl);
static void displayDebugger(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); QVariant sessionValue(const QString &name);
void setSessionValue(const QString &name, const QVariant &value); void setSessionValue(const QString &name, const QVariant &value);
QVariant configValue(const QString &name) const; QVariant configValue(const QString &name) const;
void setConfigValue(const QString &name, const QVariant &value); void setConfigValue(const QString &name, const QVariant &value);
void updateState(Internal::DebuggerEngine *engine); void updateState(DebuggerEngine *engine);
QIcon locationMarkIcon() const; QIcon locationMarkIcon() const;
void activateDebugMode(); void activateDebugMode();
...@@ -99,7 +98,7 @@ public slots: ...@@ -99,7 +98,7 @@ public slots:
void showMessage(const QString &msg, int channel, int timeout = -1); void showMessage(const QString &msg, int channel, int timeout = -1);