microprobe.code.cfg.Cfg

class Cfg[source]

Bases: object

Class to represent the control flow graph of a building block.

__init__()[source]

Methods

__init__()
add_bbl([bbl, size, instructions]) Adds a basic block to the control flow graph of the specified size.
add_bbls(bbls) Adds a list of basic blocks to the control flow graph.
get_bbl(index) Returns the basic block at the specified index
index(instr) Returns index of the basic block containing the given instruction.
last_bbl() Returns the last basic block of the CFG

Attributes

bbls List of basic blocks in the CFG (list of Bbl).



add_bbl(bbl=None, size=1, instructions=None)[source]

Adds a basic block to the control flow graph of the specified size.

Parameters:
  • bbl (Bbl) – Basic block to add (if none, one is created) (Default value = None)
  • size (:int) – Size of the new basic block (Default value = 1)
  • instructions (list of Instruction) – Instructions for the basic block
add_bbls(bbls)[source]

Adds a list of basic blocks to the control flow graph.

Parameters:bbls (list of Bbl) – Lists of basic blocks to add.
bbls

List of basic blocks in the CFG (list of Bbl).

index(instr)[source]

Returns index of the basic block containing the given instruction.

Parameters:instr (Instruction) – Instruction to look for
get_bbl(index)[source]

Returns the basic block at the specified index

Parameters:index (int) – Index of the bbl
last_bbl()[source]

Returns the last basic block of the CFG