code.py¶
This module defines classes that represent assembly instructions blocks,
functions, and calls to external functions. In amoco, such objects are
found as node.data
in nodes of a cfg.graph
. As such,they
all provide a common API with:
address
to identify and locate the object in memorysupport
to get the address range of the objectview
to display the object
-
class
code.
block
(instrlist)[source]¶ A block instance holds a sequence of instructions.
Parameters: instr (list[instruction]) – the sequence of continuous (ordered) instructions -
view
¶ holds the
ui.views
object used to display the block.Type: blockView
-
address
¶ the address of the first instruction in the block.
Type: address ( cst
)
-
cut
(address)[source]¶ cutting the block at given address will remove instructions after this address, (which needs to be aligned with instructions boundaries.) The effect is thus to reduce the block size.
Parameters: address (cst) – the address where the cut occurs. Returns: the number of instructions removed from the block. Return type: int
-
-
class
code.
func
(g=None)[source]¶ A graph of blocks that represents a function’s Control-Flow-Graph (CFG).
Parameters: g (graph_core) – the connected graph component of nodes. -
blocks
the list of blocks within the function.
Type: blocks (list)
-