Reach.SystemDependence (Reach v2.3.4)

Copy Markdown View Source

Builds system dependence graph from per-function PDGs.

Summary

Functions

Adds interprocedural call edges when building a project-wide graph.

Applies a precomputed external function summary to a call node.

Builds an SDG from IR nodes.

Context-sensitive backward slice using Horwitz-Reps-Binkley two-phase algorithm.

Builds an SDG from Elixir source containing one or more function definitions.

Returns the PDG for a specific function.

Exports the SDG to DOT format.

Types

function_id()

@type function_id() :: Reach.CallGraph.function_id()

t()

@type t() :: %Reach.SystemDependence{
  call_graph: Graph.t(),
  function_pdgs: %{required(function_id()) => map()},
  graph: Graph.t(),
  nodes: %{required(Reach.IR.Node.id()) => Reach.IR.Node.t()}
}

Functions

add_call_edges_with_externals(graph, all_nodes, func_defs, opts)

Adds interprocedural call edges when building a project-wide graph.

apply_summary(graph, call_node, param_flows)

Applies a precomputed external function summary to a call node.

build(ir_nodes, opts \\ [])

@spec build(
  [Reach.IR.Node.t()],
  keyword()
) :: t()

Builds an SDG from IR nodes.

context_sensitive_slice(system_dependence, node_id)

@spec context_sensitive_slice(t(), Reach.IR.Node.id()) :: [Reach.IR.Node.id()]

Context-sensitive backward slice using Horwitz-Reps-Binkley two-phase algorithm.

Phase 1: slice backward in calling context — follow call edges down,

     don't follow return edges up.

Phase 2: from Phase 1 results, slice backward in called context —

     follow return edges up, don't follow call edges down.

from_string(source, opts \\ [])

@spec from_string(
  String.t(),
  keyword()
) :: {:ok, t()} | {:error, term()}

Builds an SDG from Elixir source containing one or more function definitions.

function_pdg(system_dependence, function_id)

@spec function_pdg(t(), function_id()) :: map() | nil

Returns the PDG for a specific function.

to_dot(system_dependence)

@spec to_dot(t()) :: {:ok, String.t()} | {:error, term()}

Exports the SDG to DOT format.