diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index 96638cef077a2e902b86827b05a5c962f5e145f6..6c22b15b103a86f781c45fbe83f4f6c5c9cade48 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -46,6 +46,7 @@
 #include "gdb/gdbengine.h" // REMOVE
 #include "registerhandler.h"
 #include "sourcefileshandler.h"
+#include "sourceutils.h"
 #include "stackhandler.h"
 #include "terminal.h"
 #include "threadshandler.h"
@@ -134,28 +135,25 @@ Location::Location(const StackFrame &frame, bool marker)
 }
 
 
-class LocationMark : public TextMark
+LocationMark::LocationMark(DebuggerEngine *engine, const QString &file, int line)
+    : TextMark(file, line, Constants::TEXT_MARK_CATEGORY_LOCATION), m_engine(engine)
 {
-public:
-    LocationMark(DebuggerEngine *engine, const QString &file, int line)
-        : TextMark(file, line, Constants::TEXT_MARK_CATEGORY_LOCATION), m_engine(engine)
-    {}
+    setIcon(Internal::locationMarkIcon());
+    setPriority(TextMark::HighPriority);
+}
 
-private:
-    bool isDraggable() const { return true; }
+bool LocationMark::isDraggable() const
+{
+    return m_engine->hasCapability(JumpToLineCapability);
+}
 
-    void dragToLine(int line)
-    {
-        if (m_engine) {
-            ContextData data;
-            data.fileName = fileName();
-            data.lineNumber = line;
-            m_engine->executeJumpToLine(data);
-        }
+void LocationMark::dragToLine(int line)
+{
+    if (m_engine) {
+        if (BaseTextEditor *textEditor = BaseTextEditor::currentTextEditor())
+            m_engine->executeJumpToLine(getLocationContext(textEditor->textDocument(), line));
     }
-
-    QPointer<DebuggerEngine> m_engine;
-};
+}
 
 //////////////////////////////////////////////////////////////////////
 //
@@ -632,11 +630,8 @@ void DebuggerEngine::gotoLocation(const Location &loc)
     if (newEditor)
         editor->document()->setProperty(Constants::OPENED_BY_DEBUGGER, true);
 
-    if (loc.needsMarker()) {
+    if (loc.needsMarker())
         d->m_locationMark.reset(new LocationMark(this, file, line));
-        d->m_locationMark->setIcon(Internal::locationMarkIcon());
-        d->m_locationMark->setPriority(TextMark::HighPriority);
-    }
 
     //qDebug() << "MEMORY: " << d->m_memoryAgent.hasVisibleEditor();
 }
diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index c830a0ded3589d9a4ff3de3746dbf7773d54c652..e6625fc1dc33ba9dd72f9e970dc716ab333eccb2 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -36,6 +36,7 @@
 #include "debuggerstartparameters.h"
 
 #include <projectexplorer/devicesupport/idevice.h>
+#include <texteditor/textmark.h>
 
 #include <QObject>
 #include <QProcess>
@@ -446,6 +447,18 @@ private:
     DebuggerEnginePrivate *d;
 };
 
+class LocationMark : public TextEditor::TextMark
+{
+public:
+    LocationMark(DebuggerEngine *engine, const QString &file, int line);
+
+private:
+    bool isDraggable() const;
+    void dragToLine(int line);
+
+    QPointer<DebuggerEngine> m_engine;
+};
+
 DebuggerEngine *createEngine(DebuggerEngineType et, const DebuggerRunParameters &rp, QStringList *errors);
 
 DebuggerRunControl *createAndScheduleRun(const DebuggerRunParameters &rp, const ProjectExplorer::Kit *kit);
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index a79bef2e8c56b41c424f18e985fb2f3999376959..95049cb16f895aecd2af1df15009fe86a6e8874f 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -552,25 +552,6 @@ static Kit *findUniversalCdbKit()
     return KitManager::find(cdbMatcher());
 }
 
-static bool currentTextEditorPosition(ContextData *data)
-{
-    BaseTextEditor *textEditor = BaseTextEditor::currentTextEditor();
-    if (!textEditor)
-        return false;
-    const TextDocument *document = textEditor->textDocument();
-    QTC_ASSERT(document, return false);
-    data->fileName = document->filePath().toString();
-    if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) {
-        int lineNumber = textEditor->currentLine();
-        QString line = textEditor->textDocument()->plainText()
-            .section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
-        data->address = DisassemblerLine::addressFromDisassemblyLine(line);
-    } else {
-        data->lineNumber = textEditor->currentLine();
-    }
-    return true;
-}
-
 ///////////////////////////////////////////////////////////////////////
 //
 // DebuggerPluginPrivate
@@ -848,17 +829,17 @@ public slots:
     void handleExecJumpToLine()
     {
         currentEngine()->resetLocation();
-        ContextData data;
-        if (currentTextEditorPosition(&data))
-            currentEngine()->executeJumpToLine(data);
+        if (BaseTextEditor *textEditor = BaseTextEditor::currentTextEditor())
+            currentEngine()->executeJumpToLine(getLocationContext(textEditor->textDocument(),
+                                                                  textEditor->currentLine()));
     }
 
     void handleExecRunToLine()
     {
         currentEngine()->resetLocation();
-        ContextData data;
-        if (currentTextEditorPosition(&data))
-            currentEngine()->executeRunToLine(data);
+        if (BaseTextEditor *textEditor = BaseTextEditor::currentTextEditor())
+            currentEngine()->executeRunToLine(getLocationContext(textEditor->textDocument(),
+                                                                 textEditor->currentLine()));
     }
 
     void handleExecRunToSelectedFunction()
