package binsec

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Binsec_cli_disasm.Instr_cfgSource

Sourcemodule type S = sig ... end
Sourcemodule Make (H : Stdlib.Hashtbl.HashedType) : S with type addr = Binsec.Virtual_address.t and type inst = Binsec.Instruction.t and type symb = H.t
include S with type addr = Binsec.Virtual_address.t and type inst = Binsec.Instruction.t and type symb = string
include Cfg.S with type addr = Binsec.Virtual_address.t with type inst = Binsec.Instruction.t with type symb = string
Sourcetype symb = string
Sourcetype t

Abstract type of graphs

Sourcemodule V : sig ... end

Vertices

Sourcetype vertex = V.t
Sourcemodule E : sig ... end

Edges

Sourcetype edge = E.t
Sourcemodule Fixpoint (X : sig ... end) : sig ... end
Sourceval is_directed : bool

is this an implementation of directed graphs?

Graph constructors and destructors

Sourceval create : int -> t

Return an empty graph. Optionally, a size can be given, which should be on * the order of the expected number of vertices that will be in the graph (for * hash tables-based implementations). The graph grows as needed, so size is * just an initial guess.

Sourceval clear : t -> unit

Remove all vertices and edges from the given graph.

Sourceval copy : t -> t

copy g returns a copy of g. Vertices and edges (and eventually marks, * see module Mark) are duplicated.

Sourceval add_vertex : t -> vertex -> unit

add_vertex g v adds the vertex v in graph g. Do nothing if v * is already in g.

Sourceval add_addr : t -> addr -> unit
Sourceval add_inst : t -> addr -> inst -> unit
Sourceval add_symb : t -> addr -> symb -> unit
Sourceval remove_vertex : t -> vertex -> unit

remove g v removes the vertex v from the graph g (and all the edges * going from v in g). Do nothing if v is not in g.

Sourceval remove_addr : t -> addr -> unit
Sourceval remove_inst : t -> addr -> unit
Sourceval remove_symb : t -> addr -> unit
Sourceval add_edge : t -> vertex -> vertex -> unit

add_edge g v1 v2 adds an edge from the vertex v1 to the vertex v2 in * the graph g. Add also v1 (resp. v2) in g if v1 (resp. v2) is not * in g. Do nothing if this edge is already in g.

Sourceval add_edge_a : t -> addr -> addr -> unit
Sourceval add_edge_e : t -> edge -> unit

add_edge_e g e adds the edge e in the graph g. Add also E.src e * (resp. E.dst e) in g if E.src e (resp. E.dst e) is not in g. Do * nothing if e is already in g.

Sourceval remove_edge : t -> vertex -> vertex -> unit

remove_edge g v1 v2 removes the edge going from v1 to v2 from the graph g. Do nothing if this edge is not in g.

  • raises Invalid_argument

    if v1 or v2 are not in g.

Sourceval remove_edge_a : t -> addr -> addr -> unit
Sourceval remove_edge_e : t -> edge -> unit

remove_edge_e g e removes the edge e from the graph g. Do nothing if e is not in g.

  • raises Invalid_argument

    if E.src e or E.dst e are not in g.

Size functions

Sourceval is_empty : t -> bool
Sourceval nb_vertex : t -> int
Sourceval nb_edges : t -> int

Degree of a vertex

Sourceval out_degree : t -> vertex -> int

out_degree g v returns the out-degree of v in g.

  • raises Invalid_argument

    if v is not in g.

Sourceval in_degree : t -> vertex -> int

in_degree g v returns the in-degree of v in g.

  • raises Invalid_argument

    if v is not in g.

Membership functions

Sourceval mem_vertex : t -> vertex -> vertex option
Sourceval mem_vertex_a : t -> addr -> vertex option
Sourceval mem_edge : t -> vertex -> vertex -> edge option
Sourceval mem_edge_a : t -> addr -> addr -> edge option
Sourceval mem_edge_e : t -> edge -> edge option

Successors and predecessors of a vertex

Sourceval succ : t -> vertex -> vertex list

succ g v returns the successors of v in g.

  • raises Invalid_argument

    if v is not in g.

Sourceval pred : t -> vertex -> vertex list

pred g v returns the predecessors of v in g.

  • raises Invalid_argument

    if v is not in g.

Labeled edges going from/to a vertex

Sourceval succ_e : t -> vertex -> edge list

succ_e g v returns the edges going from v in g.

  • raises Invalid_argument

    if v is not in g.

Sourceval pred_e : t -> vertex -> edge list

pred_e g v returns the edges going to v in g.

  • raises Invalid_argument

    if v is not in g.

Graph iterators

iter/fold on all vertices/edges of a graph

Sourceval iter_vertex : (vertex -> unit) -> t -> unit
Sourceval iter_edges : (vertex -> vertex -> unit) -> t -> unit
Sourceval fold_vertex : (vertex -> 'a -> 'a) -> t -> 'a -> 'a
Sourceval fold_edges : (vertex -> vertex -> 'a -> 'a) -> t -> 'a -> 'a

iter/fold on all labeled edges of a graph

Sourceval iter_edges_e : (edge -> unit) -> t -> unit
Sourceval fold_edges_e : (edge -> 'a -> 'a) -> t -> 'a -> 'a

Vertex iterators

Each iterator iterator f v g iters f to the successors/predecessors of v in the graph g and raises Invalid_argument if v is not in g.

iter/fold on all successors/predecessors of a vertex.

Sourceval iter_succ : (vertex -> unit) -> t -> vertex -> unit
Sourceval iter_pred : (vertex -> unit) -> t -> vertex -> unit
Sourceval fold_succ : (vertex -> 'a -> 'a) -> t -> vertex -> 'a -> 'a
Sourceval fold_pred : (vertex -> 'a -> 'a) -> t -> vertex -> 'a -> 'a

iter/fold on all edges going from/to a vertex.

Sourceval iter_succ_e : (edge -> unit) -> t -> vertex -> unit
Sourceval fold_succ_e : (edge -> 'a -> 'a) -> t -> vertex -> 'a -> 'a
Sourceval iter_pred_e : (edge -> unit) -> t -> vertex -> unit
Sourceval fold_pred_e : (edge -> 'a -> 'a) -> t -> vertex -> 'a -> 'a
Sourceval ordered_iter_vertex : compare:(vertex -> vertex -> int) -> (vertex -> unit) -> t -> unit
Sourceval iter_vertex_by_address : (vertex -> unit) -> t -> unit
Sourceval output_graph : Stdlib.out_channel -> t -> entry:vertex -> Binsec.Virtual_address.t list -> unit
Sourceval dump : filename:string -> t -> unit