{
ConstIterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return);
+ DebuggerEngine *engine = debuggerCore()->currentEngine();
if (it->data.type == BreakpointByAddress) {
StackFrame frame;
frame.address = it->data.address;
- DebuggerEngine *engine = debuggerCore()->currentEngine();
if (engine)
engine->gotoLocation(frame, false);
} else {
const QString fileName = it->markerFileName();
const int lineNumber = it->markerLineNumber();
- debuggerCore()->gotoLocation(fileName, lineNumber, false);
+ if (engine)
+ engine->gotoLocation(fileName, lineNumber, false);
}
}
// void runTest(const QString &fileName);
virtual void showMessage(const QString &msg, int channel, int timeout = -1) = 0;
- virtual void gotoLocation(const QString &fileName, int lineNumber = -1,
- bool setMarker = false) = 0;
-
- virtual void resetLocation() = 0;
- virtual void removeLocationMark() = 0;
virtual bool isReverseDebugging() const = 0;
virtual void runControlStarted(DebuggerEngine *engine) = 0;
#include <projectexplorer/toolchaintype.h>
#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
+#include <texteditor/basetextmark.h>
#include <utils/environment.h>
#include <utils/savedaction.h>
}
+///////////////////////////////////////////////////////////////////////
+//
+// LocationMark
+//
+///////////////////////////////////////////////////////////////////////
+
+// Used in "real" editors
+class LocationMark : public TextEditor::BaseTextMark
+{
+public:
+ LocationMark(const QString &fileName, int linenumber)
+ : BaseTextMark(fileName, linenumber)
+ {}
+
+ QIcon icon() const { return debuggerCore()->locationMarkIcon(); }
+ void updateLineNumber(int /*lineNumber*/) {}
+ void updateBlock(const QTextBlock & /*block*/) {}
+ void removedFromEditor() {}
+};
+
+
+
//////////////////////////////////////////////////////////////////////
//
// DebuggerEnginePrivate
m_isSlaveEngine(false),
m_disassemblerViewAgent(engine),
m_memoryViewAgent(engine)
- {}
+ {
+ connect(&m_locationTimer, SIGNAL(timeout()), SLOT(doRemoveLocationMark()));
+ }
~DebuggerEnginePrivate() {}
m_runControl->bringApplicationToForeground(m_inferiorPid);
}
+ void removeLocationMark()
+ {
+ m_locationTimer.setSingleShot(true);
+ m_locationTimer.start(80);
+ }
+
+ void doRemoveLocationMark()
+ {
+ m_locationTimer.stop();
+ m_locationMark.reset();
+ }
+
public:
DebuggerState state() const { return m_state; }
bool m_isSlaveEngine;
DisassemblerViewAgent m_disassemblerViewAgent;
MemoryViewAgent m_memoryViewAgent;
+ QScopedPointer<TextEditor::BaseTextMark> m_locationMark;
+ QTimer m_locationTimer;
};
void DebuggerEngine::resetLocation()
{
d->m_disassemblerViewAgent.resetLocation();
- debuggerCore()->removeLocationMark();
+ d->removeLocationMark();
}
-void DebuggerEngine::gotoLocation(const QString &fileName, int lineNumber, bool setMarker)
+void DebuggerEngine::gotoLocation(const QString &file, int line, bool setMarker)
{
- debuggerCore()->gotoLocation(fileName, lineNumber, setMarker);
+ // CDB might hit on breakpoints while shutting down.
+ //if (m_shuttingDown)
+ // return;
+
+ d->doRemoveLocationMark();
+
+ bool newEditor = false;
+ ITextEditor *editor =
+ BaseTextEditor::openEditorAt(file, line, 0, QString(),
+ EditorManager::IgnoreNavigationHistory, &newEditor);
+ if (!editor)
+ return;
+ if (newEditor)
+ editor->setProperty(Constants::OPENED_BY_DEBUGGER, true);
+ if (setMarker)
+ d->m_locationMark.reset(new LocationMark(file, line));
}
void DebuggerEngine::gotoLocation(const StackFrame &frame, bool setMarker)
if (debuggerCore()->boolSetting(OperateByInstruction) || !frame.isUsable())
d->m_disassemblerViewAgent.setFrame(frame, true, setMarker);
else
- debuggerCore()->gotoLocation(frame.file, frame.line, setMarker);
+ gotoLocation(frame.file, frame.line, setMarker);
}
// Called from RunControl.
void handleCommand(int role, const QVariant &value);
// Convenience
- Q_SLOT void showMessage(const QString &msg, int channel = LogDebug, int timeout = -1) const;
+ Q_SLOT void showMessage(const QString &msg, int channel = LogDebug,
+ int timeout = -1) const;
Q_SLOT void showStatusMessage(const QString &msg, int timeout = -1) const;
void resetLocation();
- virtual void gotoLocation(const QString &fileName, int lineNumber, bool setMarker);
+ virtual void gotoLocation(const QString &fileName, int lineNumber = -1,
+ bool setMarker = false);
virtual void gotoLocation(const Internal::StackFrame &frame, bool setMarker);
virtual void quitDebugger(); // called by DebuggerRunControl
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <texteditor/basetexteditor.h>
-#include <texteditor/basetextmark.h>
#include <texteditor/fontsettings.h>
#include <texteditor/texteditorsettings.h>
///////////////////////////////////////////////////////////////////////
//
-// LocationMark
-//
-///////////////////////////////////////////////////////////////////////
-
-// Used in "real" editors
-class LocationMark : public TextEditor::BaseTextMark
-{
-public:
- LocationMark(const QString &fileName, int linenumber)
- : BaseTextMark(fileName, linenumber)
- {}
-
- QIcon icon() const { return debuggerCore()->locationMarkIcon(); }
- void updateLineNumber(int /*lineNumber*/) {}
- void updateBlock(const QTextBlock & /*block*/) {}
- void removedFromEditor() {}
-};
-
-
-///////////////////////////////////////////////////////////////////////
-//
// CommonOptionsPage
//
///////////////////////////////////////////////////////////////////////
void updateWatchersWindow();
void onCurrentProjectChanged(ProjectExplorer::Project *project);
- void gotoLocation(const QString &file, int line, bool setMarker);
-
void clearStatusMessage();
void sessionLoaded();
void handleExecDetach()
{
- resetLocation();
+ currentEngine()->resetLocation();
currentEngine()->detachDebugger();
}
void handleExecContinue()
{
- resetLocation();
+ currentEngine()->resetLocation();
currentEngine()->continueInferior();
}
void handleExecInterrupt()
{
- resetLocation();
+ currentEngine()->resetLocation();
currentEngine()->requestInterruptInferior();
}
void handleExecReset()
{
- resetLocation();
+ currentEngine()->resetLocation();
currentEngine()->notifyEngineIll(); // FIXME: Check.
}
void handleExecStep()
{
- resetLocation();
+ currentEngine()->resetLocation();
if (boolSetting(OperateByInstruction))
currentEngine()->executeStepI();
else
void handleExecNext()
{
- resetLocation();
+ currentEngine()->resetLocation();
if (boolSetting(OperateByInstruction))
currentEngine()->executeNextI();
else
void handleExecStepOut()
{
- resetLocation();
+ currentEngine()->resetLocation();
currentEngine()->executeStepOut();
}
void handleExecReturn()
{
- resetLocation();
+ currentEngine()->resetLocation();
currentEngine()->executeReturn();
}
void handleExecJumpToLine()
{
//removeTooltip();
- resetLocation();
+ currentEngine()->resetLocation();
QString fileName;
int lineNumber;
if (currentTextEditorPosition(&fileName, &lineNumber))
void handleExecRunToLine()
{
//removeTooltip();
- resetLocation();
+ currentEngine()->resetLocation();
QString fileName;
int lineNumber;
if (currentTextEditorPosition(&fileName, &lineNumber))
void handleExecRunToFunction()
{
- resetLocation();
+ currentEngine()->resetLocation();
ITextEditor *textEditor = currentTextEditor();
QTC_ASSERT(textEditor, return);
QPlainTextEdit *ed = qobject_cast<QPlainTextEdit*>(textEditor->widget());
return m_mainWindow->activeDebugLanguages() & lang;
}
- void resetLocation();
- void removeLocationMark();
- void doRemoveLocationMark();
QVariant sessionValue(const QString &name);
void setSessionValue(const QString &name, const QVariant &value);
QIcon locationMarkIcon() const { return m_locationMarkIcon; }
DebuggerRunControlFactory *m_debuggerRunControlFactory;
QString m_previousMode;
- QScopedPointer<TextEditor::BaseTextMark> m_locationMark;
Context m_continuableContext;
Context m_interruptibleContext;
Context m_undisturbableContext;
bool m_busy;
QTimer m_statusTimer;
- QTimer m_locationTimer;
QString m_lastPermanentStatusMessage;
mutable CPlusPlus::Snapshot m_codeModelSnapshot;
if (m_currentEngine == engine)
return;
+ if (m_currentEngine)
+ m_currentEngine->resetLocation();
m_currentEngine = engine;
m_localsWindow->setModel(engine->localsModel());
m_debugAction->setEnabled(pe->canRun(project, Constants::DEBUGMODE));
}
-void DebuggerPluginPrivate::gotoLocation(const QString &file, int line, bool setMarker)
-{
- // CDB might hit on breakpoints while shutting down.
- if (m_shuttingDown)
- return;
-
- doRemoveLocationMark();
-
- bool newEditor = false;
- ITextEditor *editor =
- BaseTextEditor::openEditorAt(file, line, 0, QString(),
- EditorManager::IgnoreNavigationHistory, &newEditor);
- if (!editor)
- return;
- if (newEditor)
- editor->setProperty(Constants::OPENED_BY_DEBUGGER, true);
- if (setMarker)
- m_locationMark.reset(new LocationMark(file, line));
-}
-
void DebuggerPluginPrivate::onModeChanged(IMode *mode)
{
// FIXME: This one gets always called, even if switching between modes
return m_codeModelSnapshot;
}
-void DebuggerPluginPrivate::resetLocation()
-{
- currentEngine()->resetLocation();
-}
-
-void DebuggerPluginPrivate::removeLocationMark()
-{
- m_locationTimer.setSingleShot(true);
- m_locationTimer.start(80);
-}
-
-void DebuggerPluginPrivate::doRemoveLocationMark()
-{
- m_locationTimer.stop();
- m_locationMark.reset();
-}
-
void DebuggerPluginPrivate::setSessionValue(const QString &name, const QVariant &value)
{
QTC_ASSERT(sessionManager(), return);
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
SLOT(onCurrentProjectChanged(ProjectExplorer::Project*)));
- connect(&m_locationTimer,
- SIGNAL(timeout()),
- SLOT(doRemoveLocationMark()));
-
QTC_ASSERT(m_coreSettings, /**/);
m_watchersWindow->setVisible(false);
m_returnWindow->setVisible(false);
void ModulesWindow::moduleActivated(const QModelIndex &index)
{
- debuggerCore()->gotoLocation(index.data().toString());
+ DebuggerEngine *engine = debuggerCore()->currentEngine();
+ QTC_ASSERT(engine, return);
+ engine->gotoLocation(index.data().toString());
}
void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
name = index.data().toString();
DebuggerEngine *engine = debuggerCore()->currentEngine();
+ QTC_ASSERT(engine, return);
const bool enabled = engine->debuggerActionsEnabled();
const unsigned capabilities = engine->debuggerCapabilities();
else if (act == actLoadSymbolsForModule)
engine->loadSymbols(name);
else if (act == actEditFile)
- debuggerCore()->gotoLocation(name);
+ engine->gotoLocation(name);
else if (act == actShowModuleSymbols)
engine->requestModuleSymbols(name);
}
void SourceFilesWindow::sourceFileActivated(const QModelIndex &index)
{
- debuggerCore()->gotoLocation(index.data().toString());
+ DebuggerEngine *engine = currentEngine();
+ QTC_ASSERT(engine, return);
+ engine->gotoLocation(index.data().toString());
}
void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
{
+ DebuggerEngine *engine = currentEngine();
+ QTC_ASSERT(engine, return);
QModelIndex index = indexAt(ev->pos());
index = index.sibling(index.row(), 0);
QString name = index.data().toString();
- bool engineActionsEnabled = currentEngine()->debuggerActionsEnabled();
+ bool engineActionsEnabled = engine->debuggerActionsEnabled();
QMenu menu;
QAction *act1 = new QAction(tr("Reload Data"), &menu);
QAction *act = menu.exec(ev->globalPos());
if (act == act1)
- currentEngine()->reloadSourceFiles();
+ engine->reloadSourceFiles();
else if (act == act2)
- debuggerCore()->gotoLocation(name);
+ engine->gotoLocation(name);
}
} // namespace Internal