From eea8e932f3c3ca9157d961d57c80c5f297dff5c8 Mon Sep 17 00:00:00 2001 From: hjk <hjk@theqtcompany.com> Date: Fri, 17 Apr 2015 11:19:58 +0200 Subject: [PATCH] Debugger: Fix jump to file/line breakpoint from disassembler Triggered by double-clicking a normal source file+line breakpoint while looking at some disassembly: We want to jump to the original source file in that case. Change-Id: Ia6eddcaf27e4160c7a989ab757315f5314f65d1e Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> --- src/plugins/debugger/breakhandler.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index ee60ba1062f..2334e452bea 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -33,11 +33,18 @@ #include "debuggeractions.h" #include "debuggercore.h" #include "debuggerengine.h" +#include "debuggerinternalconstants.h" #include "debuggerstringutils.h" #include "simplifytype.h" +#include <coreplugin/coreconstants.h> +#include <coreplugin/coreplugin.h> +#include <coreplugin/editormanager/editormanager.h> +#include <coreplugin/idocument.h> + #include <extensionsystem/invoker.h> #include <texteditor/textmark.h> +#include <texteditor/texteditor.h> #include <utils/hostosinfo.h> #include <utils/qtcassert.h> #include <utils/fileutils.h> @@ -50,6 +57,7 @@ #include <QDir> #include <QDebug> +using namespace Core; using namespace Utils; namespace Debugger { @@ -1171,10 +1179,15 @@ void BreakHandler::timerEvent(QTimerEvent *event) void Breakpoint::gotoLocation() const { if (DebuggerEngine *engine = currentEngine()) { - if (b->m_params.type == BreakpointByAddress) + if (b->m_params.type == BreakpointByAddress) { engine->gotoLocation(b->m_params.address); - else - engine->gotoLocation(Location(b->markerFileName(), b->markerLineNumber(), false)); + } else { + // Don't use gotoLocation as this ends up in disassembly + // if OperateByInstruction is on. + const QString file = QDir::cleanPath(b->markerFileName()); + IEditor *editor = EditorManager::openEditor(file); + editor->gotoLine(b->markerLineNumber(), 0); + } } } -- GitLab