microprobe.code.cfg.Cfg¶
-
class
Cfg
[source]¶ Bases:
object
Class to represent the control flow graph of a building block.
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
List of basic blocks in the CFG (
list
ofBbl
).
-
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
ofInstruction
) – Instructions for the basic block
-
add_bbls
(bbls)[source]¶ Adds a list of basic blocks to the control flow graph.
- Parameters
bbls (
list
ofBbl
) – Lists of basic blocks to add.
-
index
(instr)[source]¶ Returns index of the basic block containing the given instruction.
- Parameters
instr (
Instruction
) – Instruction to look for
-