Skip to content

Basic Blocks

basic_blocks

Classes:

  • BasicBlocks

    Interface for working with basic blocks in functions.

BasicBlocks

BasicBlocks(database: 'Database')

Interface for working with basic blocks in functions.

Basic blocks are sequences of instructions with a single entry point and single exit point, used for control flow analysis and optimization.

Constructs a basic block handler for the given database.

Args: database: Reference to the active IDA database.

Methods:

  • get_between

    Retrieves the basic blocks within a given address range.

  • get_from_function

    Retrieves the basic blocks within a given function.

  • get_instructions

    Retrieves the instructions within a given basic block.

Attributes:

m_database instance-attribute

m_database = database

get_between

get_between(start: 'ea_t', end: 'ea_t', flags=0)

Retrieves the basic blocks within a given address range.

Args: start: The start address of the range. end: The end address of the range. flags: Optional qflow_chart_t flags for flowchart generation (default: 0).

Returns: An iterable flowchart containing the basic blocks within the specified range.

get_from_function

get_from_function(func: 'func_t', flags=0)

Retrieves the basic blocks within a given function.

Args: func: The function to retrieve basic blocks from. flags: Optional qflow_chart_t flags for flowchart generation (default: 0).

Returns: An iterable flowchart containing the basic blocks of the function.

get_instructions

get_instructions(block: 'qbasic_block_t')

Retrieves the instructions within a given basic block.

Args: block: The basic block to analyze.

Returns: An instruction iterator for the block. Returns an empty iterator if the block is invalid.