From 1dbcc4f54433ec1e4ccaf3d658256d619cd610cc Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Sat, 23 Jan 2021 17:04:33 -0500 Subject: Add ViewLocation navigatioon support to LinearView. --- ui/linearview.h | 6 ++++-- ui/viewframe.h | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ui/linearview.h b/ui/linearview.h index b7365e47..2d03248c 100644 --- a/ui/linearview.h +++ b/ui/linearview.h @@ -26,6 +26,7 @@ struct BINARYNINJAUIAPI LinearViewCursorPosition FunctionRef function; BasicBlockRef block; uint64_t address; + size_t instrIndex; BinaryNinja::Ref cursor; size_t lineIndex; size_t tokenIndex; @@ -160,6 +161,7 @@ class BINARYNINJAUIAPI LinearView: public QAbstractScrollArea, public View, publ void updateCache(); void refreshAtCurrentLocation(bool cursorFixup = false); bool navigateToAddress(uint64_t addr, bool center, bool updateHighlight, bool navByRef = false); + bool navigateToLine(uint64_t offset, size_t instrIndex, bool center, bool updateHighlight, bool navByRef = false); bool navigateToGotoLabel(uint64_t label); void scrollLines(int count); @@ -299,8 +301,8 @@ public: virtual BasicBlockRef getCurrentBasicBlock() override; virtual ArchitectureRef getCurrentArchitecture() override; virtual size_t getCurrentILInstructionIndex() override; - virtual bool navigate(uint64_t pos) override; - virtual bool navigateToFunction(FunctionRef func, uint64_t pos) override; + virtual bool navigate(uint64_t offset) override; + virtual bool navigateToFunction(FunctionRef func, uint64_t offset) override; virtual bool navigateToViewLocation(const ViewLocation& viewLocation) override; virtual std::string getNavigationMode() override; diff --git a/ui/viewframe.h b/ui/viewframe.h index 47c8cf68..995b46b2 100644 --- a/ui/viewframe.h +++ b/ui/viewframe.h @@ -175,6 +175,8 @@ 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(const QString& viewType, FunctionRef function, uint64_t offset, BNFunctionGraphType ilViewType, size_t instrIndex) : + m_valid(true), m_viewType(viewType), m_function(function), 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) { } @@ -185,7 +187,7 @@ public: size_t getInstrIndex() const { return m_instrIndex; } FunctionRef getFunction() const { return m_function; } - void setViewType(QString& viewType) { m_viewType = viewType; } + void setViewType(const 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; } -- cgit v1.3.1