cinspector.analysis package

Submodules

cinspector.analysis.call_graph module

Call Graph

class cinspector.analysis.call_graph.CallGraph(funcs: Iterable[FunctionDefinitionNode])[source]

Bases: object

Generate the call graph

Accept a list of function nodes and analyze the invocation relationship between them. Note that only explicit invocations will be catched instead of indirect calls.

Attribtes:

funcs (Iterable[FunctionDefinitionNode]): involved functions

analysis() DiGraph[source]
is_identical(call: CallExpressionNode, func: FunctionDefinitionNode) bool[source]

check whether the <call> is the invocation of <func>

We involve two checks to decide whether <call> is the invocation of <func>
  1. same func name

  2. same parameter number

#TODO: It would be more precise if add parameter type check. But this requires dataflow analysis which we will implement later.

cinspector.analysis.cfg module

Control Flow Graph-related analysis

class cinspector.analysis.cfg.BaseCFG(stmts: List[Node])[source]

Bases: Util

execution_path()[source]
generate()[source]

CFG.generate() generate the control flow graph

merge()[source]

self.generate generate the DiGraph in which nodes are single statement self.merge merge the statements into the basic block

class cinspector.analysis.cfg.BasicBlock(nodes: list)[source]

Bases: Util

class cinspector.analysis.cfg.CFG(function_def: FunctionDefinitionNode)[source]

Bases: BaseCFG

Module contents