Skip to content

Commit f5273b2

Browse files
committed
Improved support for interactive flowgraphs.
1 parent c979399 commit f5273b2

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

binaryninjaapi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11401,6 +11401,8 @@ namespace BinaryNinja {
1140111401
*/
1140211402
void Show(const std::string& title);
1140311403

11404+
bool IsQueryModeEnabled() const { return m_queryMode; }
11405+
1140411406
virtual bool HasUpdates() const;
1140511407

1140611408
virtual Ref<FlowGraph> Update();

binaryninjacore.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,9 @@ extern "C"
960960
FlowGraphIncludesUserComments,
961961
FlowGraphAllowsPatching,
962962
FlowGraphAllowsInlineInstructionEditing,
963-
FlowGraphShowsSecondaryRegisterHighlighting
963+
FlowGraphShowsSecondaryRegisterHighlighting,
964+
FlowGraphIsAddressable,
965+
FlowGraphIsWorkflowGraph
964966
} BNFlowGraphOption;
965967

966968
typedef enum BNILInstructionAttribute

python/flowgraph.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,24 @@ def shows_secondary_reg_highlighting(self):
770770
def shows_secondary_reg_highlighting(self, value):
771771
self.set_option(FlowGraphOption.FlowGraphShowsSecondaryRegisterHighlighting, value)
772772

773+
@property
774+
def is_addressable(self):
775+
"""Set if flow graph should make use of address information"""
776+
return self.is_option_set(FlowGraphOption.FlowGraphIsAddressable)
777+
778+
@is_addressable.setter
779+
def is_addressable(self, value):
780+
self.set_option(FlowGraphOption.FlowGraphIsAddressable, value)
781+
782+
@property
783+
def is_workflow_graph(self):
784+
"""Set if flow graph should be treated as a workflow graph"""
785+
return self.is_option_set(FlowGraphOption.FlowGraphIsWorkflowGraph)
786+
787+
@is_workflow_graph.setter
788+
def is_workflow_graph(self, value):
789+
self.set_option(FlowGraphOption.FlowGraphIsWorkflowGraph, value)
790+
773791
def layout(self, callback=None):
774792
"""
775793
``layout`` starts rendering a graph for display. Once a layout is complete, each node will contain

ui/flowgraphwidget.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ class BINARYNINJAUIAPI FlowGraphWidget :
262262
virtual bool canCopyWithTransform() override;
263263
virtual bool canCut() override;
264264
virtual bool canCopy() override;
265+
virtual bool canCopyAddress() override;
265266
virtual bool canPaste() override;
266267
virtual void cut() override;
267268
virtual void copy(TransformRef xform) override;
@@ -312,7 +313,7 @@ class BINARYNINJAUIAPI FlowGraphWidget :
312313

313314
virtual bool goToReference(FunctionRef func, uint64_t source, uint64_t target) override;
314315

315-
void setHighlightToken(const HighlightTokenState& state, bool notify = true);
316+
void setHighlightToken(const HighlightTokenState& state, bool notify = true, bool update = false);
316317

317318
virtual void notifyUpdateInProgress(FunctionRef func);
318319
virtual void onFunctionSelected(FunctionRef func);
@@ -323,8 +324,7 @@ class BINARYNINJAUIAPI FlowGraphWidget :
323324
// and they have out parameters (and thus need to be re-implemented) they must be public
324325
bool getNodeForMouseEvent(QMouseEvent* event, FlowGraphNodeRef& node);
325326
bool getLineForMouseEvent(QMouseEvent* event, CursorPosition& pos);
326-
bool getEdgeForMouseEvent(
327-
QMouseEvent* event, FlowGraphNodeRef& source, BinaryNinja::FlowGraphEdge& edge, bool& incoming);
327+
bool getEdgeForMouseEvent(QMouseEvent* event, FlowGraphNodeRef& source, BinaryNinja::FlowGraphEdge& edge, bool& incoming);
328328

329329
FlowGraphWidget* duplicate();
330330

0 commit comments

Comments
 (0)