Skip to main content

Module graph

Module graph 

Source
Expand description

Graphs of a binary drawn in the usual disassembler layout, without any drawing framework:

  • [cfg]: a function’s control-flow graph from a [binbun::Database]: basic blocks as a disassembler’s graph has them (calls do not end one; cold parts and funclets joined to the function are blocks of it), each block’s lines of the listing, edges with their kinds (taken, not taken, jump, fall-through, switch case, unwinding).
  • layout: a layered layout of any graph of sized nodes (a call graph as well): root on top, few crossings, vertical chains straight, orthogonal edges with a track each between layers, deterministic.
  • quality: what makes a drawing hard to follow, counted.
  • svg: a laid out function graph as SVG (the CLI’s graph).

A front end measures each block (its lines in its font), calls layout::layout once per function and size, and draws.

Re-exports§

pub use cfg::Block;
pub use cfg::BlockLine;
pub use cfg::Edge;
pub use cfg::EdgeKind;
pub use cfg::Exit;
pub use cfg::FunctionGraph;
pub use cfg::Target;
pub use cfg::block_line;
pub use layout::Layout;
pub use layout::Point;
pub use layout::Rect;
pub use layout::Route;
pub use layout::Size;
pub use layout::Spacing;
pub use quality::Quality;
pub use quality::measure;

Modules§

cfg
A function’s control-flow graph as a disassembler draws it: its basic blocks (recovery’s blocks joined across calls, which do not end a block in the graph), with the parts and funclets joined to it, each with its listing lines, and the edges between them with their kinds.
layout
A layered (Sugiyama) layout of a directed graph of sized nodes, drawn as disassemblers usually draw control-flow graphs: the root on top, edges going down, orthogonal edges with their bends between layers.
quality
What makes a drawn graph hard to follow, counted: edges on top of each other, edges through or along nodes, shared ports, crossings.
svg
A laid out function graph as SVG, in One Dark: blocks with their text, edges coloured by kind with arrowheads, a terminal mark under each block no edge leaves (a headless view of what the GUI draws).