Skip to content

Commit a805c3c

Browse files
committed
Add IL instruction index navigation support to flowgraph view types.
1 parent df48a9e commit a805c3c

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

ui/disassemblyview.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ friend class DisassemblyFunctionHeader;
4040

4141
virtual bool navigate(uint64_t pos) override;
4242
virtual bool navigateToFunction(FunctionRef func, uint64_t pos) override;
43+
virtual bool navigateToFunctionIndex(FunctionRef func, size_t index) override;
4344

4445
virtual HistoryEntry* getHistoryEntry() override;
4546
virtual void navigateToHistoryEntry(HistoryEntry* entry) override;

ui/flowgraphwidget.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class BINARYNINJAUIAPI FlowGraphWidget: public QAbstractScrollArea, public View,
113113
uint64_t m_addrAfterLayout;
114114
bool m_pendingXrefNavigation, m_xrefNavigation;
115115
uint64_t m_xrefTarget;
116+
size_t m_indexAfterlayout;
116117

117118
InstructionEdit* m_instrEdit;
118119

@@ -163,8 +164,8 @@ class BINARYNINJAUIAPI FlowGraphWidget: public QAbstractScrollArea, public View,
163164
void navigateToAddress(uint64_t addr);
164165
void navigateToGotoLabel(uint64_t label);
165166

166-
void setGraphInternal(FlowGraphRef graph, FlowGraphHistoryEntry* entry, bool useAddr, uint64_t addr, bool notify,
167-
bool recenterWithPreviousGraph);
167+
void setGraphInternal(FlowGraphRef graph, FlowGraphHistoryEntry* entry, bool useAddr, uint64_t addr,
168+
bool notify, bool recenterWithPreviousGraph, size_t index = BN_INVALID_EXPR);
168169

169170
void up(bool selecting, size_t count = 1);
170171
void down(bool selecting, size_t count = 1);
@@ -198,6 +199,7 @@ class BINARYNINJAUIAPI FlowGraphWidget: public QAbstractScrollArea, public View,
198199

199200
void setGraph(FlowGraphRef graph);
200201
void setGraph(FlowGraphRef graph, uint64_t addr);
202+
void setGraphAtIndex(FlowGraphRef graph, size_t index);
201203
void setGraph(FlowGraphRef graph, FlowGraphHistoryEntry* entry);
202204
void setRelatedGraph(FlowGraphRef graph);
203205
void setRelatedGraph(FlowGraphRef graph, uint64_t addr);
@@ -211,6 +213,7 @@ class BINARYNINJAUIAPI FlowGraphWidget: public QAbstractScrollArea, public View,
211213
virtual void setSelectionOffsets(BNAddressRange range) override;
212214
virtual bool navigate(uint64_t pos) override;
213215
virtual bool navigateToFunction(FunctionRef func, uint64_t pos) override;
216+
virtual bool navigateToFunctionIndex(FunctionRef func, size_t index) override;
214217
bool navigateWithHistoryEntry(uint64_t addr, FlowGraphHistoryEntry* entry);
215218
bool navigateWithHistoryEntry(FunctionRef func, uint64_t addr, FlowGraphHistoryEntry* entry);
216219
void setNavigationTarget(View* target) { m_navigationTarget = target; }
@@ -258,6 +261,7 @@ class BINARYNINJAUIAPI FlowGraphWidget: public QAbstractScrollArea, public View,
258261
void paintEdge(QPainter& p, const FlowGraphNodeRef& node, const BinaryNinja::FlowGraphEdge& edge);
259262

260263
void showAddress(uint64_t addr, bool select = false);
264+
void showIndex(size_t index);
261265
void showTopNode();
262266
void showNode(FlowGraphNodeRef node);
263267
void showLineInNode(FlowGraphNodeRef node, size_t lineIndex);

ui/linearview.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ private Q_SLOTS:
294294
virtual FunctionRef getCurrentFunction() override;
295295
virtual BasicBlockRef getCurrentBasicBlock() override;
296296
virtual ArchitectureRef getCurrentArchitecture() override;
297+
virtual size_t getCurrentILInstructionIndex() override;
297298
virtual bool navigateToFunction(FunctionRef func, uint64_t pos) override;
298299
virtual bool navigate(uint64_t pos) override;
299300

ui/viewframe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ class BINARYNINJAUIAPI View
128128
virtual BNFunctionGraphType getILViewType() { return NormalFunctionGraph; }
129129
virtual void setILViewType(BNFunctionGraphType ilViewType) { }
130130
virtual size_t getCurrentILInstructionIndex() { return BN_INVALID_EXPR; }
131+
virtual bool navigateToFunctionIndex(FunctionRef func, size_t index) { return false; }
131132

132133
virtual QFont getFont() = 0;
133134
DisassemblySettingsRef getDisassemblySettings();

0 commit comments

Comments
 (0)