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
- add_bbl(bbl: Bbl | None = None, size: int = 1, instructions: List[Instruction] | None = 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
- index(instr: Instruction)[source]
Returns index of the basic block containing the given instruction.
- Parameters:
instr (
Instruction
) – Instruction to look for