MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / test_graph

Function test_graph

rust/examples/flowgraph.rs:7–39  ·  view source on GitHub ↗
(view: &BinaryView)

Source from the content-addressed store, hash-verified

5};
6
7fn test_graph(view: &BinaryView) {
8 let graph = FlowGraph::new();
9
10 let disassembly_lines_a = vec![DisassemblyTextLine::new(vec![
11 InstructionTextToken::new("Li", InstructionTextTokenKind::Text),
12 InstructionTextToken::new("ne", InstructionTextTokenKind::Text),
13 InstructionTextToken::new(" 1", InstructionTextTokenKind::Text),
14 ])];
15
16 let node_a = FlowGraphNode::new(&graph);
17 node_a.set_lines(disassembly_lines_a);
18
19 let node_b = FlowGraphNode::new(&graph);
20 let disassembly_lines_b = vec![DisassemblyTextLine::new(vec![
21 InstructionTextToken::new("Li", InstructionTextTokenKind::Text),
22 InstructionTextToken::new("ne", InstructionTextTokenKind::Text),
23 InstructionTextToken::new(" 2", InstructionTextTokenKind::Text),
24 ])];
25 node_b.set_lines(disassembly_lines_b);
26
27 graph.append(&node_a);
28 graph.append(&node_b);
29
30 let edge = EdgeStyle::new(EdgePenStyle::DashDotDotLine, 2, ThemeColor::AddressColor);
31 node_a.add_outgoing_edge(BranchType::UserDefinedBranch, &node_b, edge);
32 node_b.add_outgoing_edge(
33 BranchType::UnconditionalBranch,
34 &node_a,
35 EdgeStyle::default(),
36 );
37
38 view.show_graph_report("Rust Graph Title", &graph);
39}
40
41fn main() {
42 println!("Starting session...");

Callers 1

mainFunction · 0.85

Calls 4

set_linesMethod · 0.80
appendMethod · 0.45
add_outgoing_edgeMethod · 0.45
show_graph_reportMethod · 0.45

Tested by

no test coverage detected