diff options
author | hjk <qtc-committer@nokia.com> | 2010-06-22 18:30:18 +0200 |
---|---|---|
committer | hjk <qtc-committer@nokia.com> | 2010-06-23 11:06:01 +0200 |
commit | e6590ff5988739d89dad652d08ca5b2ae66603af (patch) | |
tree | 7efdb61f30089d6cefb543f73591cc96b0a5b7d6 /src | |
parent | d00ece77d7336abbbc2ce55ee724006b4a053448 (diff) | |
download | qt-creator-e6590ff5988739d89dad652d08ca5b2ae66603af.tar.gz |
debugger: fix addToWatchWindow
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/debugger/debuggerengine.cpp | 48 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerengine.h | 1 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerplugin.cpp | 50 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerplugin.h | 4 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerrunner.cpp | 1 |
5 files changed, 31 insertions, 73 deletions
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 9943b7d993..51929a406f 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -44,6 +44,7 @@ #include "stackhandler.h" #include "threadshandler.h" #include "watchhandler.h" +#include "watchutils.h" #include <coreplugin/icore.h> #include <coreplugin/editormanager/editormanager.h> @@ -312,8 +313,7 @@ void DebuggerEngine::handleCommand(int role, const QVariant &value) break; case RequestExecWatchRole: - //exec(); - QTC_ASSERT(false, /* FIXME ABC */); + addToWatchWindow(); break; case RequestExecExitRole: @@ -552,22 +552,6 @@ void DebuggerEngine::breakByFunction(const QString &functionName) attemptBreakpointSynchronization(); } -/* -void DebuggerEngine::loadSessionData() -{ - QTC_ASSERT(isSessionEngine(), return); - m_breakHandler.loadSessionData(); - m_watchHandler.loadSessionData(); -} - -void DebuggerEngine::saveSessionData() -{ - QTC_ASSERT(isSessionEngine(), return); - m_breakHandler.saveSessionData(); - m_watchHandler.saveSessionData(); -} -*/ - void DebuggerEngine::resetLocation() { d->m_disassemblerViewAgent.resetLocation(); @@ -689,6 +673,34 @@ void DebuggerEngine::executeJumpToLine() executeJumpToLine(fileName, lineNumber); } +void DebuggerEngine::addToWatchWindow() +{ + // Requires a selection, but that's the only case we want anyway. + EditorManager *editorManager = EditorManager::instance(); + if (!editorManager) + return; + IEditor *editor = editorManager->currentEditor(); + if (!editor) + return; + ITextEditor *textEditor = qobject_cast<ITextEditor*>(editor); + if (!textEditor) + return; + QTextCursor tc; + QPlainTextEdit *ptEdit = qobject_cast<QPlainTextEdit*>(editor->widget()); + if (ptEdit) + tc = ptEdit->textCursor(); + QString exp; + if (tc.hasSelection()) { + exp = tc.selectedText(); + } else { + int line, column; + exp = cppExpressionAt(textEditor, tc.position(), &line, &column); + } + + if (!exp.isEmpty()) + watchHandler()->watchExpression(exp); +} + // Called from RunControl. void DebuggerEngine::handleFinished() { diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 11c45619d7..ad71727363 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -259,6 +259,7 @@ private: void executeRunToLine(); void executeRunToFunction(); void executeJumpToLine(); + void addToWatchWindow(); DebuggerEnginePrivate *d; }; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 71d4a552ac..597d661ff9 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -51,7 +51,6 @@ #include "threadswindow.h" #include "watchwindow.h" -//#include "sessiondata.h" #include "watchutils.h" #include "breakhandler.h" #include "stackhandler.h" // FIXME @@ -2478,55 +2477,6 @@ void DebuggerPlugin::aboutToShutdown() // d->m_engine->shutdown(); } -void DebuggerPlugin::addToWatchWindow() -{ - using namespace Core; - using namespace TextEditor; - // Requires a selection, but that's the only case we want anyway. - EditorManager *editorManager = EditorManager::instance(); - if (!editorManager) - return; - IEditor *editor = editorManager->currentEditor(); - if (!editor) - return; - ITextEditor *textEditor = qobject_cast<ITextEditor*>(editor); - if (!textEditor) - return; - QTextCursor tc; - QPlainTextEdit *ptEdit = qobject_cast<QPlainTextEdit*>(editor->widget()); - if (ptEdit) - tc = ptEdit->textCursor(); - QString exp; - if (tc.hasSelection()) { - exp = tc.selectedText(); - } else { - int line, column; - exp = cppExpressionAt(textEditor, tc.position(), &line, &column); - } - -// FIXME: -// if (!exp.isEmpty()) -// d->m_watchHandler->watchExpression(exp); -} - -void DebuggerPlugin::setBusyCursor(bool busy) -{ - d->setBusyCursor(busy); -} - -/* -void DebuggerPlugin::gotoLocation(const StackFrame &frame, bool setMarker) -{ - if (theDebuggerBoolSetting(OperateByInstruction) || !frame.isUsable()) { - if (setMarker) - d->m_plugin->resetLocation(); - d->m_disassemblerViewAgent->setFrame(frame); - } else { - d->m_plugin->gotoLocation(frame.file, frame.line, setMarker); - } -} -*/ - void DebuggerPlugin::showMessage(const QString &msg, int channel, int timeout) { //qDebug() << "PLUGIN OUTPUT: " << channel << msg; diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 8107be8036..1a50245973 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -105,11 +105,7 @@ public: public slots: void exitDebugger(); // FIXME: remove - void setBusyCursor(bool on); - void addToWatchWindow(); // FIXME: use - void clearCppCodeModelSnapshot(); - void ensureLogVisible(); void updateWatchersWindow(bool showWatchers, bool showReturn); diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index e6d7bf36ec..61afe22be2 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -462,7 +462,6 @@ void DebuggerRunControl::start() .arg(toolChainName(sp.toolChainType)), LogStatus); showMessage(DebuggerSettings::instance()->dump(), LogDebug); - plugin()->setBusyCursor(false); engine()->startDebugger(this); } |