Commit c27d8b72 authored by hjk's avatar hjk

debugger: move DisassemblerViewAgent from plugin to manager

parent 524604fe
......@@ -30,6 +30,7 @@
#include "debuggermanager.h"
#include "debuggeractions.h"
#include "debuggeragents.h"
#include "debuggerrunner.h"
#include "debuggerconstants.h"
#include "idebuggerengine.h"
......@@ -296,6 +297,7 @@ struct DebuggerManagerPrivate {
bool m_busy;
QTimer *m_statusTimer;
QString m_lastPermanentStatusMessage;
DisassemblerViewAgent *m_disassemblerViewAgent;
IDebuggerEngine *m_engine;
DebuggerState m_state;
......@@ -303,10 +305,11 @@ struct DebuggerManagerPrivate {
DebuggerManager *DebuggerManagerPrivate::instance = 0;
DebuggerManagerPrivate::DebuggerManagerPrivate() :
m_startParameters(new DebuggerStartParameters),
m_inferiorPid(0)
DebuggerManagerPrivate::DebuggerManagerPrivate()
: m_startParameters(new DebuggerStartParameters)
{
m_inferiorPid = 0;
m_disassemblerViewAgent = 0;
}
DebuggerManager::DebuggerManager() : d(new DebuggerManagerPrivate)
......@@ -1338,17 +1341,30 @@ void DebuggerManager::resetLocation()
void DebuggerManager::gotoLocation(const Debugger::Internal::StackFrame &frame, bool setMarker)
{
// connected to the plugin
emit gotoLocationRequested(frame, setMarker);
if (theDebuggerBoolSetting(OperateByInstruction) || !frame.isUsable()) {
if (!d->m_disassemblerViewAgent)
d->m_disassemblerViewAgent = new DisassemblerViewAgent(this);
d->m_disassemblerViewAgent->setFrame(frame);
if (setMarker)
resetLocation();
} else {
static QString lastFile;
static int lastLine;
if (frame.line != lastLine || frame.file != lastFile) {
lastLine = frame.line;
lastFile = frame.file;
// Connected to the plugin.
emit gotoLocationRequested(lastFile, lastLine, setMarker);
}
}
}
void DebuggerManager::fileOpen(const QString &fileName)
{
// connected to the plugin
StackFrame frame;
frame.file = fileName;
frame.line = -1;
emit gotoLocationRequested(frame, false);
gotoLocation(frame, false);
}
void DebuggerManager::operateByInstructionTriggered()
......
......@@ -297,7 +297,7 @@ signals:
void debugModeRequested();
void previousModeRequested();
void statusMessageRequested(const QString &msg, int timeout); // -1 for 'forever'
void gotoLocationRequested(const Debugger::Internal::StackFrame &frame, bool setLocationMarker);
void gotoLocationRequested(const QString &file, int line, bool setLocationMarker);
void resetLocationRequested();
void currentTextEditorRequested(QString *fileName, int *lineNumber, QObject **ob);
void sessionValueRequested(const QString &name, QVariant *value);
......
......@@ -31,12 +31,10 @@
#include "breakhandler.h"
#include "debuggeractions.h"
#include "debuggeragents.h"
#include "debuggerdialogs.h"
#include "debuggerconstants.h"
#include "debuggermanager.h"
#include "debuggerrunner.h"
#include "stackframe.h"
#include "debuggerstringutils.h"
#include "ui_commonoptionspage.h"
......@@ -420,7 +418,6 @@ DebuggerPlugin::DebuggerPlugin()
: m_manager(0),
m_debugMode(0),
m_locationMark(0),
m_disassemblerViewAgent(0),
m_gdbRunningContext(0),
m_cmdLineEnabledEngines(AllEngineTypes),
m_cmdLineAttachPid(0),
......@@ -888,8 +885,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
connect(m_manager, SIGNAL(resetLocationRequested()),
this, SLOT(resetLocation()));
connect(m_manager, SIGNAL(gotoLocationRequested(Debugger::Internal::StackFrame,bool)),
this, SLOT(gotoLocation(Debugger::Internal::StackFrame,bool)));
connect(m_manager, SIGNAL(gotoLocationRequested(QString,int,bool)),
this, SLOT(gotoLocation(QString,int,bool)));
connect(m_manager, SIGNAL(stateChanged(int)),
this, SLOT(handleStateChanged(int)));
connect(m_manager, SIGNAL(previousModeRequested()),
......@@ -1091,26 +1088,12 @@ void DebuggerPlugin::resetLocation()
m_locationMark = 0;
}
void DebuggerPlugin::gotoLocation(const Debugger::Internal::StackFrame &frame, bool setMarker)
void DebuggerPlugin::gotoLocation(const QString &file, int line, bool setMarker)
{
if (theDebuggerBoolSetting(OperateByInstruction) || !frame.isUsable()) {
if (!m_disassemblerViewAgent)
m_disassemblerViewAgent = new DisassemblerViewAgent(m_manager);
m_disassemblerViewAgent->setFrame(frame);
if (setMarker)
resetLocation();
} else {
static QString lastFile;
static int lastLine;
if (frame.line != lastLine || frame.file != lastFile) {
lastLine = frame.line;
lastFile = frame.file;
TextEditor::BaseTextEditor::openEditorAt(frame.file, frame.line);
if (setMarker) {
resetLocation();
m_locationMark = new LocationMark(frame.file, frame.line);
}
}
TextEditor::BaseTextEditor::openEditorAt(file, line);
if (setMarker) {
resetLocation();
m_locationMark = new LocationMark(file, line);
}
}
......
......@@ -62,8 +62,6 @@ namespace Internal {
class BreakpointData;
class DebuggerRunControlFactory;
class DebugMode;
class DisassemblerViewAgent;
struct StackFrame;
class DebuggerPlugin : public ExtensionSystem::IPlugin
{
......@@ -97,7 +95,7 @@ private slots:
int lineNumber, QMenu *menu);
void resetLocation();
void gotoLocation(const Debugger::Internal::StackFrame &frame, bool setMarker);
void gotoLocation(const QString &file, int line, bool setMarker);
void breakpointSetRemoveMarginActionTriggered();
void breakpointEnableDisableMarginActionTriggered();
......@@ -131,7 +129,6 @@ private:
QString m_previousMode;
TextEditor::BaseTextMark *m_locationMark;
DisassemblerViewAgent *m_disassemblerViewAgent;
int m_gdbRunningContext;
unsigned m_cmdLineEnabledEngines;
quint64 m_cmdLineAttachPid;
......
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