forked from qt-creator/qt-creator
Debugger/BinEditor: Standardize interface
Change-Id: I4acf6bc7648e57c564e86023176ae3905a293a99 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -32,25 +32,23 @@
|
||||
#include <QPointer>
|
||||
#include <QColor>
|
||||
|
||||
namespace Core { class IEditor; }
|
||||
|
||||
namespace ProjectExplorer { class Abi; }
|
||||
namespace BinEditor { class EditorService; }
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
class DebuggerEngine;
|
||||
class MemoryView;
|
||||
|
||||
class MemoryMarkup
|
||||
{
|
||||
public:
|
||||
MemoryMarkup(quint64 a = 0, quint64 l = 0, QColor c = Qt::yellow,
|
||||
const QString &tt = QString()) :
|
||||
address(a), length(l), color(c), toolTip(tt) {}
|
||||
MemoryMarkup() {}
|
||||
MemoryMarkup(quint64 address, quint64 length, QColor c, const QString &tt)
|
||||
: address(address), length(length), color(c), toolTip(tt)
|
||||
{}
|
||||
|
||||
quint64 address;
|
||||
quint64 length;
|
||||
quint64 address = 0;
|
||||
quint64 length = 0;
|
||||
QColor color;
|
||||
QString toolTip;
|
||||
};
|
||||
@@ -58,13 +56,13 @@ public:
|
||||
class MemoryViewSetupData
|
||||
{
|
||||
public:
|
||||
MemoryViewSetupData() : parent(0), startAddress(0), flags(0) {}
|
||||
MemoryViewSetupData() {}
|
||||
|
||||
QWidget *parent;
|
||||
quint64 startAddress;
|
||||
QWidget *parent = nullptr;
|
||||
quint64 startAddress = 0;
|
||||
QString registerName;
|
||||
unsigned flags;
|
||||
QList<Internal::MemoryMarkup> markup;
|
||||
unsigned flags = 0;
|
||||
QList<MemoryMarkup> markup;
|
||||
QPoint pos;
|
||||
QString title;
|
||||
};
|
||||
@@ -74,44 +72,30 @@ class MemoryAgent : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MemoryAgent(DebuggerEngine *engine);
|
||||
MemoryAgent(const MemoryViewSetupData &data, DebuggerEngine *engine);
|
||||
~MemoryAgent();
|
||||
|
||||
enum { BinBlockSize = 1024 };
|
||||
enum { DataRange = 1024 * 1024 };
|
||||
|
||||
bool hasVisibleEditor() const;
|
||||
|
||||
static bool isBigEndian(const ProjectExplorer::Abi &a);
|
||||
static quint64 readInferiorPointerValue(const unsigned char *data, const ProjectExplorer::Abi &a);
|
||||
|
||||
public slots:
|
||||
// Called by engine to create a new view.
|
||||
void createBinEditor(const MemoryViewSetupData &data);
|
||||
void createBinEditor(quint64 startAddr);
|
||||
// Called by engine to create a tooltip.
|
||||
void addLazyData(QObject *editorToken, quint64 addr, const QByteArray &data);
|
||||
// On stack frame completed and on request.
|
||||
void setAddress(quint64 address);
|
||||
void setMarkup(const QList<MemoryMarkup> &ml);
|
||||
void updateContents();
|
||||
void closeEditors();
|
||||
void closeViews();
|
||||
void handleDebuggerFinished();
|
||||
void addData(quint64 address, const QByteArray &data);
|
||||
void setFinished();
|
||||
bool isUsable();
|
||||
|
||||
private slots:
|
||||
void fetchLazyData(quint64 block);
|
||||
void provideNewRange(quint64 address);
|
||||
void handleDataChanged(quint64 address, const QByteArray &data);
|
||||
void handleWatchpointRequest(quint64 address, uint size);
|
||||
void updateMemoryView(quint64 address, quint64 length);
|
||||
BinEditor::EditorService *service() { return m_service; }
|
||||
|
||||
static bool hasBinEditor();
|
||||
|
||||
private:
|
||||
void connectBinEditorWidget(QWidget *w);
|
||||
bool doCreateBinEditor(const MemoryViewSetupData &data);
|
||||
// The backend, provided by the BinEditor plugin, if loaded.
|
||||
BinEditor::EditorService *m_service = nullptr;
|
||||
|
||||
QList<QPointer<Core::IEditor> > m_editors;
|
||||
QList<QPointer<MemoryView> > m_views;
|
||||
QPointer<DebuggerEngine> m_engine;
|
||||
DebuggerEngine *m_engine = nullptr;
|
||||
int m_flags = 0;
|
||||
};
|
||||
|
||||
QList<MemoryMarkup> registerViewMarkup(quint64 address, const QString ®Name);
|
||||
QString registerViewTitle(const QString ®isterName, quint64 address = 0);
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
Reference in New Issue
Block a user