procinterrupt.h \
registerhandler.h \
registerwindow.h \
- sessionengine.h \
snapshothandler.h \
snapshotwindow.h \
sourcefileshandler.h \
procinterrupt.cpp \
registerhandler.cpp \
registerwindow.cpp \
- sessionengine.cpp \
snapshothandler.cpp \
snapshotwindow.cpp \
sourcefileshandler.cpp \
executeDebuggerCommand(value.toString());
break;
-/*
- case RequestToggleBreakpointRole: {
- QList<QVariant> list = value.toList();
- QTC_ASSERT(list.size() == 2, break);
- const QString fileName = list.at(0).toString();
- const int lineNumber = list.at(1).toInt();
- breakHandler()->toggleBreakpoint(fileName, lineNumber);
- break;
- }
-*/
-
case RequestToolTipByExpressionRole: {
QList<QVariant> list = value.toList();
QTC_ASSERT(list.size() == 3, break);
void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
{
- if (!isSessionEngine() && !isSlaveEngine()) {
+ if (!isSlaveEngine()) {
d->m_progress.setProgressRange(0, 1000);
Core::FutureProgress *fp = Core::ICore::instance()->progressManager()
->addTask(d->m_progress.future(),
QTC_ASSERT(runControl, notifyEngineSetupFailed(); return);
QTC_ASSERT(!d->m_runControl, notifyEngineSetupFailed(); return);
- DebuggerEngine *sessionTemplate = plugin()->sessionTemplate();
- QTC_ASSERT(sessionTemplate, notifyEngineSetupFailed(); return);
- QTC_ASSERT(sessionTemplate != this, notifyEngineSetupFailed(); return);
-
- watchHandler()->initializeFromTemplate(sessionTemplate->watchHandler());
-
d->m_runControl = runControl;
d->m_inferiorPid = d->m_startParameters.attachPID > 0
threadsHandler()->removeAll();
watchHandler()->cleanup();
- DebuggerEngine *sessionTemplate = plugin()->sessionTemplate();
- QTC_ASSERT(sessionTemplate != this, /**/);
- breakHandler()->storeToTemplate(sessionTemplate->breakHandler());
- watchHandler()->storeToTemplate(sessionTemplate->watchHandler());
-
d->m_progress.setProgressValue(1000);
d->m_progress.reportFinished();
}
bool DebuggerEngine::isActive() const
{
- return d->m_isActive && !isSessionEngine();
+ return d->m_isActive;
}
void DebuggerEngine::setActive(bool on)
{
}
-bool DebuggerEngine::isSessionEngine() const
-{
- return false;
-}
-
void DebuggerEngine::watchPoint(const QPoint &)
{
}
virtual void updateWatchData(const Internal::WatchData &data,
const Internal::WatchUpdateFlags & flags = Internal::WatchUpdateFlags());
void startDebugger(DebuggerRunControl *runControl);
- virtual bool isSessionEngine() const;
virtual void watchPoint(const QPoint &);
virtual void fetchMemory(Internal::MemoryViewAgent *, QObject *,
#include "stackwindow.h"
#include "sourcefileswindow.h"
#include "threadswindow.h"
+#include "watchhandler.h"
#include "watchwindow.h"
-#include "sessionengine.h"
#include "snapshothandler.h"
#include "threadshandler.h"
bool initialize(const QStringList &arguments, QString *errorMessage);
void notifyCurrentEngine(int role, const QVariant &value = QVariant());
void connectEngine(DebuggerEngine *engine, bool notify = true);
- void disconnectEngine() { connectEngine(m_sessionEngine); }
+ void disconnectEngine() { connectEngine(0); }
public slots:
void updateWatchersHeader(int section, int, int newSize)
}
}
+ void synchronizeWatchers()
+ {
+ for (int i = 0, n = m_snapshotHandler->size(); i != n; ++i) {
+ if (DebuggerRunControl *runControl = m_snapshotHandler->at(i)) {
+ DebuggerEngine *engine = runControl->engine();
+ engine->watchHandler()->synchronizeWatchers();
+ }
+ }
+ }
+
void onAction();
void setSimpleDockWidgetArrangement(Debugger::DebuggerLanguages activeLanguages);
LogWindow *m_logWindow;
ScriptConsole *m_scriptConsoleWindow;
- SessionEngine *m_sessionEngine;
-
bool m_busy;
QTimer m_statusTimer;
QString m_lastPermanentStatusMessage;
SnapshotHandler *m_snapshotHandler;
bool m_shuttingDown;
+ DebuggerEngine *m_currentEngine;
};
-DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) :
- m_shuttingDown(false)
+DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin)
{
m_plugin = plugin;
+ m_shuttingDown = false;
m_statusLabel = 0;
m_threadBox = 0;
m_logWindow = 0;
m_scriptConsoleWindow = 0;
- m_sessionEngine = 0;
m_debugMode = 0;
m_continuableContext = Core::Context(0);
m_uiSwitcher = 0;
m_state = DebuggerNotReady;
m_snapshotHandler = 0;
+ m_currentEngine = 0;
}
bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *errorMessage)
SLOT(synchronizeBreakpoints()));
m_breakWindow = new BreakWindow;
m_breakWindow->setObjectName(QLatin1String("CppDebugBreakpoints"));
+ m_breakWindow->setModel(m_breakHandler->model());
+
//m_consoleWindow = new ConsoleWindow;
//m_consoleWindow->setObjectName(QLatin1String("CppDebugConsole"));
m_modulesWindow = new ModulesWindow;
connect(m_scriptConsoleWindow, SIGNAL(expressionEntered(QString)),
SLOT(scriptExpressionEntered(QString)));
- // Session related data
- m_sessionEngine = new SessionEngine;
-
// Snapshot
m_snapshotHandler = new SnapshotHandler;
m_snapshotWindow->setModel(m_snapshotHandler->model());
SLOT(languagesChanged(Debugger::DebuggerLanguages)));
setInitialState();
- connectEngine(m_sessionEngine, false);
+ connectEngine(0, false);
connect(sessionManager(),
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
void DebuggerPluginPrivate::notifyCurrentEngine(int role, const QVariant &value)
{
- QTC_ASSERT(m_commandWindow && m_commandWindow->model(), return);
- m_commandWindow->model()->setData(QModelIndex(), value, role);
+ QTC_ASSERT(m_commandWindow, return);
+ if (m_commandWindow->model())
+ m_commandWindow->model()->setData(QModelIndex(), value, role);
}
void DebuggerPluginPrivate::attachExternalApplication()
void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine, bool notify)
{
- const QAbstractItemModel *oldCommandModel = m_commandWindow->model();
- if (oldCommandModel == engine->commandModel()) {
- // qDebug("RECONNECTING ENGINE %s", qPrintable(engine->objectName()));
+ if (m_currentEngine == engine)
return;
- }
-
- if (notify)
- notifyCurrentEngine(RequestActivationRole, false);
- // qDebug("CONNECTING ENGINE %s (OLD ENGINE: %s)", qPrintable(engine->objectName()),
- // (oldCommandModel ? qPrintable(oldCommandModel->objectName()) : ""));
-
- m_breakWindow->setModel(m_breakHandler->model());
- m_commandWindow->setModel(engine->commandModel());
- m_localsWindow->setModel(engine->localsModel());
- m_modulesWindow->setModel(engine->modulesModel());
- m_registerWindow->setModel(engine->registerModel());
- m_returnWindow->setModel(engine->returnModel());
- m_sourceFilesWindow->setModel(engine->sourceFilesModel());
- m_stackWindow->setModel(engine->stackModel());
- m_threadsWindow->setModel(engine->threadsModel());
- m_threadBox->setModel(engine->threadsModel());
- m_threadBox->setModelColumn(ThreadData::NameColumn);
- m_watchersWindow->setModel(engine->watchersModel());
- if (notify)
- notifyCurrentEngine(RequestActivationRole, true);
+ if (engine) {
+ if (notify)
+ notifyCurrentEngine(RequestActivationRole, false);
+ m_commandWindow->setModel(engine->commandModel());
+ m_localsWindow->setModel(engine->localsModel());
+ m_modulesWindow->setModel(engine->modulesModel());
+ m_registerWindow->setModel(engine->registerModel());
+ m_returnWindow->setModel(engine->returnModel());
+ m_sourceFilesWindow->setModel(engine->sourceFilesModel());
+ m_stackWindow->setModel(engine->stackModel());
+ m_threadsWindow->setModel(engine->threadsModel());
+ m_threadBox->setModel(engine->threadsModel());
+ m_threadBox->setModelColumn(ThreadData::NameColumn);
+ m_watchersWindow->setModel(engine->watchersModel());
+ if (notify)
+ notifyCurrentEngine(RequestActivationRole, true);
+ } else {
+ m_commandWindow->setModel(0);
+ m_localsWindow->setModel(0);
+ m_modulesWindow->setModel(0);
+ m_registerWindow->setModel(0);
+ m_returnWindow->setModel(0);
+ m_sourceFilesWindow->setModel(0);
+ m_stackWindow->setModel(0);
+ m_threadsWindow->setModel(0);
+ m_threadBox->setModel(0);
+ m_threadBox->setModelColumn(ThreadData::NameColumn);
+ m_watchersWindow->setModel(0);
+ }
}
static void changeFontSize(QWidget *widget, qreal size)
void DebuggerPluginPrivate::sessionLoaded()
{
- m_sessionEngine->loadSessionData();
+ m_breakHandler->loadSessionData();
+ WatchHandler::loadSessionData();
+ synchronizeWatchers();
}
void DebuggerPluginPrivate::aboutToUnloadSession()
void DebuggerPluginPrivate::aboutToSaveSession()
{
- m_sessionEngine->saveSessionData();
+ WatchHandler::saveSessionData();
+ m_breakHandler->saveSessionData();
}
void DebuggerPluginPrivate::executeDebuggerCommand()
DebuggerPlugin::~DebuggerPlugin()
{
- delete d->m_sessionEngine;
- d->m_sessionEngine = 0;
-
theInstance = 0;
delete DebuggerSettings::instance();
return DebuggerUISwitcher::instance()->activeDebugLanguages();
}
-DebuggerEngine *DebuggerPlugin::sessionTemplate()
-{
- return d->m_sessionEngine;
-}
-
bool DebuggerPlugin::isRegisterViewVisible() const
{
return d->m_registerDock->toggleViewAction()->isChecked();
class DebuggerStartParameters;
namespace Internal {
-class DebuggerListener;
class BreakHandler;
}
void runControlFinished(DebuggerRunControl *runControl);
DebuggerLanguages activeLanguages() const;
- // This contains per-session data like breakpoints and watched
- // expression. It serves as a template for new engine instantiations.
- DebuggerEngine *sessionTemplate();
-
QMessageBox *showMessageBox(int icon, const QString &title,
const QString &text, int buttons = 0);
+++ /dev/null
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-**
-**************************************************************************/
-
-#include "sessionengine.h"
-#include "breakhandler.h"
-#include "watchhandler.h"
-
-#include <utils/qtcassert.h>
-
-#include <QtCore/QDebug>
-
-namespace Debugger {
-namespace Internal {
-
-// This class contains data serving as a template for debugger engines
-// started during a session.
-
-SessionEngine::SessionEngine()
- : DebuggerEngine(DebuggerStartParameters())
-{
- setObjectName(QLatin1String("SessionEngine"));
-}
-
-void SessionEngine::executeDebuggerCommand(const QString &command)
-{
- QTC_ASSERT(false, qDebug() << command)
-}
-
-void SessionEngine::loadSessionData()
-{
- breakHandler()->loadSessionData();
- watchHandler()->loadSessionData();
-}
-
-void SessionEngine::saveSessionData()
-{
- watchHandler()->saveSessionData();
- breakHandler()->saveSessionData();
-}
-
-unsigned SessionEngine::debuggerCapabilities() const
-{
- return DebuggerEngine::debuggerCapabilities()
- | AddWatcherCapability
- | BreakOnThrowAndCatchCapability
- | WatchpointCapability;
-}
-
-} // namespace Internal
-} // namespace Debugger
-
+++ /dev/null
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-**
-**************************************************************************/
-
-#ifndef DEBUGGER_SESSIONENGINE_H
-#define DEBUGGER_SESSIONENGINE_H
-
-#include "debuggerengine.h"
-
-namespace Debugger {
-namespace Internal {
-
-// This class contains data serving as a template for debugger engines
-// started during a session.
-
-class SessionEngine : public DebuggerEngine
-{
- Q_OBJECT
-
-public:
- SessionEngine();
-
- virtual void setupEngine() {}
- virtual void setupInferior() {}
- virtual void runEngine() {}
- virtual void shutdownEngine() {}
- virtual void shutdownInferior() {}
- virtual void executeDebuggerCommand(const QString &command);
- virtual unsigned debuggerCapabilities() const;
-
- virtual bool isSessionEngine() const { return true; }
-
- void loadSessionData();
- void saveSessionData();
-};
-
-
-} // namespace Internal
-} // namespace Debugger
-
-#endif // DEBUGGER_SESSIONENGINE_H
#include "snapshothandler.h"
-#include "sessionengine.h"
#include "debuggerconstants.h"
#include "debuggerengine.h"
#include "debuggerrunner.h"
static DebuggerPlugin *plugin() { return DebuggerPlugin::instance(); }
+QHash<QByteArray, int> WatchHandler::m_watcherNames;
+QHash<QByteArray, int> WatchHandler::m_typeFormats;
+
////////////////////////////////////////////////////////////////////
//
// WatchItem
if (exp.isEmpty())
data.setAllUnneeded();
data.iname = watcherName(data.exp);
- if (m_engine->isSynchronous() && !m_engine->isSessionEngine())
+ if (m_engine->isSynchronous())
m_engine->updateWatchData(data);
else
insertData(data);
//qDebug() << "LOAD WATCHERS: " << m_watchers;
}
-QStringList WatchHandler::watchedExpressions() const
+QStringList WatchHandler::watchedExpressions()
{
// Filter out invalid watchers.
QStringList watcherNames;
void WatchHandler::saveSessionData()
{
- QTC_ASSERT(m_engine->isSessionEngine(), return);
saveWatchers();
saveTypeFormats();
}
void WatchHandler::loadSessionData()
{
- QTC_ASSERT(m_engine->isSessionEngine(), return);
loadWatchers();
loadTypeFormats();
+}
+void WatchHandler::synchronizeWatchers()
+{
foreach (const QByteArray &exp, m_watcherNames.keys()) {
WatchData data;
data.iname = watcherName(exp);
data.exp = exp;
insertData(data);
}
- updateWatchersWindow();
}
void WatchHandler::initializeFromTemplate(WatchHandler *other)
void removeData(const QByteArray &iname);
WatchData *findItem(const QByteArray &iname) const;
- void loadSessionData();
- void saveSessionData();
+ static void loadSessionData();
+ static void saveSessionData();
void removeTooltip();
void initializeFromTemplate(WatchHandler *other);
{ return m_expandedINames.contains(iname); }
QSet<QByteArray> expandedINames() const
{ return m_expandedINames; }
- QStringList watchedExpressions() const;
- QHash<QByteArray, int> watcherNames() const
+ static QStringList watchedExpressions();
+ static QHash<QByteArray, int> watcherNames()
{ return m_watcherNames; }
QByteArray expansionRequests() const;
void addTypeFormats(const QByteArray &type, const QStringList &formats);
QByteArray watcherName(const QByteArray &exp);
+ void synchronizeWatchers();
private:
friend class WatchModel;
- void loadWatchers();
- void saveWatchers();
+ static void loadWatchers();
+ static void saveWatchers();
+ static void loadTypeFormats();
+ static void saveTypeFormats();
- void loadTypeFormats();
- void saveTypeFormats();
void setFormat(const QByteArray &type, int format);
void updateWatchersWindow();
void showInEditor();
typedef QMap<QString, QPointer<QObject> > EditHandlers;
EditHandlers m_editHandlers;
- QHash<QByteArray, int> m_watcherNames;
- QHash<QByteArray, int> m_typeFormats;
+ static QHash<QByteArray, int> m_watcherNames;
+ static QHash<QByteArray, int> m_typeFormats;
QHash<QByteArray, int> m_individualFormats; // Indexed by iname.
QHash<QString, QStringList> m_reportedTypeFormats;