diff --git a/src/plugins/debugger/disassembleragent.cpp b/src/plugins/debugger/disassembleragent.cpp
index a7df1f215eca5b66b7ed3b51044200fecf4ba47f..e6f5632ff7cf5227f416b5bf5c0718816fc731e4 100644
--- a/src/plugins/debugger/disassembleragent.cpp
+++ b/src/plugins/debugger/disassembleragent.cpp
@@ -98,7 +98,7 @@ typedef QPair<FrameKey, DisassemblerLines> CacheEntry;
 class DisassemblerAgentPrivate
 {
 public:
-    DisassemblerAgentPrivate();
+    DisassemblerAgentPrivate(DebuggerEngine *engine);
     ~DisassemblerAgentPrivate();
     void configureMimeType();
     DisassemblerLines contentsAtCurrentLocation() const;
@@ -107,22 +107,20 @@ public:
     QPointer<TextDocument> document;
     Location location;
     QPointer<DebuggerEngine> engine;
-    TextMark locationMark;
+    LocationMark locationMark;
     QList<TextMark *> breakpointMarks;
     QList<CacheEntry> cache;
     QString mimeType;
     bool resetLocationScheduled;
 };
 
-DisassemblerAgentPrivate::DisassemblerAgentPrivate()
+DisassemblerAgentPrivate::DisassemblerAgentPrivate(DebuggerEngine *engine)
   : document(0),
-    locationMark(QString(), 0, Constants::TEXT_MARK_CATEGORY_LOCATION),
+    engine(engine),
+    locationMark(engine, QString(), 0),
     mimeType(_("text/x-qtcreator-generic-asm")),
     resetLocationScheduled(false)
-{
-    locationMark.setIcon(Internal::locationMarkIcon());
-    locationMark.setPriority(TextMark::HighPriority);
-}
+{}
 
 DisassemblerAgentPrivate::~DisassemblerAgentPrivate()
 {
@@ -157,10 +155,8 @@ DisassemblerLines DisassemblerAgentPrivate::contentsAtCurrentLocation() const
 */
 
 DisassemblerAgent::DisassemblerAgent(DebuggerEngine *engine)
-    : QObject(0), d(new DisassemblerAgentPrivate)
-{
-    d->engine = engine;
-}
+    : d(new DisassemblerAgentPrivate(engine))
+{}
 
 DisassemblerAgent::~DisassemblerAgent()
 {
diff --git a/src/plugins/debugger/sourceutils.cpp b/src/plugins/debugger/sourceutils.cpp
index e70696ccc556a04be398a81299261689c9f63188..5da06340b40495ba46bbbe65267fee052288a713 100644
--- a/src/plugins/debugger/sourceutils.cpp
+++ b/src/plugins/debugger/sourceutils.cpp
@@ -30,6 +30,9 @@
 
 #include "sourceutils.h"
 
+#include "debuggerinternalconstants.h"
+#include "debuggerengine.h"
+#include "disassemblerlines.h"
 #include "watchdata.h"
 #include "watchutils.h"
 
@@ -333,5 +336,19 @@ QString fixCppExpression(const QString &expIn)
     return removeObviousSideEffects(exp);
 }
 
+ContextData getLocationContext(TextDocument *document, int lineNumber)
+{
+    ContextData data;
+    QTC_ASSERT(document, return data);
+    data.fileName = document->filePath().toString();
+    if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) {
+        QString line = document->plainText().section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
+        data.address = DisassemblerLine::addressFromDisassemblyLine(line);
+    } else {
+        data.lineNumber = lineNumber;
+    }
+    return data;
+}
+
 } // namespace Internal
 } // namespace Debugger
diff --git a/src/plugins/debugger/sourceutils.h b/src/plugins/debugger/sourceutils.h
index 9d3d50be97eb99b4406ed422ff43199fef624e56..862ecfc9eb24f862d860d2b1d39cd6b775b6c19f 100644
--- a/src/plugins/debugger/sourceutils.h
+++ b/src/plugins/debugger/sourceutils.h
@@ -33,12 +33,18 @@
 
 #include <QString>
 
-namespace TextEditor { class TextEditorWidget; }
+namespace TextEditor {
+class TextDocument;
+class TextEditorWidget;
+}
+
 namespace CPlusPlus { class Snapshot; }
 
 namespace Debugger {
 namespace Internal {
 
+class ContextData;
+
 // Editor tooltip support
 QString cppExpressionAt(TextEditor::TextEditorWidget *editorWidget, int pos,
                         int *line, int *column, QString *function = 0,
@@ -53,6 +59,8 @@ bool getUninitializedVariables(const CPlusPlus::Snapshot &snapshot,
    const QString &function, const QString &file, int line,
    QStringList *uninitializedVariables);
 
+ContextData getLocationContext(TextEditor::TextDocument *document, int lineNumber);
+
 } // namespace Internal
 } // namespace Debugger