diff options
| author | Brian Potchik <brian@vector35.com> | 2020-12-23 23:42:40 -0500 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2020-12-23 23:42:40 -0500 |
| commit | fd3764d12e880aceec30ee00efbd7ebe6925f0e1 (patch) | |
| tree | faa1373dc72c53c84e77b0cff3f07c5ca90d0e33 /ui | |
| parent | d27bf51d4b7c2170d00dca7cce97c7526c866868 (diff) | |
Add ViewLocation navigation API.
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/disassemblyview.h | 2 | ||||
| -rw-r--r-- | ui/flowgraphwidget.h | 2 | ||||
| -rw-r--r-- | ui/viewframe.h | 10 |
3 files changed, 10 insertions, 4 deletions
diff --git a/ui/disassemblyview.h b/ui/disassemblyview.h index 8066c056..5b772868 100644 --- a/ui/disassemblyview.h +++ b/ui/disassemblyview.h @@ -40,7 +40,7 @@ public: virtual bool navigate(uint64_t pos) override; virtual bool navigateToFunction(FunctionRef func, uint64_t pos) override; - virtual bool navigateToFunctionIndex(FunctionRef func, size_t index) override; + virtual bool navigateToViewLocation(const ViewLocation& viewLocation) override; virtual HistoryEntry* getHistoryEntry() override; virtual void navigateToHistoryEntry(HistoryEntry* entry) override; diff --git a/ui/flowgraphwidget.h b/ui/flowgraphwidget.h index 7a2d6add..7b6fc036 100644 --- a/ui/flowgraphwidget.h +++ b/ui/flowgraphwidget.h @@ -217,7 +217,7 @@ public: virtual void setSelectionOffsets(BNAddressRange range) override; virtual bool navigate(uint64_t pos) override; virtual bool navigateToFunction(FunctionRef func, uint64_t pos) override; - virtual bool navigateToFunctionIndex(FunctionRef func, size_t index) override; + virtual bool navigateToViewLocation(const ViewLocation& viewLocation) override; bool navigateWithHistoryEntry(uint64_t addr, FlowGraphHistoryEntry* entry); bool navigateWithHistoryEntry(FunctionRef func, uint64_t addr, FlowGraphHistoryEntry* entry); void setNavigationTarget(View* target) { m_navigationTarget = target; } diff --git a/ui/viewframe.h b/ui/viewframe.h index b7d28fab..9b619676 100644 --- a/ui/viewframe.h +++ b/ui/viewframe.h @@ -79,6 +79,7 @@ public: virtual bool navigate(uint64_t offset) = 0; virtual bool navigateToFunction(FunctionRef func, uint64_t offset); virtual bool goToReference(FunctionRef func, uint64_t source, uint64_t target); + virtual bool navigateToViewLocation(const ViewLocation& viewLocation) { return false; } bool isBinaryDataNavigable() { return m_binaryDataNavigable; } void setBinaryDataNavigable(bool navigable) { m_binaryDataNavigable = navigable; } @@ -128,7 +129,6 @@ public: virtual BNFunctionGraphType getILViewType() { return NormalFunctionGraph; } virtual void setILViewType(BNFunctionGraphType ilViewType) { } virtual size_t getCurrentILInstructionIndex() { return BN_INVALID_EXPR; } - virtual bool navigateToFunctionIndex(FunctionRef func, size_t index) { return false; } virtual QFont getFont() = 0; DisassemblySettingsRef getDisassemblySettings(); @@ -161,6 +161,7 @@ class BINARYNINJAUIAPI ViewLocation { bool m_valid = false; QString m_viewType; + FunctionRef m_function = nullptr; uint64_t m_offset = 0; BNFunctionGraphType m_ilViewType = NormalFunctionGraph; size_t m_instrIndex = BN_INVALID_EXPR; @@ -172,17 +173,21 @@ public: m_viewType(viewType), m_offset(offset), m_ilViewType(ilViewType) { } ViewLocation(const QString& viewType, uint64_t offset, BNFunctionGraphType ilViewType, size_t instrIndex) : m_valid(true), m_viewType(viewType), m_offset(offset), m_ilViewType(ilViewType), m_instrIndex(instrIndex) { } + ViewLocation(FunctionRef function, uint64_t offset, BNFunctionGraphType ilViewType, size_t instrIndex) : m_valid(true), + m_function(function), m_offset(offset), m_ilViewType(ilViewType), m_instrIndex(instrIndex) { } bool isValid() const { return m_valid; } QString getViewType() const { return m_viewType; } uint64_t getOffset() const { return m_offset; } BNFunctionGraphType getILViewType() const { return m_ilViewType; } size_t getInstrIndex() const { return m_instrIndex; } + FunctionRef getFunction() const { return m_function; } void setViewType(QString& viewType) { m_viewType = viewType; } void setOffset(uint64_t offset) { m_offset = offset; } void setILViewType(BNFunctionGraphType ilViewType) { m_ilViewType = ilViewType; } void setInstrIndex(uint64_t index) { m_instrIndex = index; } + void setFunction(FunctionRef function) { m_function = function; } bool operator==(const ViewLocation& other) const { @@ -190,7 +195,8 @@ public: (m_viewType == other.m_viewType) && (m_offset == other.m_offset) && (m_ilViewType == other.m_ilViewType) && - (m_instrIndex == other.m_instrIndex); + (m_instrIndex == other.m_instrIndex) && + (m_function == other.m_function); } bool operator!=(const ViewLocation& other) const { return !((*this) == other); } }; |
