Commit 790648b9 authored by hjk's avatar hjk

debugger: make freshly inserted watchers immediately visble

Even if no engine is running.
parent 191b7e0b
......@@ -77,6 +77,7 @@ public:
virtual QVariant configValue(const QString &name) const = 0;
virtual void setConfigValue(const QString &name, const QVariant &value) = 0;
virtual void updateState(DebuggerEngine *engine) = 0;
virtual void updateWatchersWindow() = 0;
virtual void showQtDumperLibraryWarning(const QString &details) = 0;
virtual QIcon locationMarkIcon() const = 0;
virtual const CPlusPlus::Snapshot &cppCodeModelSnapshot() const = 0;
......
......@@ -1030,6 +1030,7 @@ public slots:
DebuggerState state() const { return m_state; }
void updateState(DebuggerEngine *engine);
void updateWatchersWindow();
void onCurrentProjectChanged(ProjectExplorer::Project *project);
void gotoLocation(const QString &file, int line, bool setMarker);
......@@ -1919,8 +1920,8 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
SLOT(aboutToSaveSession()));
connect(sessionManager(), SIGNAL(aboutToUnloadSession()),
SLOT(aboutToUnloadSession()));
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(updateRunActions()),
this, SLOT(updateDebugActions()));
connect(ProjectExplorerPlugin::instance(), SIGNAL(updateRunActions()),
SLOT(updateDebugActions()));
// EditorManager
QObject *editorManager = core->editorManager();
......@@ -2039,12 +2040,10 @@ void DebuggerPluginPrivate::languagesChanged(const DebuggerLanguages &languages)
void DebuggerPluginPrivate::debugProject()
{
Project *pro = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject();
if (!pro)
return;
ProjectExplorer::ProjectExplorerPlugin::instance()->runProject(pro, Constants::DEBUGMODE);
}
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
if (Project *pro = pe->startupProject())
pe->runProject(pro, Constants::DEBUGMODE);
}
void DebuggerPluginPrivate::startExternalApplication()
{
......@@ -2073,7 +2072,7 @@ void DebuggerPluginPrivate::startExternalApplication()
sp.processArgs = dlg.executableArguments();
// Fixme: 1 of 3 testing hacks.
if (sp.processArgs.startsWith(__("@tcf@ ")) || sp.processArgs.startsWith(__("@sym@ ")))
sp.toolChainType = ProjectExplorer::ToolChain_RVCT_ARMV5;
sp.toolChainType = ToolChain_RVCT_ARMV5;
if (RunControl *rc = m_debuggerRunControlFactory->create(sp))
......@@ -2145,7 +2144,7 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
{
const QString connectionKey = _("CdbRemoteConnection");
DebuggerStartParameters sp;
sp.toolChainType = ProjectExplorer::ToolChain_MSVC;
sp.toolChainType = ToolChain_MSVC;
sp.startMode = AttachToRemote;
StartRemoteCdbDialog dlg(mainWindow());
QString previousConnection = configValue(connectionKey).toString();
......@@ -2211,7 +2210,7 @@ void DebuggerPluginPrivate::startRemoteApplication()
sp.displayName = dlg.localExecutable();
sp.debuggerCommand = dlg.debugger(); // Override toolchain-detection.
if (!sp.debuggerCommand.isEmpty())
sp.toolChainType = ProjectExplorer::ToolChain_INVALID;
sp.toolChainType = ToolChain_INVALID;
sp.startMode = AttachToRemote;
sp.useServerStartScript = dlg.useServerStartScript();
sp.serverStartScript = dlg.serverStartScript();
......@@ -2678,6 +2677,14 @@ void DebuggerPluginPrivate::setInitialState()
//emit m_plugin->stateChanged(m_state);
}
void DebuggerPluginPrivate::updateWatchersWindow()
{
m_watchersWindow->setVisible(
m_watchersWindow->model()->rowCount(QModelIndex()) > 0);
m_returnWindow->setVisible(
m_returnWindow->model()->rowCount(QModelIndex()) > 0);
}
void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
{
QTC_ASSERT(engine, return);
......@@ -2687,10 +2694,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_threadBox->setCurrentIndex(engine->threadsHandler()->currentThread());
m_watchersWindow->setVisible(
m_watchersWindow->model()->rowCount(QModelIndex()) > 0);
m_returnWindow->setVisible(
m_returnWindow->model()->rowCount(QModelIndex()) > 0);
updateWatchersWindow();
//m_plugin->showMessage(QString("PLUGIN SET STATE: ")
// + DebuggerEngine::stateName(engine->state()), LogStatus);
......@@ -2820,9 +2824,9 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
void DebuggerPluginPrivate::updateDebugActions()
{
ProjectExplorer::ProjectExplorerPlugin *peplugin = ProjectExplorer::ProjectExplorerPlugin::instance();
Project *project = peplugin->startupProject();
m_debugAction->setEnabled(peplugin->canRun(project, Constants::DEBUGMODE));
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
Project *project = pe->startupProject();
m_debugAction->setEnabled(pe->canRun(project, Constants::DEBUGMODE));
}
void DebuggerPluginPrivate::gotoLocation(const QString &file, int line, bool setMarker)
......
......@@ -56,7 +56,7 @@
#include <ctype.h>
#include <utils/qtcassert.h>
// creates debug output for accesses to the model
// Creates debug output for accesses to the model.
//#define DEBUG_MODEL 1
#if DEBUG_MODEL
......@@ -1333,7 +1333,6 @@ QByteArray WatchHandler::watcherName(const QByteArray &exp)
void WatchHandler::watchExpression(const QString &exp)
{
QTC_ASSERT(m_engine, return);
QTC_ASSERT(m_engine->debuggerCapabilities() & AddWatcherCapability, return);
// Do not insert multiple placeholders.
if (exp.isEmpty() && m_watcherNames.contains(QByteArray()))
return;
......@@ -1346,10 +1345,16 @@ void WatchHandler::watchExpression(const QString &exp)
if (exp.isEmpty())
data.setAllUnneeded();
data.iname = watcherName(data.exp);
if (m_engine->isSynchronous())
if (m_engine->state() == DebuggerNotReady) {
data.setAllUnneeded();
data.setValue(" ");
data.setHasChildren(false);
insertData(data);
} else if (m_engine->isSynchronous()) {
m_engine->updateWatchData(data);
else
} else {
insertData(data);
}
updateWatchersWindow();
saveWatchers();
emitAllChanged();
......@@ -1468,7 +1473,7 @@ void WatchHandler::removeWatchExpression(const QString &exp0)
void WatchHandler::updateWatchersWindow()
{
// Force show/hide of watchers and return view.
debuggerCore()->updateState(m_engine);
debuggerCore()->updateWatchersWindow();
}
void WatchHandler::updateWatchers()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment