[python api] All information about the BasicBlock Python object.
Description
This object is used to represent a basic block of instructions.
Example
>>> block = BasicBlock([
... Instruction(b"\xc9"),
... Instruction(b"\xc3")
... ])
>>> print(block)
0x0: <not disassembled>
0x1: <not disassembled>
>>>
>>> ctx.disassembly(block)
>>> print(block)
0x0: leave
0x1: ret
>>>
>>> ctx.disassembly(block, 0x400000)
>>> print(block)
0x400000: leave
0x400001: ret
>>> hex(block.getFirstAddress())
'0x400000'
>>> hex(block.getLastAddress())
'0x400001'
>>> block.remove(1)
True
>>> print(block)
0x400000: leave
>>> block.add(Instruction(b"\x90"))
>>> block.add(Instruction(b"\xc3"))
>>> ctx.disassembly(block, 0x400000)
>>> print(block)
0x400000: leave
0x400001: nop
0x400002: ret
>>> ctx.processing(block)
0
Constructor
>>> block = BasicBlock()
>>> block.add(Instruction(b"\xc9"))
>>> block.add(Instruction(b"\xc3"))
>>>
>>> block = BasicBlock([
... Instruction(b"\xc9"),
... Instruction(b"\xc3")
... ])
>>>
Python API - Methods of the BasicBlock class
- void add(Instruction inst)
Adds an instruction to the block.
- integer getFirstAddress(void)
Returns the first instruction's address of the block.
- [Instruction, ...] getInstructions(void)
Returns all instructions of the block.
- integer getLastAddress(void)
Returns the last instruction's address of the block.
- integer getSize(void)
Returns the number of instruction in the block.
- bool remove(integer position)
Removes the instruction in the block at a given position. Returns true if successed.