debugger: refactoring of the plugin interface

There's  some 'external' and some 'internal' part now. Other plugins
are only supposed the external interface.
This commit is contained in:
hjk
2010-11-10 11:39:01 +01:00
parent 60bafeb81d
commit 2161e0f6d9
29 changed files with 480 additions and 590 deletions
+8 -10
View File
@@ -31,7 +31,7 @@
#include "breakpointmarker.h" #include "breakpointmarker.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggerplugin.h" #include "debuggercore.h"
#include "debuggerstringutils.h" #include "debuggerstringutils.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -40,17 +40,15 @@
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
namespace Debugger {
namespace Internal {
static DebuggerPlugin *plugin() { return DebuggerPlugin::instance(); }
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// //
// BreakHandler // BreakHandler
// //
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
namespace Debugger {
namespace Internal {
BreakHandler::BreakHandler() BreakHandler::BreakHandler()
: 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")),
@@ -148,7 +146,7 @@ bool BreakHandler::watchPointAt(quint64 address) const
void BreakHandler::saveBreakpoints() void BreakHandler::saveBreakpoints()
{ {
//qDebug() << "SAVING BREAKPOINTS..."; //qDebug() << "SAVING BREAKPOINTS...";
QTC_ASSERT(plugin(), return); QTC_ASSERT(debuggerCore(), return);
QList<QVariant> list; QList<QVariant> list;
for (int index = 0; index != size(); ++index) { for (int index = 0; index != size(); ++index) {
const BreakpointData *data = at(index); const BreakpointData *data = at(index);
@@ -178,15 +176,15 @@ void BreakHandler::saveBreakpoints()
map.insert(_("usefullpath"), _("1")); map.insert(_("usefullpath"), _("1"));
list.append(map); list.append(map);
} }
plugin()->setSessionValue("Breakpoints", list); debuggerCore()->setSessionValue("Breakpoints", list);
//qDebug() << "SAVED BREAKPOINTS" << this << list.size(); //qDebug() << "SAVED BREAKPOINTS" << this << list.size();
} }
void BreakHandler::loadBreakpoints() void BreakHandler::loadBreakpoints()
{ {
QTC_ASSERT(plugin(), return); QTC_ASSERT(debuggerCore(), return);
//qDebug() << "LOADING BREAKPOINTS..."; //qDebug() << "LOADING BREAKPOINTS...";
QVariant value = plugin()->sessionValue("Breakpoints"); QVariant value = debuggerCore()->sessionValue("Breakpoints");
QList<QVariant> list = value.toList(); QList<QVariant> list = value.toList();
clear(); clear();
foreach (const QVariant &var, list) { foreach (const QVariant &var, list) {
+6 -12
View File
@@ -31,8 +31,7 @@
#include "breakhandler.h" #include "breakhandler.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggerplugin.h" #include "debuggercore.h"
#include "debuggerconstants.h"
#include "ui_breakpoint.h" #include "ui_breakpoint.h"
#include "ui_breakcondition.h" #include "ui_breakcondition.h"
@@ -44,26 +43,21 @@
#include <QtGui/QAction> #include <QtGui/QAction>
#include <QtGui/QHeaderView> #include <QtGui/QHeaderView>
#include <QtGui/QIntValidator>
#include <QtGui/QItemSelectionModel>
#include <QtGui/QKeyEvent> #include <QtGui/QKeyEvent>
#include <QtGui/QMenu> #include <QtGui/QMenu>
#include <QtGui/QResizeEvent> #include <QtGui/QResizeEvent>
#include <QtGui/QItemSelectionModel>
#include <QtGui/QToolButton> #include <QtGui/QToolButton>
#include <QtGui/QTreeView> #include <QtGui/QTreeView>
#include <QtGui/QIntValidator>
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
static DebuggerPlugin *plugin()
{
return DebuggerPlugin::instance();
}
static BreakHandler *breakHandler() static BreakHandler *breakHandler()
{ {
return plugin()->breakHandler(); return debuggerCore()->breakHandler();
} }
static BreakpointData *breakpointAt(int index) static BreakpointData *breakpointAt(int index)
@@ -323,7 +317,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *synchronizeAction = QAction *synchronizeAction =
new QAction(tr("Synchronize Breakpoints"), &menu); new QAction(tr("Synchronize Breakpoints"), &menu);
synchronizeAction->setEnabled(plugin()->hasSnapshots()); synchronizeAction->setEnabled(debuggerCore()->hasSnapshots());
QModelIndex idx0 = (si.size() ? si.front() : QModelIndex()); QModelIndex idx0 = (si.size() ? si.front() : QModelIndex());
QModelIndex idx2 = idx0.sibling(idx0.row(), 2); QModelIndex idx2 = idx0.sibling(idx0.row(), 2);
@@ -556,7 +550,7 @@ void BreakWindow::rowActivated(const QModelIndex &index)
{ {
BreakpointData *data = breakpointAt(index.row()); BreakpointData *data = breakpointAt(index.row());
QTC_ASSERT(data, return); QTC_ASSERT(data, return);
plugin()->gotoLocation(data->markerFileName(), debuggerCore()->gotoLocation(data->markerFileName(),
data->markerLineNumber(), false); data->markerLineNumber(), false);
} }
@@ -33,7 +33,7 @@
#include "cdbdumperhelper.h" #include "cdbdumperhelper.h"
#include "cdbengine_p.h" #include "cdbengine_p.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggerplugin.h" #include "debuggercore.h"
#include "watchutils.h" #include "watchutils.h"
#include "threadshandler.h" #include "threadshandler.h"
@@ -74,7 +74,8 @@ CdbStackTraceContext::createSymbolGroup(const CdbCore::ComInterfaces & /* cif */
QStringList uninitializedVariables; QStringList uninitializedVariables;
const CdbCore::StackFrame &frame = stackFrameAt(index); const CdbCore::StackFrame &frame = stackFrameAt(index);
if (theDebuggerAction(UseCodeModel)->isChecked()) if (theDebuggerAction(UseCodeModel)->isChecked())
getUninitializedVariables(DebuggerPlugin::instance()->cppCodeModelSnapshot(), frame.function, frame.fileName, frame.line, &uninitializedVariables); getUninitializedVariables(debuggerCore()->cppCodeModelSnapshot(),
frame.function, frame.fileName, frame.line, &uninitializedVariables);
if (debug) if (debug)
qDebug() << frame << uninitializedVariables; qDebug() << frame << uninitializedVariables;
CdbSymbolGroupContext *sc = CdbSymbolGroupContext::create(prefix, CdbSymbolGroupContext *sc = CdbSymbolGroupContext::create(prefix,
+1
View File
@@ -24,6 +24,7 @@ HEADERS += breakhandler.h \
debugger_global.h \ debugger_global.h \
debuggeractions.h \ debuggeractions.h \
debuggeragents.h \ debuggeragents.h \
debuggercore.h \
debuggerconstants.h \ debuggerconstants.h \
debuggerdialogs.h \ debuggerdialogs.h \
debuggerengine.h \ debuggerengine.h \
+2 -3
View File
@@ -30,10 +30,9 @@
#include "debuggeragents.h" #include "debuggeragents.h"
#include "debuggerengine.h" #include "debuggerengine.h"
#include "debuggerplugin.h" #include "debuggercore.h"
#include "debuggerstringutils.h" #include "debuggerstringutils.h"
#include "stackframe.h" #include "stackframe.h"
#include "debuggerconstants.h"
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
@@ -196,7 +195,7 @@ class LocationMark2 : public TextEditor::ITextMark
public: public:
LocationMark2() {} LocationMark2() {}
QIcon icon() const { return DebuggerPlugin::instance()->locationMarkIcon(); } QIcon icon() const { return debuggerCore()->locationMarkIcon(); }
void updateLineNumber(int /*lineNumber*/) {} void updateLineNumber(int /*lineNumber*/) {}
void updateBlock(const QTextBlock & /*block*/) {} void updateBlock(const QTextBlock & /*block*/) {}
void removedFromEditor() {} void removedFromEditor() {}
+14 -19
View File
@@ -31,8 +31,9 @@
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggeragents.h" #include "debuggeragents.h"
#include "debuggerrunner.h" #include "debuggercore.h"
#include "debuggerplugin.h" #include "debuggerplugin.h"
#include "debuggerrunner.h"
#include "debuggerstringutils.h" #include "debuggerstringutils.h"
#include "debuggertooltip.h" #include "debuggertooltip.h"
@@ -87,6 +88,8 @@ using namespace TextEditor;
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
namespace Debugger {
DebuggerStartParameters::DebuggerStartParameters() : DebuggerStartParameters::DebuggerStartParameters() :
isSnapshot(false), isSnapshot(false),
attachPID(-1), attachPID(-1),
@@ -106,9 +109,6 @@ void DebuggerStartParameters::clear()
*this = DebuggerStartParameters(); *this = DebuggerStartParameters();
} }
namespace Debugger {
QDebug operator<<(QDebug d, DebuggerState state) QDebug operator<<(QDebug d, DebuggerState state)
{ {
//return d << DebuggerEngine::stateName(state) << '(' << int(state) << ')'; //return d << DebuggerEngine::stateName(state) << '(' << int(state) << ')';
@@ -321,7 +321,7 @@ void DebuggerEngine::showModuleSymbols
it->setData(2, Qt::DisplayRole, s.state); it->setData(2, Qt::DisplayRole, s.state);
w->addTopLevelItem(it); w->addTopLevelItem(it);
} }
plugin()->createNewDock(w); debuggerCore()->createNewDock(w);
} }
void DebuggerEngine::frameUp() void DebuggerEngine::frameUp()
@@ -452,7 +452,7 @@ void DebuggerEngine::showMessage(const QString &msg, int channel, int timeout) c
{ {
//if (msg.size() && msg.at(0).isUpper() && msg.at(1).isUpper()) //if (msg.size() && msg.at(0).isUpper() && msg.at(1).isUpper())
// qDebug() << qPrintable(msg) << "IN STATE" << state(); // qDebug() << qPrintable(msg) << "IN STATE" << state();
plugin()->showMessage(msg, channel, timeout); debuggerCore()->showMessage(msg, channel, timeout);
if (d->m_runControl) { if (d->m_runControl) {
d->m_runControl->showMessage(msg, channel); d->m_runControl->showMessage(msg, channel);
} else { } else {
@@ -516,7 +516,7 @@ void DebuggerEngine::resetLocation()
{ {
d->m_disassemblerViewAgent.resetLocation(); d->m_disassemblerViewAgent.resetLocation();
d->m_stackHandler.setCurrentIndex(-1); d->m_stackHandler.setCurrentIndex(-1);
plugin()->resetLocation(); debuggerCore()->resetLocation();
} }
void DebuggerEngine::gotoLocation(const QString &fileName, int lineNumber, bool setMarker) void DebuggerEngine::gotoLocation(const QString &fileName, int lineNumber, bool setMarker)
@@ -531,10 +531,10 @@ void DebuggerEngine::gotoLocation(const StackFrame &frame, bool setMarker)
{ {
if (theDebuggerBoolSetting(OperateByInstruction) || !frame.isUsable()) { if (theDebuggerBoolSetting(OperateByInstruction) || !frame.isUsable()) {
if (setMarker) if (setMarker)
plugin()->resetLocation(); debuggerCore()->resetLocation();
d->m_disassemblerViewAgent.setFrame(frame); d->m_disassemblerViewAgent.setFrame(frame);
} else { } else {
plugin()->gotoLocation(frame.file, frame.line, setMarker); debuggerCore()->gotoLocation(frame.file, frame.line, setMarker);
} }
} }
@@ -600,7 +600,7 @@ QStringList DebuggerEngine::qtDumperLibraryLocations() const
void DebuggerEngine::showQtDumperLibraryWarning(const QString &details) void DebuggerEngine::showQtDumperLibraryWarning(const QString &details)
{ {
plugin()->showQtDumperLibraryWarning(details); debuggerCore()->showQtDumperLibraryWarning(details);
} }
QString DebuggerEngine::qtDumperLibraryName() const QString DebuggerEngine::qtDumperLibraryName() const
@@ -1011,7 +1011,7 @@ void DebuggerEngine::updateViews()
// should be coordinated by their master engine. // should be coordinated by their master engine.
if (isSlaveEngine()) if (isSlaveEngine())
return; return;
plugin()->updateState(this); debuggerCore()->updateState(this);
} }
bool DebuggerEngine::isSlaveEngine() const bool DebuggerEngine::isSlaveEngine() const
@@ -1074,14 +1074,9 @@ qint64 DebuggerEngine::inferiorPid() const
return d->m_inferiorPid; return d->m_inferiorPid;
} }
DebuggerPlugin *DebuggerEngine::plugin()
{
return DebuggerPlugin::instance();
}
bool DebuggerEngine::isReverseDebugging() const bool DebuggerEngine::isReverseDebugging() const
{ {
return plugin()->isReverseDebugging(); return debuggerCore()->isReverseDebugging();
} }
bool DebuggerEngine::isActive() const bool DebuggerEngine::isActive() const
@@ -1130,7 +1125,7 @@ void DebuggerEngine::progressPing()
QMessageBox *DebuggerEngine::showMessageBox(int icon, const QString &title, QMessageBox *DebuggerEngine::showMessageBox(int icon, const QString &title,
const QString &text, int buttons) const QString &text, int buttons)
{ {
return plugin()->showMessageBox(icon, title, text, buttons); return debuggerCore()->showMessageBox(icon, title, text, buttons);
} }
DebuggerRunControl *DebuggerEngine::runControl() const DebuggerRunControl *DebuggerEngine::runControl() const
@@ -1394,7 +1389,7 @@ void DebuggerEngine::executeDebuggerCommand(const QString &)
Internal::BreakHandler *DebuggerEngine::breakHandler() const Internal::BreakHandler *DebuggerEngine::breakHandler() const
{ {
return plugin()->breakHandler(); return debuggerCore()->breakHandler();
} }
bool DebuggerEngine::isDying() const bool DebuggerEngine::isDying() const
+3 -4
View File
@@ -56,8 +56,6 @@ class IOptionsPage;
namespace Debugger { namespace Debugger {
class DebuggerEnginePrivate; class DebuggerEnginePrivate;
class DebuggerPlugin;
class DebuggerPluginPrivate;
class DebuggerRunControl; class DebuggerRunControl;
class QmlCppEngine; class QmlCppEngine;
@@ -118,6 +116,8 @@ DEBUGGER_EXPORT QDebug operator<<(QDebug str, DebuggerState state);
namespace Internal { namespace Internal {
class DebuggerCore;
class DebuggerPluginPrivate;
class DisassemblerViewAgent; class DisassemblerViewAgent;
class MemoryViewAgent; class MemoryViewAgent;
class Symbol; class Symbol;
@@ -209,7 +209,7 @@ public:
(int icon, const QString &title, const QString &text, int buttons = 0); (int icon, const QString &title, const QString &text, int buttons = 0);
protected: protected:
friend class DebuggerPluginPrivate; friend class Internal::DebuggerPluginPrivate;
virtual void detachDebugger(); virtual void detachDebugger();
virtual void exitDebugger(); virtual void exitDebugger();
virtual void executeStep(); virtual void executeStep();
@@ -232,7 +232,6 @@ protected:
virtual void frameDown(); virtual void frameDown();
public: public:
static DebuggerPlugin *plugin();
const DebuggerStartParameters &startParameters() const; const DebuggerStartParameters &startParameters() const;
DebuggerStartParameters &startParameters(); DebuggerStartParameters &startParameters();
+328 -299
View File
@@ -32,6 +32,7 @@
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggeragents.h" #include "debuggeragents.h"
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggercore.h"
#include "debuggerdialogs.h" #include "debuggerdialogs.h"
#include "debuggerengine.h" #include "debuggerengine.h"
#include "debuggermainwindow.h" #include "debuggermainwindow.h"
@@ -324,7 +325,6 @@ sg1: }
using namespace Core; using namespace Core;
using namespace Debugger::Constants; using namespace Debugger::Constants;
using namespace Debugger::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace TextEditor; using namespace TextEditor;
@@ -508,7 +508,7 @@ public:
: BaseTextMark(fileName, linenumber) : BaseTextMark(fileName, linenumber)
{} {}
QIcon icon() const { return DebuggerPlugin::instance()->locationMarkIcon(); } QIcon icon() const { return debuggerCore()->locationMarkIcon(); }
void updateLineNumber(int /*lineNumber*/) {} void updateLineNumber(int /*lineNumber*/) {}
void updateBlock(const QTextBlock & /*block*/) {} void updateBlock(const QTextBlock & /*block*/) {}
void removedFromEditor() {} void removedFromEditor() {}
@@ -854,9 +854,8 @@ struct DebuggerActions
QAction *frameDownAction; QAction *frameDownAction;
}; };
} // namespace Internal static DebuggerPluginPrivate *theDebuggerCore = 0;
using namespace Debugger::Internal;
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
@@ -864,12 +863,13 @@ using namespace Debugger::Internal;
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
class DebuggerPluginPrivate : public QObject class DebuggerPluginPrivate : public DebuggerCore
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DebuggerPluginPrivate(DebuggerPlugin *plugin); explicit DebuggerPluginPrivate(DebuggerPlugin *plugin);
~DebuggerPluginPrivate();
bool initialize(const QStringList &arguments, QString *errorMessage); bool initialize(const QStringList &arguments, QString *errorMessage);
void connectEngine(DebuggerEngine *engine, bool notify = true); void connectEngine(DebuggerEngine *engine, bool notify = true);
@@ -975,12 +975,35 @@ public slots:
void showStatusMessage(const QString &msg, int timeout = -1); void showStatusMessage(const QString &msg, int timeout = -1);
void openMemoryEditor(); void openMemoryEditor();
DebuggerMainWindow *mainWindow() void readSettings();
{ return qobject_cast<DebuggerMainWindow*> void writeSettings() const;
(DebuggerUISwitcher::instance()->mainWindow()); }
inline void setConfigValue(const QString &name, const QVariant &value); const CPlusPlus::Snapshot &cppCodeModelSnapshot() const;
inline QVariant configValue(const QString &name) const;
void showQtDumperLibraryWarning(const QString &details);
DebuggerMainWindow *debuggerMainWindow() const;
QWidget *mainWindow() const { return m_uiSwitcher->mainWindow(); }
bool isRegisterViewVisible() const;
bool hasSnapshots() const { return m_snapshotHandler->size(); }
void createNewDock(QWidget *widget);
void runControlStarted(DebuggerRunControl *runControl);
void runControlFinished(DebuggerRunControl *runControl);
DebuggerLanguages activeLanguages() const;
void remoteCommand(const QStringList &options, const QStringList &);
bool isReverseDebugging() const;
QMessageBox *showMessageBox(int icon, const QString &title,
const QString &text, int buttons);
void ensureLogVisible();
void extensionsInitialized();
BreakHandler *breakHandler() const { return m_breakHandler; }
SnapshotHandler *snapshotHandler() const { return m_snapshotHandler; }
void setConfigValue(const QString &name, const QVariant &value);
QVariant configValue(const QString &name) const;
DebuggerRunControl *createDebugger(const DebuggerStartParameters &sp, DebuggerRunControl *createDebugger(const DebuggerStartParameters &sp,
RunConfiguration *rc = 0); RunConfiguration *rc = 0);
@@ -1172,15 +1195,20 @@ public slots:
currentEngine()->stackHandler()->currentFrame(), true); currentEngine()->stackHandler()->currentFrame(), true);
} }
void resetLocation() bool isActiveDebugLanguage(int lang) const
{ {
// FIXME: code should be moved here. return m_uiSwitcher->activeDebugLanguages() & lang;
currentEngine()->resetLocation();
//d->m_disassemblerViewAgent.resetLocation();
//d->m_stackHandler.setCurrentIndex(-1);
//plugin()->resetLocation();
} }
void resetLocation();
QVariant sessionValue(const QString &name);
void setSessionValue(const QString &name, const QVariant &value);
QIcon locationMarkIcon() const { return m_locationMarkIcon; }
void openTextEditor(const QString &titlePattern0, const QString &contents);
void clearCppCodeModelSnapshot();
void showMessage(const QString &msg, int channel, int timeout = -1);
public: public:
DebuggerState m_state; DebuggerState m_state;
DebuggerUISwitcher *m_uiSwitcher; DebuggerUISwitcher *m_uiSwitcher;
@@ -1248,7 +1276,7 @@ public:
QTimer m_statusTimer; QTimer m_statusTimer;
QString m_lastPermanentStatusMessage; QString m_lastPermanentStatusMessage;
CPlusPlus::Snapshot m_codeModelSnapshot; mutable CPlusPlus::Snapshot m_codeModelSnapshot;
DebuggerPlugin *m_plugin; DebuggerPlugin *m_plugin;
SnapshotHandler *m_snapshotHandler; SnapshotHandler *m_snapshotHandler;
@@ -1256,8 +1284,12 @@ public:
DebuggerEngine *m_currentEngine; DebuggerEngine *m_currentEngine;
}; };
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin)
{ {
QTC_ASSERT(!theDebuggerCore, /**/);
theDebuggerCore = this;
m_plugin = plugin; m_plugin = plugin;
m_shuttingDown = false; m_shuttingDown = false;
@@ -1304,7 +1336,27 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin)
m_currentEngine = 0; m_currentEngine = 0;
} }
bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *errorMessage) DebuggerPluginPrivate::~DebuggerPluginPrivate()
{
m_plugin->removeObject(theDebuggerCore->m_debugMode);
delete m_debugMode;
m_debugMode = 0;
m_plugin->removeObject(m_uiSwitcher);
delete m_uiSwitcher;
m_uiSwitcher = 0;
delete m_snapshotHandler;
m_snapshotHandler = 0;
}
DebuggerCore *debuggerCore()
{
return theDebuggerCore;
}
bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
QString *errorMessage)
{ {
m_continuableContext = Core::Context("Gdb.Continuable"); m_continuableContext = Core::Context("Gdb.Continuable");
m_interruptibleContext = Core::Context("Gdb.Interruptible"); m_interruptibleContext = Core::Context("Gdb.Interruptible");
@@ -1475,7 +1527,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
connect(theDebuggerAction(ExecuteCommand), SIGNAL(triggered()), connect(theDebuggerAction(ExecuteCommand), SIGNAL(triggered()),
SLOT(executeDebuggerCommand())); SLOT(executeDebuggerCommand()));
m_plugin->readSettings(); readSettings();
// Cpp/Qml ui setup // Cpp/Qml ui setup
m_uiSwitcher = new DebuggerUISwitcher(m_debugMode, this); m_uiSwitcher = new DebuggerUISwitcher(m_debugMode, this);
@@ -2307,6 +2359,7 @@ DebuggerRunControl *DebuggerPluginPrivate::createDebugger
return m_debuggerRunControlFactory->create(sp, rc); return m_debuggerRunControlFactory->create(sp, rc);
} }
// If updateEngine is set, the engine will update its threads/modules and so forth.
void DebuggerPluginPrivate::displayDebugger(DebuggerEngine *engine, bool updateEngine) void DebuggerPluginPrivate::displayDebugger(DebuggerEngine *engine, bool updateEngine)
{ {
QTC_ASSERT(engine, return); QTC_ASSERT(engine, return);
@@ -2344,7 +2397,7 @@ public:
void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine, bool notify) void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine, bool notify)
{ {
static Debugger::DummyEngine dummyEngine; static DummyEngine dummyEngine;
if (!engine) if (!engine)
engine = &dummyEngine; engine = &dummyEngine;
@@ -2398,7 +2451,6 @@ void DebuggerPluginPrivate::fontSettingsChanged
void DebuggerPluginPrivate::cleanupViews() void DebuggerPluginPrivate::cleanupViews()
{ {
m_plugin->resetLocation();
m_actions.reverseDirectionAction->setChecked(false); m_actions.reverseDirectionAction->setChecked(false);
m_actions.reverseDirectionAction->setEnabled(false); m_actions.reverseDirectionAction->setEnabled(false);
hideDebuggerToolTip(); hideDebuggerToolTip();
@@ -2451,8 +2503,8 @@ void DebuggerPluginPrivate::setBusyCursor(bool busy)
void DebuggerPluginPrivate::setSimpleDockWidgetArrangement void DebuggerPluginPrivate::setSimpleDockWidgetArrangement
(Debugger::DebuggerLanguages activeLanguages) (Debugger::DebuggerLanguages activeLanguages)
{ {
Debugger::DebuggerUISwitcher *uiSwitcher = DebuggerUISwitcher::instance(); DebuggerMainWindow *mw = debuggerMainWindow();
DebuggerMainWindow *mw = mainWindow(); QTC_ASSERT(mw, return);
mw->setTrackingEnabled(false); mw->setTrackingEnabled(false);
QList<QDockWidget *> dockWidgets = mw->dockWidgets(); QList<QDockWidget *> dockWidgets = mw->dockWidgets();
@@ -2483,8 +2535,8 @@ void DebuggerPluginPrivate::setSimpleDockWidgetArrangement
m_breakDock->show(); m_breakDock->show();
m_watchDock->show(); m_watchDock->show();
m_scriptConsoleDock->show(); m_scriptConsoleDock->show();
if (uiSwitcher->qmlInspectorWindow()) if (m_uiSwitcher->qmlInspectorWindow())
uiSwitcher->qmlInspectorWindow()->show(); m_uiSwitcher->qmlInspectorWindow()->show();
} }
mw->splitDockWidget(mw->toolBarDockWidget(), m_stackDock, Qt::Vertical); mw->splitDockWidget(mw->toolBarDockWidget(), m_stackDock, Qt::Vertical);
mw->splitDockWidget(m_stackDock, m_watchDock, Qt::Horizontal); mw->splitDockWidget(m_stackDock, m_watchDock, Qt::Horizontal);
@@ -2495,8 +2547,8 @@ void DebuggerPluginPrivate::setSimpleDockWidgetArrangement
mw->tabifyDockWidget(m_watchDock, m_sourceFilesDock); mw->tabifyDockWidget(m_watchDock, m_sourceFilesDock);
mw->tabifyDockWidget(m_watchDock, m_snapshotDock); mw->tabifyDockWidget(m_watchDock, m_snapshotDock);
mw->tabifyDockWidget(m_watchDock, m_scriptConsoleDock); mw->tabifyDockWidget(m_watchDock, m_scriptConsoleDock);
if (uiSwitcher->qmlInspectorWindow()) if (m_uiSwitcher->qmlInspectorWindow())
mw->tabifyDockWidget(m_watchDock, uiSwitcher->qmlInspectorWindow()); mw->tabifyDockWidget(m_watchDock, m_uiSwitcher->qmlInspectorWindow());
mw->setTrackingEnabled(true); mw->setTrackingEnabled(true);
} }
@@ -2800,7 +2852,7 @@ void DebuggerPluginPrivate::executeDebuggerCommand()
void DebuggerPluginPrivate::showStatusMessage(const QString &msg0, int timeout) void DebuggerPluginPrivate::showStatusMessage(const QString &msg0, int timeout)
{ {
m_plugin->showMessage(msg0, LogStatus); showMessage(msg0, LogStatus);
QString msg = msg0; QString msg = msg0;
msg.replace(QLatin1Char('\n'), QString()); msg.replace(QLatin1Char('\n'), QString());
m_statusLabel->setText(msg); m_statusLabel->setText(msg);
@@ -2830,90 +2882,58 @@ void DebuggerPluginPrivate::coreShutdown()
m_shuttingDown = true; m_shuttingDown = true;
} }
/////////////////////////////////////////////////////////////////////// void DebuggerPluginPrivate::writeSettings() const
//
// DebuggerPlugin
//
///////////////////////////////////////////////////////////////////////
DebuggerPlugin *theInstance = 0;
DebuggerPlugin *DebuggerPlugin::instance()
{ {
return theInstance; QSettings *s = settings();
DebuggerSettings::instance()->writeSettings(s);
if (m_uiSwitcher)
m_uiSwitcher->writeSettings(s);
} }
DebuggerPlugin::DebuggerPlugin() void DebuggerPluginPrivate::readSettings()
{ {
d = new DebuggerPluginPrivate(this); //qDebug() << "PLUGIN READ SETTINGS";
theInstance = this; QSettings *s = settings();
DebuggerSettings::instance()->readSettings(s);
if (m_uiSwitcher)
m_uiSwitcher->writeSettings(s);
} }
DebuggerPlugin::~DebuggerPlugin() const CPlusPlus::Snapshot &DebuggerPluginPrivate::cppCodeModelSnapshot() const
{ {
theInstance = 0; if (m_codeModelSnapshot.isEmpty()
delete DebuggerSettings::instance(); && theDebuggerAction(UseCodeModel)->isChecked())
m_codeModelSnapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
removeObject(d->m_debugMode); return m_codeModelSnapshot;
delete d->m_debugMode;
d->m_debugMode = 0;
removeObject(d->m_uiSwitcher);
delete d->m_uiSwitcher;
d->m_uiSwitcher = 0;
delete d->m_snapshotHandler;
d->m_snapshotHandler = 0;
delete d;
} }
bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMessage) void DebuggerPluginPrivate::resetLocation()
{ {
return d->initialize(arguments, errorMessage); currentEngine()->resetLocation();
// FIXME: code should be moved here from the engine implementation.
//d->m_disassemblerViewAgent.resetLocation();
//d->m_stackHandler.setCurrentIndex(-1);
m_locationMark.reset();
} }
void DebuggerPlugin::setSessionValue(const QString &name, const QVariant &value) void DebuggerPluginPrivate::setSessionValue(const QString &name, const QVariant &value)
{ {
QTC_ASSERT(sessionManager(), return); QTC_ASSERT(sessionManager(), return);
sessionManager()->setValue(name, value); sessionManager()->setValue(name, value);
//qDebug() << "SET SESSION VALUE: " << name; //qDebug() << "SET SESSION VALUE: " << name;
} }
QVariant DebuggerPlugin::sessionValue(const QString &name) QVariant DebuggerPluginPrivate::sessionValue(const QString &name)
{ {
QTC_ASSERT(sessionManager(), return QVariant()); QTC_ASSERT(sessionManager(), return QVariant());
//qDebug() << "GET SESSION VALUE: " << name; //qDebug() << "GET SESSION VALUE: " << name;
return sessionManager()->value(name); return sessionManager()->value(name);
} }
void DebuggerPlugin::setConfigValue(const QString &name, const QVariant &value) void DebuggerPluginPrivate::openTextEditor(const QString &titlePattern0,
{
QTC_ASSERT(d->m_debugMode, return);
settings()->setValue(name, value);
}
QVariant DebuggerPlugin::configValue(const QString &name) const
{
QTC_ASSERT(d->m_debugMode, return QVariant());
return settings()->value(name);
}
void DebuggerPlugin::resetLocation()
{
d->m_locationMark.reset();
}
void DebuggerPlugin::gotoLocation(const QString &file, int line, bool setMarker)
{
d->gotoLocation(file, line, setMarker);
}
void DebuggerPlugin::openTextEditor(const QString &titlePattern0,
const QString &contents) const QString &contents)
{ {
if (d->m_shuttingDown) if (m_shuttingDown)
return; return;
QString titlePattern = titlePattern0; QString titlePattern = titlePattern0;
EditorManager *editorManager = EditorManager::instance(); EditorManager *editorManager = EditorManager::instance();
@@ -2924,241 +2944,49 @@ void DebuggerPlugin::openTextEditor(const QString &titlePattern0,
editorManager->activateEditor(editor, EditorManager::IgnoreNavigationHistory); editorManager->activateEditor(editor, EditorManager::IgnoreNavigationHistory);
} }
void DebuggerPlugin::writeSettings() const
void DebuggerPluginPrivate::clearCppCodeModelSnapshot()
{ {
QSettings *s = settings(); m_codeModelSnapshot = CPlusPlus::Snapshot();
DebuggerSettings::instance()->writeSettings(s);
} }
void DebuggerPlugin::readSettings() void DebuggerPluginPrivate::showMessage(const QString &msg, int channel, int timeout)
{
//qDebug() << "PLUGIN READ SETTINGS";
QSettings *s = settings();
DebuggerSettings::instance()->readSettings(s);
}
const CPlusPlus::Snapshot &DebuggerPlugin::cppCodeModelSnapshot() const
{
if (d->m_codeModelSnapshot.isEmpty() && theDebuggerAction(UseCodeModel)->isChecked())
d->m_codeModelSnapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
return d->m_codeModelSnapshot;
}
void DebuggerPlugin::clearCppCodeModelSnapshot()
{
d->m_codeModelSnapshot = CPlusPlus::Snapshot();
}
ExtensionSystem::IPlugin::ShutdownFlag DebuggerPlugin::aboutToShutdown()
{
disconnect(sessionManager(),
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), d, 0);
writeSettings();
if (d->m_uiSwitcher)
d->m_uiSwitcher->aboutToShutdown();
return SynchronousShutdown;
}
void DebuggerPlugin::showMessage(const QString &msg, int channel, int timeout)
{ {
//qDebug() << "PLUGIN OUTPUT: " << channel << msg; //qDebug() << "PLUGIN OUTPUT: " << channel << msg;
LogWindow *ow = d->m_logWindow; //ConsoleWindow *cw = m_consoleWindow;
//ConsoleWindow *cw = d->m_consoleWindow; QTC_ASSERT(m_logWindow, return);
QTC_ASSERT(ow, return);
switch (channel) { switch (channel) {
case StatusBar: case StatusBar:
// This will append to ow's output pane, too. // This will append to m_logWindow's output pane, too.
d->showStatusMessage(msg, timeout); showStatusMessage(msg, timeout);
break; break;
case LogMiscInput: case LogMiscInput:
ow->showInput(LogMisc, msg); m_logWindow->showInput(LogMisc, msg);
ow->showOutput(LogMisc, msg); m_logWindow->showOutput(LogMisc, msg);
break; break;
case LogInput: case LogInput:
ow->showInput(LogInput, msg); m_logWindow->showInput(LogInput, msg);
ow->showOutput(LogInput, msg); m_logWindow->showOutput(LogInput, msg);
break; break;
case ScriptConsoleOutput: case ScriptConsoleOutput:
d->m_scriptConsoleWindow->appendResult(msg); m_scriptConsoleWindow->appendResult(msg);
break;
case LogError:
m_logWindow->showOutput(channel, msg);
ensureLogVisible();
break; break;
default: default:
ow->showOutput(channel, msg); m_logWindow->showOutput(channel, msg);
if (channel == LogError)
ensureLogVisible();
break; break;
} }
} }
DebuggerMainWindow *DebuggerPluginPrivate::debuggerMainWindow() const
//////////////////////////////////////////////////////////////////////
//
// Register specific stuff
//
//////////////////////////////////////////////////////////////////////
bool DebuggerPlugin::isReverseDebugging() const
{ {
return d->m_actions.reverseDirectionAction->isChecked(); return qobject_cast<DebuggerMainWindow*>(mainWindow());
} }
QMessageBox *DebuggerPlugin::showMessageBox(int icon, const QString &title, void DebuggerPluginPrivate::showQtDumperLibraryWarning(const QString &details)
const QString &text, int buttons)
{
QMessageBox *mb = new QMessageBox(QMessageBox::Icon(icon),
title, text, QMessageBox::StandardButtons(buttons), mainWindow());
mb->setAttribute(Qt::WA_DeleteOnClose);
mb->show();
return mb;
}
void DebuggerPlugin::ensureLogVisible()
{
QAction *action = d->m_outputDock->toggleViewAction();
if (!action->isChecked())
action->trigger();
}
QIcon DebuggerPlugin::locationMarkIcon() const
{
return d->m_locationMarkIcon;
}
void DebuggerPlugin::extensionsInitialized()
{
d->m_uiSwitcher->initialize();
d->m_watchersWindow->setVisible(false);
d->m_returnWindow->setVisible(false);
connect(d->m_uiSwitcher, SIGNAL(memoryEditorRequested()),
d, SLOT(openMemoryEditor()));
// time gdb -i mi -ex 'debuggerplugin.cpp:800' -ex r -ex q bin/qtcreator.bin
const QByteArray env = qgetenv("QTC_DEBUGGER_TEST");
//qDebug() << "EXTENSIONS INITIALIZED:" << env;
// if (!env.isEmpty())
// m_plugin->runTest(QString::fromLocal8Bit(env));
if (d->m_attachRemoteParameters.attachPid
|| !d->m_attachRemoteParameters.attachTarget.isEmpty())
QTimer::singleShot(0, d, SLOT(attachCmdLine()));
}
QWidget *DebuggerPlugin::mainWindow() const
{
return d->m_uiSwitcher->mainWindow();
}
DebuggerRunControl *DebuggerPlugin::createDebugger
(const DebuggerStartParameters &sp, RunConfiguration *rc)
{
return instance()->d->createDebugger(sp, rc);
}
void DebuggerPlugin::startDebugger(RunControl *runControl)
{
instance()->d->startDebugger(runControl);
}
void DebuggerPlugin::displayDebugger(RunControl *runControl)
{
DebuggerRunControl *rc = qobject_cast<DebuggerRunControl *>(runControl);
QTC_ASSERT(rc, return);
instance()->d->displayDebugger(rc->engine());
}
// if updateEngine is set, the engine will update its threads/modules and so forth.
void DebuggerPlugin::displayDebugger(DebuggerEngine *engine, bool updateEngine)
{
instance()->d->displayDebugger(engine, updateEngine);
}
void DebuggerPlugin::updateState(DebuggerEngine *engine)
{
d->updateState(engine);
}
void DebuggerPlugin::activateDebugMode()
{
d->activateDebugMode();
}
void DebuggerPlugin::createNewDock(QWidget *widget)
{
QDockWidget *dockWidget =
DebuggerUISwitcher::instance()->createDockWidget(CppLanguage, widget);
dockWidget->setWindowTitle(widget->windowTitle());
dockWidget->setObjectName(widget->windowTitle());
dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
//dockWidget->setWidget(widget);
//mainWindow()->addDockWidget(Qt::TopDockWidgetArea, dockWidget);
dockWidget->show();
}
void DebuggerPlugin::runControlStarted(DebuggerRunControl *runControl)
{
d->connectEngine(runControl->engine());
d->m_snapshotHandler->appendSnapshot(runControl);
}
void DebuggerPlugin::runControlFinished(DebuggerRunControl *runControl)
{
Q_UNUSED(runControl);
d->m_snapshotHandler->removeSnapshot(runControl);
d->disconnectEngine();
if (theDebuggerBoolSetting(SwitchModeOnExit))
if (d->m_snapshotHandler->size() == 0)
d->activatePreviousMode();
}
DebuggerLanguages DebuggerPlugin::activeLanguages() const
{
return DebuggerUISwitcher::instance()->activeDebugLanguages();
}
bool DebuggerPlugin::isRegisterViewVisible() const
{
return d->m_registerDock->toggleViewAction()->isChecked();
}
bool DebuggerPlugin::hasSnapshots() const
{
return d->m_snapshotHandler->size();
}
Internal::BreakHandler *DebuggerPlugin::breakHandler() const
{
return d->m_breakHandler;
}
Internal::SnapshotHandler *DebuggerPlugin::snapshotHandler() const
{
return d->m_snapshotHandler;
}
DebuggerEngine *DebuggerPlugin::currentEngine() const
{
return d->m_currentEngine;
}
void DebuggerPlugin::remoteCommand(const QStringList &options, const QStringList &)
{
if (options.isEmpty())
return;
unsigned enabledEngines = 0;
QString errorMessage;
if (!parseArguments(options,
&d->m_attachRemoteParameters, &enabledEngines, &errorMessage)) {
qWarning("%s", qPrintable(errorMessage));
return;
}
if (!d->attachCmdLine())
qWarning("%s", qPrintable(
_("Incomplete remote attach command received: %1").
arg(options.join(QString(QLatin1Char(' '))))));
}
void DebuggerPlugin::showQtDumperLibraryWarning(const QString &details)
{ {
QMessageBox dialog(mainWindow()); QMessageBox dialog(mainWindow());
QPushButton *qtPref = dialog.addButton(tr("Open Qt4 Options"), QPushButton *qtPref = dialog.addButton(tr("Open Qt4 Options"),
@@ -3189,6 +3017,207 @@ void DebuggerPlugin::showQtDumperLibraryWarning(const QString &details)
} }
} }
bool DebuggerPluginPrivate::isRegisterViewVisible() const
{
return m_registerDock->toggleViewAction()->isChecked();
}
void DebuggerPluginPrivate::createNewDock(QWidget *widget)
{
QDockWidget *dockWidget =
m_uiSwitcher->createDockWidget(CppLanguage, widget);
dockWidget->setWindowTitle(widget->windowTitle());
dockWidget->setObjectName(widget->windowTitle());
dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
//dockWidget->setWidget(widget);
//mainWindow()->addDockWidget(Qt::TopDockWidgetArea, dockWidget);
dockWidget->show();
}
void DebuggerPluginPrivate::runControlStarted(DebuggerRunControl *runControl)
{
activateDebugMode();
if (!hasSnapshots())
m_uiSwitcher->updateActiveLanguages();
const QString message = runControl->idString();
showMessage(message, StatusBar);
showMessage(DebuggerSettings::instance()->dump(), LogDebug);
m_snapshotHandler->appendSnapshot(runControl);
connectEngine(runControl->engine());
}
void DebuggerPluginPrivate::runControlFinished(DebuggerRunControl *runControl)
{
m_snapshotHandler->removeSnapshot(runControl);
disconnectEngine();
if (theDebuggerBoolSetting(SwitchModeOnExit))
if (m_snapshotHandler->size() == 0)
activatePreviousMode();
}
void DebuggerPluginPrivate::remoteCommand(const QStringList &options,
const QStringList &)
{
if (options.isEmpty())
return;
unsigned enabledEngines = 0;
QString errorMessage;
if (!parseArguments(options,
&m_attachRemoteParameters, &enabledEngines, &errorMessage)) {
qWarning("%s", qPrintable(errorMessage));
return;
}
if (!attachCmdLine())
qWarning("%s", qPrintable(
_("Incomplete remote attach command received: %1").
arg(options.join(QString(QLatin1Char(' '))))));
}
DebuggerLanguages DebuggerPluginPrivate::activeLanguages() const
{
return m_uiSwitcher->activeDebugLanguages();
}
bool DebuggerPluginPrivate::isReverseDebugging() const
{
return m_actions.reverseDirectionAction->isChecked();
}
QMessageBox *DebuggerPluginPrivate::showMessageBox(int icon, const QString &title,
const QString &text, int buttons)
{
QMessageBox *mb = new QMessageBox(QMessageBox::Icon(icon),
title, text, QMessageBox::StandardButtons(buttons), mainWindow());
mb->setAttribute(Qt::WA_DeleteOnClose);
mb->show();
return mb;
}
void DebuggerPluginPrivate::ensureLogVisible()
{
QAction *action = m_outputDock->toggleViewAction();
if (!action->isChecked())
action->trigger();
}
void DebuggerPluginPrivate::extensionsInitialized()
{
m_uiSwitcher->initialize(settings());
m_watchersWindow->setVisible(false);
m_returnWindow->setVisible(false);
connect(m_uiSwitcher, SIGNAL(memoryEditorRequested()),
SLOT(openMemoryEditor()));
// time gdb -i mi -ex 'debuggerplugin.cpp:800' -ex r -ex q bin/qtcreator.bin
const QByteArray env = qgetenv("QTC_DEBUGGER_TEST");
//qDebug() << "EXTENSIONS INITIALIZED:" << env;
// if (!env.isEmpty())
// m_plugin->runTest(QString::fromLocal8Bit(env));
if (m_attachRemoteParameters.attachPid
|| !m_attachRemoteParameters.attachTarget.isEmpty())
QTimer::singleShot(0, this, SLOT(attachCmdLine()));
}
} // namespace Internal
using namespace Debugger::Internal;
///////////////////////////////////////////////////////////////////////
//
// DebuggerPlugin
//
///////////////////////////////////////////////////////////////////////
DebuggerPlugin::DebuggerPlugin()
{
theDebuggerCore = new DebuggerPluginPrivate(this);
}
DebuggerPlugin::~DebuggerPlugin()
{
delete DebuggerSettings::instance();
delete theDebuggerCore;
theDebuggerCore = 0;
}
bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
return theDebuggerCore->initialize(arguments, errorMessage);
}
void DebuggerPlugin::readSettings()
{
theDebuggerCore->readSettings();
}
void DebuggerPlugin::writeSettings() const
{
theDebuggerCore->writeSettings();
}
ExtensionSystem::IPlugin::ShutdownFlag DebuggerPlugin::aboutToShutdown()
{
disconnect(sessionManager(),
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
theDebuggerCore, 0);
writeSettings();
return SynchronousShutdown;
}
void DebuggerPlugin::remoteCommand(const QStringList &options,
const QStringList &list)
{
theDebuggerCore->remoteCommand(options, list);
}
DebuggerRunControl *DebuggerPlugin::createDebugger
(const DebuggerStartParameters &sp, RunConfiguration *rc)
{
return theDebuggerCore->createDebugger(sp, rc);
}
void DebuggerPlugin::startDebugger(RunControl *runControl)
{
theDebuggerCore->startDebugger(runControl);
}
void DebuggerPlugin::displayDebugger(RunControl *runControl)
{
DebuggerRunControl *rc = qobject_cast<DebuggerRunControl *>(runControl);
QTC_ASSERT(rc, return);
theDebuggerCore->displayDebugger(rc->engine());
}
void DebuggerPlugin::runControlStarted(DebuggerRunControl *runControl)
{
theDebuggerCore->runControlStarted(runControl);
}
void DebuggerPlugin::runControlFinished(DebuggerRunControl *runControl)
{
theDebuggerCore->runControlFinished(runControl);
}
void DebuggerPlugin::extensionsInitialized()
{
theDebuggerCore->extensionsInitialized();
}
bool DebuggerPlugin::isActiveDebugLanguage(int language)
{
return theDebuggerCore->isActiveDebugLanguage(language);
}
DebuggerUISwitcher *DebuggerPlugin::uiSwitcher()
{
return theDebuggerCore->m_uiSwitcher;
}
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// //
// Testing // Testing
+15 -68
View File
@@ -31,18 +31,10 @@
#define DEBUGGERPLUGIN_H #define DEBUGGERPLUGIN_H
#include "debugger_global.h" #include "debugger_global.h"
#include "debuggerconstants.h"
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
QT_BEGIN_NAMESPACE #include <QtCore/QObject>
class QIcon;
class QMessageBox;
QT_END_NAMESPACE
namespace CPlusPlus {
class Snapshot;
}
namespace ProjectExplorer { namespace ProjectExplorer {
class RunConfiguration; class RunConfiguration;
@@ -50,15 +42,15 @@ class RunControl;
} }
namespace Debugger { namespace Debugger {
class DebuggerEngine;
class DebuggerPluginPrivate;
class DebuggerRunControl; class DebuggerRunControl;
class DebuggerStartParameters; class DebuggerStartParameters;
class DebuggerUISwitcher;
namespace Internal { // This is the "external" interface of the debugger plugin that's
class BreakHandler; // visible from Creator core. The internal interfact to global
class SnapshotHandler; // functionality to be used by debugger views and debugger engines
} // is DebuggerCore, implemented in DebuggerPluginPrivate.
class DEBUGGER_EXPORT DebuggerPlugin : public ExtensionSystem::IPlugin class DEBUGGER_EXPORT DebuggerPlugin : public ExtensionSystem::IPlugin
{ {
@@ -68,68 +60,23 @@ public:
DebuggerPlugin(); DebuggerPlugin();
~DebuggerPlugin(); ~DebuggerPlugin();
static DebuggerPlugin *instance();
static DebuggerRunControl *createDebugger(const DebuggerStartParameters &sp, static DebuggerRunControl *createDebugger(const DebuggerStartParameters &sp,
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(DebuggerEngine *engine, bool updateEngine = true); static bool isActiveDebugLanguage(int language);
static DebuggerUISwitcher *uiSwitcher();
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(DebuggerEngine *engine);
virtual void remoteCommand(const QStringList &options, const QStringList &arguments);
void showQtDumperLibraryWarning(const QString &details);
QIcon locationMarkIcon() const;
void activateDebugMode();
const CPlusPlus::Snapshot &cppCodeModelSnapshot() const;
bool isRegisterViewVisible() const;
bool hasSnapshots() const;
void openTextEditor(const QString &titlePattern, const QString &contents);
Internal::BreakHandler *breakHandler() const;
Internal::SnapshotHandler *snapshotHandler() const;
DebuggerEngine *currentEngine() const;
public slots:
void clearCppCodeModelSnapshot();
void ensureLogVisible();
// void runTest(const QString &fileName);
void showMessage(const QString &msg, int channel, int timeout = -1);
void gotoLocation(const QString &fileName, int lineNumber = -1,
bool setMarker = false);
private: private:
friend class DebuggerEngine; // IPlugin implementation.
friend class DebuggerPluginPrivate;
friend class DebuggerRunControl;
void resetLocation();
void readSettings();
void writeSettings() const;
bool isReverseDebugging() const;
void createNewDock(QWidget *widget);
void runControlStarted(DebuggerRunControl *runControl);
void runControlFinished(DebuggerRunControl *runControl);
DebuggerLanguages activeLanguages() const;
QMessageBox *showMessageBox(int icon, const QString &title,
const QString &text, int buttons = 0);
bool initialize(const QStringList &arguments, QString *errorMessage); bool initialize(const QStringList &arguments, QString *errorMessage);
void remoteCommand(const QStringList &options, const QStringList &arguments);
ShutdownFlag aboutToShutdown(); ShutdownFlag aboutToShutdown();
void extensionsInitialized(); void extensionsInitialized();
void readSettings();
QWidget *mainWindow() const; void writeSettings() const;
void runControlStarted(DebuggerRunControl *runControl);
DebuggerPluginPrivate *d; void runControlFinished(DebuggerRunControl *runControl);
}; };
} // namespace Debugger } // namespace Debugger
+19 -18
View File
@@ -30,6 +30,7 @@
#include "debuggerrunner.h" #include "debuggerrunner.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggercore.h"
#include "debuggerengine.h" #include "debuggerengine.h"
#include "debuggerplugin.h" #include "debuggerplugin.h"
#include "debuggerstringutils.h" #include "debuggerstringutils.h"
@@ -112,8 +113,6 @@ static QString msgEngineNotAvailable(const char *engine)
"which is disabled.").arg(QLatin1String(engine)); "which is disabled.").arg(QLatin1String(engine));
} }
static DebuggerPlugin *plugin() { return DebuggerPlugin::instance(); }
// A factory to create DebuggerRunControls // A factory to create DebuggerRunControls
DebuggerRunControlFactory::DebuggerRunControlFactory(QObject *parent, DebuggerRunControlFactory::DebuggerRunControlFactory(QObject *parent,
unsigned enabledEngines) unsigned enabledEngines)
@@ -180,16 +179,17 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
sp.dumperLibrary = rc->dumperLibrary(); sp.dumperLibrary = rc->dumperLibrary();
sp.dumperLibraryLocations = rc->dumperLibraryLocations(); sp.dumperLibraryLocations = rc->dumperLibraryLocations();
DebuggerLanguages activeLangs = DebuggerUISwitcher::instance()->activeDebugLanguages(); if (debuggerCore()->isActiveDebugLanguage(QmlLanguage)) {
if (activeLangs & QmlLanguage) {
sp.qmlServerAddress = QLatin1String("127.0.0.1"); sp.qmlServerAddress = QLatin1String("127.0.0.1");
sp.qmlServerPort = runConfiguration->qmlDebugServerPort(); sp.qmlServerPort = runConfiguration->qmlDebugServerPort();
sp.projectDir = runConfiguration->target()->project()->projectDirectory(); sp.projectDir = runConfiguration->target()->project()->projectDirectory();
if (runConfiguration->target()->activeBuildConfiguration()) if (runConfiguration->target()->activeBuildConfiguration())
sp.projectBuildDir = runConfiguration->target()->activeBuildConfiguration()->buildDirectory(); sp.projectBuildDir = runConfiguration->target()
->activeBuildConfiguration()->buildDirectory();
sp.processArgs.append(QLatin1String("-qmljsdebugger=port:") + QString::number(sp.qmlServerPort)); sp.processArgs.append(QLatin1String("-qmljsdebugger=port:")
+ QString::number(sp.qmlServerPort));
} }
// FIXME: If it's not yet build this will be empty and not filled // FIXME: If it's not yet build this will be empty and not filled
@@ -413,7 +413,7 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams
// Figure out engine according to toolchain, executable, attach or default. // Figure out engine according to toolchain, executable, attach or default.
DebuggerEngineType engineType = NoEngineType; DebuggerEngineType engineType = NoEngineType;
DebuggerLanguages activeLangs = DebuggerPlugin::instance()->activeLanguages(); DebuggerLanguages activeLangs = debuggerCore()->activeLanguages();
const unsigned enabledEngineTypes = d->enabledEngines(); const unsigned enabledEngineTypes = d->enabledEngines();
if (sp.executable.endsWith(_(".js"))) if (sp.executable.endsWith(_(".js")))
engineType = ScriptEngineType; engineType = ScriptEngineType;
@@ -540,7 +540,7 @@ bool DebuggerRunControl::checkDebugConfiguration(int toolChain,
bool success = true; bool success = true;
if (!(DebuggerPlugin::instance()->activeLanguages() & CppLanguage)) if (!(debuggerCore()->activeLanguages() & CppLanguage))
return success; return success;
switch(toolChain) { switch(toolChain) {
@@ -589,14 +589,7 @@ void DebuggerRunControl::start()
return; return;
} }
plugin()->activateDebugMode(); debuggerCore()->runControlStarted(this);
DebuggerUISwitcher::instance()->aboutToStartDebugger();
const QString message = tr("Starting debugger '%1' for tool chain '%2'...").
arg(d->m_engine->objectName(), toolChainName(sp.toolChainType));
plugin()->showMessage(message, StatusBar);
plugin()->showMessage(DebuggerSettings::instance()->dump(), LogDebug);
plugin()->runControlStarted(this);
// We might get a synchronous startFailed() notification on Windows, // We might get a synchronous startFailed() notification on Windows,
// when launching the process fails. Emit a proper finished() sequence. // when launching the process fails. Emit a proper finished() sequence.
@@ -611,6 +604,13 @@ void DebuggerRunControl::start()
} }
} }
QString DebuggerRunControl::idString() const
{
return tr("Starting debugger '%1' for tool chain '%2'...")
.arg(d->m_engine->objectName())
.arg(toolChainName(d->m_engine->startParameters().toolChainType));
}
void DebuggerRunControl::startFailed() void DebuggerRunControl::startFailed()
{ {
emit addToOutputWindowInline(this, tr("Debugging has failed"), false); emit addToOutputWindowInline(this, tr("Debugging has failed"), false);
@@ -624,7 +624,7 @@ void DebuggerRunControl::handleFinished()
emit addToOutputWindowInline(this, tr("Debugging has finished"), false); emit addToOutputWindowInline(this, tr("Debugging has finished"), false);
if (engine()) if (engine())
engine()->handleFinished(); engine()->handleFinished();
plugin()->runControlFinished(this); debuggerCore()->runControlFinished(this);
} }
void DebuggerRunControl::showMessage(const QString &msg, int channel) void DebuggerRunControl::showMessage(const QString &msg, int channel)
@@ -652,7 +652,7 @@ bool DebuggerRunControl::aboutToStop() const
" Would you still like to terminate it?"); " Would you still like to terminate it?");
const QMessageBox::StandardButton answer = const QMessageBox::StandardButton answer =
QMessageBox::question(DebuggerUISwitcher::instance()->mainWindow(), QMessageBox::question(debuggerCore()->mainWindow(),
tr("Close Debugging Session"), question, tr("Close Debugging Session"), question,
QMessageBox::Yes|QMessageBox::No); QMessageBox::Yes|QMessageBox::No);
return answer == QMessageBox::Yes; return answer == QMessageBox::Yes;
@@ -754,4 +754,5 @@ RunConfiguration *DebuggerRunControl::runConfiguration() const
{ {
return d->m_myRunConfiguration.data(); return d->m_myRunConfiguration.data();
} }
} // namespace Debugger } // namespace Debugger
+1
View File
@@ -120,6 +120,7 @@ public:
QString *errorMessage, QString *errorMessage,
QString *settingsCategory = 0, QString *settingsCategory = 0,
QString *settingsPage = 0); QString *settingsPage = 0);
QString idString() const;
signals: signals:
void engineRequestSetup(); void engineRequestSetup();
+4 -29
View File
@@ -140,8 +140,6 @@ struct DebuggerUISwitcherPrivate
QWeakPointer<ProjectExplorer::RunConfiguration> m_previousRunConfiguration; QWeakPointer<ProjectExplorer::RunConfiguration> m_previousRunConfiguration;
bool m_initialized; bool m_initialized;
static DebuggerUISwitcher *m_instance;
}; };
DebuggerUISwitcherPrivate::DebuggerUISwitcherPrivate(DebuggerUISwitcher *q) DebuggerUISwitcherPrivate::DebuggerUISwitcherPrivate(DebuggerUISwitcher *q)
@@ -160,8 +158,6 @@ DebuggerUISwitcherPrivate::DebuggerUISwitcherPrivate(DebuggerUISwitcher *q)
{ {
} }
DebuggerUISwitcher *DebuggerUISwitcherPrivate::m_instance = 0;
DebuggerUISwitcher::DebuggerUISwitcher(BaseMode *mode, QObject* parent) DebuggerUISwitcher::DebuggerUISwitcher(BaseMode *mode, QObject* parent)
: QObject(parent), d(new DebuggerUISwitcherPrivate(this)) : QObject(parent), d(new DebuggerUISwitcherPrivate(this))
{ {
@@ -180,13 +176,10 @@ DebuggerUISwitcher::DebuggerUISwitcher(BaseMode *mode, QObject* parent)
d->m_debugMenu = am->actionContainer(ProjectExplorer::Constants::M_DEBUG); d->m_debugMenu = am->actionContainer(ProjectExplorer::Constants::M_DEBUG);
d->m_viewsMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS)); d->m_viewsMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS));
QTC_ASSERT(d->m_viewsMenu, return) QTC_ASSERT(d->m_viewsMenu, return)
DebuggerUISwitcherPrivate::m_instance = this;
} }
DebuggerUISwitcher::~DebuggerUISwitcher() DebuggerUISwitcher::~DebuggerUISwitcher()
{ {
DebuggerUISwitcherPrivate::m_instance = 0;
delete d; delete d;
} }
@@ -345,11 +338,6 @@ void DebuggerUISwitcher::createViewsMenuItems()
d->m_viewsMenu->addAction(cmd); d->m_viewsMenu->addAction(cmd);
} }
DebuggerUISwitcher *DebuggerUISwitcher::instance()
{
return DebuggerUISwitcherPrivate::m_instance;
}
void DebuggerUISwitcher::addLanguage(const DebuggerLanguage &languageId, const Context &context) void DebuggerUISwitcher::addLanguage(const DebuggerLanguage &languageId, const Context &context)
{ {
bool activate = (d->m_supportedLanguages == AnyLanguage); bool activate = (d->m_supportedLanguages == AnyLanguage);
@@ -595,20 +583,8 @@ QWidget *DebuggerUISwitcher::createContents(BaseMode *mode)
return splitter; return splitter;
} }
void DebuggerUISwitcher::aboutToStartDebugger() void DebuggerUISwitcher::writeSettings(QSettings *settings) const
{ {
if (!DebuggerPlugin::instance()->hasSnapshots())
updateActiveLanguages();
}
void DebuggerUISwitcher::aboutToShutdown()
{
writeSettings();
}
void DebuggerUISwitcher::writeSettings() const
{
QSettings *settings = ICore::instance()->settings();
{ {
settings->beginGroup(QLatin1String("DebugMode.CppMode")); settings->beginGroup(QLatin1String("DebugMode.CppMode"));
QHashIterator<QString, QVariant> it(d->m_dockWidgetActiveStateCpp); QHashIterator<QString, QVariant> it(d->m_dockWidgetActiveStateCpp);
@@ -629,9 +605,8 @@ void DebuggerUISwitcher::writeSettings() const
} }
} }
void DebuggerUISwitcher::readSettings() void DebuggerUISwitcher::readSettings(QSettings *settings)
{ {
QSettings *settings = ICore::instance()->settings();
d->m_dockWidgetActiveStateCpp.clear(); d->m_dockWidgetActiveStateCpp.clear();
d->m_dockWidgetActiveStateQmlCpp.clear(); d->m_dockWidgetActiveStateQmlCpp.clear();
@@ -660,12 +635,12 @@ void DebuggerUISwitcher::readSettings()
d->m_activeDebugLanguages = langs; d->m_activeDebugLanguages = langs;
} }
void DebuggerUISwitcher::initialize() void DebuggerUISwitcher::initialize(QSettings *settings)
{ {
createViewsMenuItems(); createViewsMenuItems();
emit dockResetRequested(AnyLanguage); emit dockResetRequested(AnyLanguage);
readSettings(); readSettings(settings);
updateUi(); updateUi();
+12 -14
View File
@@ -37,13 +37,14 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QDockWidget; class QDockWidget;
class QSettings;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { namespace Core {
class Command; class Command;
class Context; class Context;
class IMode; class IMode;
class BaseMode; class BaseMode;
} }
namespace Utils { namespace Utils {
@@ -51,9 +52,9 @@ class FancyMainWindow;
} }
namespace ProjectExplorer { namespace ProjectExplorer {
class Project; class Project;
class Target; class Target;
class RunConfiguration; class RunConfiguration;
} }
namespace Debugger { namespace Debugger {
@@ -71,8 +72,6 @@ public:
explicit DebuggerUISwitcher(Core::BaseMode *mode, QObject *parent = 0); explicit DebuggerUISwitcher(Core::BaseMode *mode, QObject *parent = 0);
virtual ~DebuggerUISwitcher(); virtual ~DebuggerUISwitcher();
static DebuggerUISwitcher *instance();
// debuggable languages are registered with this function. // debuggable languages are registered with this function.
void addLanguage(const DebuggerLanguage &language, const Core::Context &context); void addLanguage(const DebuggerLanguage &language, const Core::Context &context);
@@ -90,10 +89,8 @@ public:
DebuggerLanguages activeDebugLanguages() const; DebuggerLanguages activeDebugLanguages() const;
// called when all dependent plugins have loaded // called when all dependent plugins have loaded
void initialize(); void initialize(QSettings *settings);
void aboutToStartDebugger();
void aboutToShutdown();
void onModeChanged(Core::IMode *mode); void onModeChanged(Core::IMode *mode);
// most common debugger windows // most common debugger windows
@@ -130,8 +127,11 @@ private slots:
void updateUiForCurrentRunConfiguration(); void updateUiForCurrentRunConfiguration();
void updateUiOnFileListChange(); void updateUiOnFileListChange();
public slots:
void updateActiveLanguages(); void updateActiveLanguages();
void updateDockWidgetSettings(); void updateDockWidgetSettings();
void readSettings(QSettings *settings);
void writeSettings(QSettings *settings) const;
private: private:
// Used by MainWindow // Used by MainWindow
@@ -143,8 +143,6 @@ private:
void hideInactiveWidgets(); void hideInactiveWidgets();
void createViewsMenuItems(); void createViewsMenuItems();
void readSettings();
void writeSettings() const;
bool isQmlCppActive() const; bool isQmlCppActive() const;
bool isQmlActive() const; bool isQmlActive() const;
@@ -32,8 +32,8 @@
#include "abstractgdbadapter.h" #include "abstractgdbadapter.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggercore.h"
#include "debuggerstringutils.h" #include "debuggerstringutils.h"
#include "debuggerplugin.h"
#include "stackhandler.h" #include "stackhandler.h"
#include "watchhandler.h" #include "watchhandler.h"
@@ -664,7 +664,7 @@ void GdbEngine::handleStackListLocalsClassic(const GdbResponse &response)
? qVariantValue<Debugger::Internal::StackFrame>(response.cookie) ? qVariantValue<Debugger::Internal::StackFrame>(response.cookie)
: stackHandler()->currentFrame(); : stackHandler()->currentFrame();
if (frame.isUsable()) if (frame.isUsable())
getUninitializedVariables(plugin()->cppCodeModelSnapshot(), getUninitializedVariables(debuggerCore()->cppCodeModelSnapshot(),
frame.function, frame.file, frame.line, frame.function, frame.file, frame.line,
&uninitializedVariables); &uninitializedVariables);
} }
+3 -7
View File
@@ -34,6 +34,7 @@
#include "gdboptionspage.h" #include "gdboptionspage.h"
#include "debuggeruiswitcher.h" #include "debuggeruiswitcher.h"
#include "debuggermainwindow.h" #include "debuggermainwindow.h"
#include "debuggercore.h"
#include "debuggerplugin.h" #include "debuggerplugin.h"
#include "debuggerrunner.h" #include "debuggerrunner.h"
@@ -203,11 +204,6 @@ DebuggerStartMode GdbEngine::startMode() const
return startParameters().startMode; return startParameters().startMode;
} }
QMainWindow *GdbEngine::mainWindow() const
{
return DebuggerUISwitcher::instance()->mainWindow();
}
AbstractGdbProcess *GdbEngine::gdbProc() const AbstractGdbProcess *GdbEngine::gdbProc() const
{ {
return m_gdbAdapter->gdbProc(); return m_gdbAdapter->gdbProc();
@@ -3077,7 +3073,7 @@ void GdbEngine::handleMakeSnapshot(const GdbResponse &response)
void GdbEngine::reloadRegisters() void GdbEngine::reloadRegisters()
{ {
if (!plugin()->isRegisterViewVisible()) if (!debuggerCore()->isRegisterViewVisible())
return; return;
if (state() != InferiorStopOk && state() != InferiorUnrunnable) if (state() != InferiorStopOk && state() != InferiorUnrunnable)
@@ -4371,7 +4367,7 @@ void GdbEngine::createFullBacktrace()
void GdbEngine::handleCreateFullBacktrace(const GdbResponse &response) void GdbEngine::handleCreateFullBacktrace(const GdbResponse &response)
{ {
if (response.resultClass == GdbResultDone) { if (response.resultClass == GdbResultDone) {
plugin()->openTextEditor(_("Backtrace $"), debuggerCore()->openTextEditor(_("Backtrace $"),
_(response.data.findChild("consolestreamoutput").data())); _(response.data.findChild("consolestreamoutput").data()));
} }
} }
-1
View File
@@ -525,7 +525,6 @@ private: ////////// View & Data Stuff //////////
// Convenience Functions // Convenience Functions
// //
QString errorMessage(QProcess::ProcessError error); QString errorMessage(QProcess::ProcessError error);
QMainWindow *mainWindow() const;
AbstractGdbProcess *gdbProc() const; AbstractGdbProcess *gdbProc() const;
void showExecutionError(const QString &message); void showExecutionError(const QString &message);
+4 -30
View File
@@ -31,8 +31,8 @@
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggercore.h"
#include "debuggerengine.h" #include "debuggerengine.h"
#include "debuggerplugin.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
@@ -53,16 +53,6 @@
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
static DebuggerPlugin *plugin()
{
return DebuggerPlugin::instance();
}
static DebuggerEngine *currentEngine()
{
return DebuggerPlugin::instance()->currentEngine();
}
ModulesWindow::ModulesWindow(QWidget *parent) ModulesWindow::ModulesWindow(QWidget *parent)
: QTreeView(parent), m_alwaysResizeColumnsToContents(false) : QTreeView(parent), m_alwaysResizeColumnsToContents(false)
{ {
@@ -82,23 +72,7 @@ ModulesWindow::ModulesWindow(QWidget *parent)
void ModulesWindow::moduleActivated(const QModelIndex &index) void ModulesWindow::moduleActivated(const QModelIndex &index)
{ {
plugin()->gotoLocation(index.data().toString()); debuggerCore()->gotoLocation(index.data().toString());
}
void ModulesWindow::resizeEvent(QResizeEvent *event)
{
//QHeaderView *hv = header();
//int totalSize = event->size().width() - 110;
//hv->resizeSection(0, totalSize / 4);
//hv->resizeSection(1, totalSize / 4);
//hv->resizeSection(2, totalSize / 4);
//hv->resizeSection(3, totalSize / 4);
//hv->resizeSection(0, 60);
//hv->resizeSection(1, (totalSize * 50) / 100);
//hv->resizeSection(2, (totalSize * 50) / 100);
//hv->resizeSection(3, 50);
//setColumnHidden(3, true);
QTreeView::resizeEvent(event);
} }
void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev) void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
@@ -110,7 +84,7 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
if (index.isValid()) if (index.isValid())
name = index.data().toString(); name = index.data().toString();
DebuggerEngine *engine = currentEngine(); DebuggerEngine *engine = debuggerCore()->currentEngine();
const bool enabled = engine->debuggerActionsEnabled(); const bool enabled = engine->debuggerActionsEnabled();
const unsigned capabilities = engine->debuggerCapabilities(); const unsigned capabilities = engine->debuggerCapabilities();
@@ -191,7 +165,7 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
} else if (act == actLoadSymbolsForModule) { } else if (act == actLoadSymbolsForModule) {
engine->loadSymbols(name); engine->loadSymbols(name);
} else if (act == actEditFile) { } else if (act == actEditFile) {
plugin()->gotoLocation(name); debuggerCore()->gotoLocation(name);
} else if (act == actShowSymbols) { } else if (act == actShowSymbols) {
// FIXME setModelData(RequestModuleSymbolsRole, name); // FIXME setModelData(RequestModuleSymbolsRole, name);
} }
-1
View File
@@ -49,7 +49,6 @@ private slots:
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); } void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
private: private:
void resizeEvent(QResizeEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev); void contextMenuEvent(QContextMenuEvent *ev);
void setModel(QAbstractItemModel *model); void setModel(QAbstractItemModel *model);
+2 -2
View File
@@ -1,7 +1,7 @@
#include "qmlcppengine.h" #include "qmlcppengine.h"
#include "qmlengine.h" #include "qmlengine.h"
#include "debuggeruiswitcher.h" #include "debuggeruiswitcher.h"
#include "debuggerplugin.h" #include "debuggercore.h"
#include <qmljseditor/qmljseditorconstants.h> #include <qmljseditor/qmljseditorconstants.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
@@ -124,7 +124,7 @@ void QmlCppEngine::setActiveEngine(DebuggerLanguage language)
} }
if (previousEngine != d->m_activeEngine) { if (previousEngine != d->m_activeEngine) {
showStatusMessage(tr("%1 debugger activated").arg(engineName)); showStatusMessage(tr("%1 debugger activated").arg(engineName));
plugin()->displayDebugger(d->m_activeEngine, updateEngine); Internal::debuggerCore()->displayDebugger(d->m_activeEngine, updateEngine);
} }
} }
+13 -13
View File
@@ -33,7 +33,6 @@
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggertooltip.h" #include "debuggertooltip.h"
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggerplugin.h"
#include "debuggerdialogs.h" #include "debuggerdialogs.h"
#include "debuggerstringutils.h" #include "debuggerstringutils.h"
#include "debuggeruiswitcher.h" #include "debuggeruiswitcher.h"
@@ -236,36 +235,37 @@ void QmlEngine::connectionEstablished()
{ {
attemptBreakpointSynchronization(); attemptBreakpointSynchronization();
ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pluginManager =
ExtensionSystem::PluginManager::instance();
pluginManager->addObject(d->m_adapter); pluginManager->addObject(d->m_adapter);
pluginManager->addObject(this); pluginManager->addObject(this);
d->m_addedAdapterToObjectPool = true; d->m_addedAdapterToObjectPool = true;
plugin()->showMessage(tr("QML Debugger connected."), StatusBar); showMessage(tr("QML Debugger connected."), StatusBar);
notifyEngineRunAndInferiorRunOk(); notifyEngineRunAndInferiorRunOk();
} }
void QmlEngine::connectionStartupFailed() void QmlEngine::connectionStartupFailed()
{ {
QMessageBox::critical(0, QMessageBox::critical(0, tr("Failed to connect to debugger"),
tr("Failed to connect to debugger"), tr("Could not connect to QML debugger server at %1:%2.")
tr("Could not connect to QML debugger server at %1:%2.") .arg(startParameters().qmlServerAddress)
.arg(startParameters().qmlServerAddress) .arg(startParameters().qmlServerPort));
.arg(startParameters().qmlServerPort));
notifyEngineRunFailed(); notifyEngineRunFailed();
} }
void QmlEngine::connectionError(QAbstractSocket::SocketError socketError) void QmlEngine::connectionError(QAbstractSocket::SocketError socketError)
{ {
if (socketError ==QAbstractSocket::RemoteHostClosedError) if (socketError ==QAbstractSocket::RemoteHostClosedError)
plugin()->showMessage(tr("QML Debugger: Remote host closed connection."), StatusBar); showMessage(tr("QML Debugger: Remote host closed connection."), StatusBar);
} }
void QmlEngine::serviceConnectionError(const QString &serviceName) void QmlEngine::serviceConnectionError(const QString &serviceName)
{ {
showMessage(tr("QML Debugger: Could not connect to service '%1'.").arg(serviceName), StatusBar); showMessage(tr("QML Debugger: Could not connect to service '%1'.")
.arg(serviceName), StatusBar);
} }
void QmlEngine::runEngine() void QmlEngine::runEngine()
@@ -371,7 +371,7 @@ void QmlEngine::shutdownEngine()
shutdownEngineAsSlave(); shutdownEngineAsSlave();
notifyEngineShutdownOk(); notifyEngineShutdownOk();
plugin()->showMessage(QString(), StatusBar); showMessage(QString(), StatusBar);
} }
void QmlEngine::setupEngine() void QmlEngine::setupEngine()
@@ -756,7 +756,7 @@ void QmlEngine::messageReceived(const QByteArray &message)
if (iname.startsWith("watch.")) { if (iname.startsWith("watch.")) {
watchHandler()->insertData(data); watchHandler()->insertData(data);
} else if(iname == "console") { } else if(iname == "console") {
plugin()->showMessage(data.value, ScriptConsoleOutput); showMessage(data.value, ScriptConsoleOutput);
} else { } else {
qWarning() << "QmlEngine: Unexcpected result: " << iname << data.value; qWarning() << "QmlEngine: Unexcpected result: " << iname << data.value;
} }
@@ -807,7 +807,7 @@ void QmlEngine::messageReceived(const QByteArray &message)
void QmlEngine::disconnected() void QmlEngine::disconnected()
{ {
plugin()->showMessage(tr("QML Debugger disconnected."), StatusBar); showMessage(tr("QML Debugger disconnected."), StatusBar);
notifyInferiorExited(); notifyInferiorExited();
} }
+2 -2
View File
@@ -30,9 +30,9 @@
#include "registerwindow.h" #include "registerwindow.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggerplugin.h"
#include "debuggeragents.h" #include "debuggeragents.h"
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggercore.h"
#include "debuggerengine.h" #include "debuggerengine.h"
#include "registerhandler.h" #include "registerhandler.h"
#include "watchdelegatewidgets.h" #include "watchdelegatewidgets.h"
@@ -54,7 +54,7 @@ namespace Internal {
static DebuggerEngine *currentEngine() static DebuggerEngine *currentEngine()
{ {
return DebuggerPlugin::instance()->currentEngine(); return debuggerCore()->currentEngine();
} }
static RegisterHandler *currentHandler() static RegisterHandler *currentHandler()
+4 -9
View File
@@ -31,8 +31,8 @@
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggercore.h"
#include "debuggerengine.h" #include "debuggerengine.h"
#include "debuggerplugin.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
@@ -54,14 +54,9 @@
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
static DebuggerPlugin *plugin()
{
return DebuggerPlugin::instance();
}
static DebuggerEngine *currentEngine() static DebuggerEngine *currentEngine()
{ {
return DebuggerPlugin::instance()->currentEngine(); return debuggerCore()->currentEngine();
} }
SourceFilesWindow::SourceFilesWindow(QWidget *parent) SourceFilesWindow::SourceFilesWindow(QWidget *parent)
@@ -86,7 +81,7 @@ SourceFilesWindow::SourceFilesWindow(QWidget *parent)
void SourceFilesWindow::sourceFileActivated(const QModelIndex &index) void SourceFilesWindow::sourceFileActivated(const QModelIndex &index)
{ {
plugin()->gotoLocation(index.data().toString()); debuggerCore()->gotoLocation(index.data().toString());
} }
void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev) void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
@@ -120,7 +115,7 @@ void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
if (act == act1) if (act == act1)
currentEngine()->reloadSourceFiles(); currentEngine()->reloadSourceFiles();
else if (act == act2) else if (act == act2)
plugin()->gotoLocation(name); debuggerCore()->gotoLocation(name);
} }
} // namespace Internal } // namespace Internal
+2 -2
View File
@@ -33,8 +33,8 @@
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggeragents.h" #include "debuggeragents.h"
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggercore.h"
#include "debuggerengine.h" #include "debuggerengine.h"
#include "debuggerplugin.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
@@ -52,7 +52,7 @@ namespace Internal {
static DebuggerEngine *currentEngine() static DebuggerEngine *currentEngine()
{ {
return DebuggerPlugin::instance()->currentEngine(); return debuggerCore()->currentEngine();
} }
StackWindow::StackWindow(QWidget *parent) StackWindow::StackWindow(QWidget *parent)
+2 -2
View File
@@ -32,8 +32,8 @@
#include "threadshandler.h" #include "threadshandler.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggercore.h"
#include "debuggerengine.h" #include "debuggerengine.h"
#include "debuggerplugin.h"
#include <utils/savedaction.h> #include <utils/savedaction.h>
@@ -66,7 +66,7 @@ ThreadsWindow::ThreadsWindow(QWidget *parent)
void ThreadsWindow::rowActivated(const QModelIndex &index) void ThreadsWindow::rowActivated(const QModelIndex &index)
{ {
DebuggerPlugin::instance()->currentEngine()->selectThread(index.row()); debuggerCore()->currentEngine()->selectThread(index.row());
} }
void ThreadsWindow::contextMenuEvent(QContextMenuEvent *ev) void ThreadsWindow::contextMenuEvent(QContextMenuEvent *ev)
+6 -8
View File
@@ -32,8 +32,8 @@
#include "breakhandler.h" #include "breakhandler.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggeragents.h" #include "debuggeragents.h"
#include "debuggercore.h"
#include "debuggerengine.h" #include "debuggerengine.h"
#include "debuggerplugin.h"
#include "watchutils.h" #include "watchutils.h"
#if USE_MODEL_TEST #if USE_MODEL_TEST
@@ -75,8 +75,6 @@ static const QString strNotInScope =
static int watcherCounter = 0; static int watcherCounter = 0;
static int generationCounter = 0; static int generationCounter = 0;
static DebuggerPlugin *plugin() { return DebuggerPlugin::instance(); }
QHash<QByteArray, int> WatchHandler::m_watcherNames; QHash<QByteArray, int> WatchHandler::m_watcherNames;
QHash<QByteArray, int> WatchHandler::m_typeFormats; QHash<QByteArray, int> WatchHandler::m_typeFormats;
@@ -1461,7 +1459,7 @@ void WatchHandler::removeWatchExpression(const QString &exp0)
void WatchHandler::updateWatchersWindow() void WatchHandler::updateWatchersWindow()
{ {
// Force show/hide of watchers and return view. // Force show/hide of watchers and return view.
plugin()->updateState(m_engine); debuggerCore()->updateState(m_engine);
} }
void WatchHandler::updateWatchers() void WatchHandler::updateWatchers()
@@ -1480,7 +1478,7 @@ void WatchHandler::updateWatchers()
void WatchHandler::loadWatchers() void WatchHandler::loadWatchers()
{ {
QVariant value = plugin()->sessionValue("Watchers"); QVariant value = debuggerCore()->sessionValue("Watchers");
foreach (const QString &exp, value.toStringList()) foreach (const QString &exp, value.toStringList())
m_watcherNames[exp.toLatin1()] = watcherCounter++; m_watcherNames[exp.toLatin1()] = watcherCounter++;
@@ -1504,12 +1502,12 @@ QStringList WatchHandler::watchedExpressions()
void WatchHandler::saveWatchers() void WatchHandler::saveWatchers()
{ {
//qDebug() << "SAVE WATCHERS: " << m_watchers; //qDebug() << "SAVE WATCHERS: " << m_watchers;
plugin()->setSessionValue("Watchers", QVariant(watchedExpressions())); debuggerCore()->setSessionValue("Watchers", QVariant(watchedExpressions()));
} }
void WatchHandler::loadTypeFormats() void WatchHandler::loadTypeFormats()
{ {
QVariant value = plugin()->sessionValue("DefaultFormats"); QVariant value = debuggerCore()->sessionValue("DefaultFormats");
QMap<QString, QVariant> typeFormats = value.toMap(); QMap<QString, QVariant> typeFormats = value.toMap();
QMapIterator<QString, QVariant> it(typeFormats); QMapIterator<QString, QVariant> it(typeFormats);
while (it.hasNext()) { while (it.hasNext()) {
@@ -1532,7 +1530,7 @@ void WatchHandler::saveTypeFormats()
typeFormats.insert(key, format); typeFormats.insert(key, format);
} }
} }
plugin()->setSessionValue("DefaultFormats", QVariant(typeFormats)); debuggerCore()->setSessionValue("DefaultFormats", QVariant(typeFormats));
} }
void WatchHandler::saveSessionData() void WatchHandler::saveSessionData()
+4 -9
View File
@@ -33,9 +33,9 @@
#include "debuggeragents.h" #include "debuggeragents.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggercore.h"
#include "debuggerdialogs.h" #include "debuggerdialogs.h"
#include "debuggerengine.h" #include "debuggerengine.h"
#include "debuggerplugin.h"
#include "watchdelegatewidgets.h" #include "watchdelegatewidgets.h"
#include "watchhandler.h" #include "watchhandler.h"
@@ -63,14 +63,9 @@
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
static DebuggerPlugin *plugin()
{
return DebuggerPlugin::instance();
}
static DebuggerEngine *currentEngine() static DebuggerEngine *currentEngine()
{ {
return DebuggerPlugin::instance()->currentEngine(); return debuggerCore()->currentEngine();
} }
class WatchDelegate : public QItemDelegate class WatchDelegate : public QItemDelegate
@@ -461,14 +456,14 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
} else if (act == actRemoveWatchExpression) { } else if (act == actRemoveWatchExpression) {
removeWatchExpression(exp); removeWatchExpression(exp);
} else if (act == actClearCodeModelSnapshot) { } else if (act == actClearCodeModelSnapshot) {
plugin()->clearCppCodeModelSnapshot(); debuggerCore()->clearCppCodeModelSnapshot();
} else if (act == clearTypeFormatAction) { } else if (act == clearTypeFormatAction) {
setModelData(LocalsTypeFormatRole, -1, mi1); setModelData(LocalsTypeFormatRole, -1, mi1);
} else if (act == clearIndividualFormatAction) { } else if (act == clearIndividualFormatAction) {
setModelData(LocalsIndividualFormatRole, -1, mi1); setModelData(LocalsIndividualFormatRole, -1, mi1);
} else if (act == actShowInEditor) { } else if (act == actShowInEditor) {
QString contents = handler->editorContents(); QString contents = handler->editorContents();
plugin()->openTextEditor(tr("Locals & Watchers"), contents); debuggerCore()->openTextEditor(tr("Locals & Watchers"), contents);
} else { } else {
for (int i = 0; i != typeFormatActions.size(); ++i) { for (int i = 0; i != typeFormatActions.size(); ++i) {
if (act == typeFormatActions.at(i)) if (act == typeFormatActions.at(i))
@@ -463,7 +463,7 @@ void InspectorUi::reloadQmlViewer()
void InspectorUi::setSimpleDockWidgetArrangement(const Debugger::DebuggerLanguages &activeLanguages) void InspectorUi::setSimpleDockWidgetArrangement(const Debugger::DebuggerLanguages &activeLanguages)
{ {
Debugger::DebuggerUISwitcher *uiSwitcher = Debugger::DebuggerUISwitcher::instance(); Debugger::DebuggerUISwitcher *uiSwitcher = Debugger::DebuggerPlugin::uiSwitcher();
Utils::FancyMainWindow *mw = uiSwitcher->mainWindow(); Utils::FancyMainWindow *mw = uiSwitcher->mainWindow();
mw->setTrackingEnabled(false); mw->setTrackingEnabled(false);
@@ -592,7 +592,7 @@ bool InspectorUi::addQuotesForData(const QVariant &value) const
void InspectorUi::setupDockWidgets() void InspectorUi::setupDockWidgets()
{ {
Debugger::DebuggerUISwitcher *uiSwitcher = Debugger::DebuggerUISwitcher::instance(); Debugger::DebuggerUISwitcher *uiSwitcher = Debugger::DebuggerPlugin::uiSwitcher();
m_toolbar->createActions(Core::Context(Debugger::Constants::C_QMLDEBUGGER)); m_toolbar->createActions(Core::Context(Debugger::Constants::C_QMLDEBUGGER));
m_toolbar->setObjectName("QmlInspectorToolbar"); m_toolbar->setObjectName("QmlInspectorToolbar");
@@ -144,23 +144,22 @@ QmlRunControlFactory::~QmlRunControlFactory()
bool QmlRunControlFactory::canRun(RunConfiguration *runConfiguration, bool QmlRunControlFactory::canRun(RunConfiguration *runConfiguration,
const QString &mode) const const QString &mode) const
{ {
QmlProjectRunConfiguration *config = qobject_cast<QmlProjectRunConfiguration*>(runConfiguration); QmlProjectRunConfiguration *config =
if (mode == ProjectExplorer::Constants::RUNMODE) { qobject_cast<QmlProjectRunConfiguration*>(runConfiguration);
if (mode == ProjectExplorer::Constants::RUNMODE)
return config != 0 && !config->viewerPath().isEmpty(); return config != 0 && !config->viewerPath().isEmpty();
} else {
bool qmlDebugSupportInstalled = Debugger::DebuggerUISwitcher::instance()->supportedLanguages()
& Debugger::QmlLanguage;
if (config && qmlDebugSupportInstalled) { bool qmlDebugSupportInstalled =
if (!config->observerPath().isEmpty()) { Debugger::DebuggerPlugin::isActiveDebugLanguage(Debugger::QmlLanguage);
return true;
}
if (config->qtVersion() && Qt4ProjectManager::QmlObserverTool::canBuild(config->qtVersion())) { if (config && qmlDebugSupportInstalled) {
return true; if (!config->observerPath().isEmpty())
} else { return true;
return false;
} if (config->qtVersion() && Qt4ProjectManager::QmlObserverTool::canBuild(config->qtVersion())) {
return true;
} else {
return false;
} }
} }
@@ -212,8 +211,7 @@ ProjectExplorer::RunControl *QmlRunControlFactory::createDebugRunControl(QmlProj
return 0; return 0;
} }
Debugger::DebuggerRunControl *debuggerRunControl = Debugger::DebuggerPlugin::createDebugger(params, runConfig); return Debugger::DebuggerPlugin::createDebugger(params, runConfig);
return debuggerRunControl;
} }
void QmlRunControlFactory::showQmlObserverToolWarning() { void QmlRunControlFactory::showQmlObserverToolWarning() {
@@ -44,7 +44,6 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <debugger/debuggerplugin.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QtGui/QMainWindow> #include <QtGui/QMainWindow>
@@ -122,11 +121,10 @@ S60Manager::S60Manager(QObject *parent)
addAutoReleasedObject(new S60CreatePackageStepFactory); addAutoReleasedObject(new S60CreatePackageStepFactory);
addAutoReleasedObject(new S60DeployStepFactory); addAutoReleasedObject(new S60DeployStepFactory);
if (Debugger::DebuggerPlugin::instance()) addAutoReleasedObject(new RunControlFactory<S60DeviceDebugRunControl,
addAutoReleasedObject(new RunControlFactory<S60DeviceDebugRunControl, S60DeviceRunConfiguration>
S60DeviceRunConfiguration> (QLatin1String(ProjectExplorer::Constants::DEBUGMODE),
(QLatin1String(ProjectExplorer::Constants::DEBUGMODE), tr("Debug on Device"), parent));
tr("Debug on Device"), parent));
updateQtVersions(); updateQtVersions();
connect(m_devices, SIGNAL(qtVersionsChanged()), connect(m_devices, SIGNAL(qtVersionsChanged()),
this, SLOT(updateQtVersions())); this, SLOT(updateQtVersions()));