basicblock module

binaryninja.basicblock.BasicBlock(handle[, view])

binaryninja.basicblock.BasicBlockEdge(…)

class BasicBlock(handle, view=None)[source]

Bases: object

get_disassembly_text(settings=None)[source]

get_disassembly_text returns a list of binaryninja.function.DisassemblyTextLine objects for the current basic block.

Parameters

settings (DisassemblySettings) – (optional) DisassemblySettings object

Example
>>> current_basic_block.get_disassembly_text()
[<0x100000f30: _main:>, <0x100000f30: push    rbp>, ... ]
get_instruction_containing_address()[source]
classmethod get_iterated_dominance_frontier(blocks)[source]
mark_recent_use()[source]
set_auto_highlight(color)[source]

set_auto_highlight highlights the current BasicBlock with the supplied color.

Warning

Use only in analysis plugins. Do not use in regular plugins, as colors won’t be saved to the database.

Parameters

or highlight.HighlightColor color (HighlightStandardColor) – Color value to use for highlighting

set_user_highlight(color)[source]

set_user_highlight highlights the current BasicBlock with the supplied color

Parameters

or highlight.HighlightColor color (HighlightStandardColor) – Color value to use for highlighting

Example
>>> current_basic_block.set_user_highlight(highlight.HighlightColor(red=0xff, blue=0xff, green=0))
>>> current_basic_block.set_user_highlight(HighlightStandardColor.BlueHighlightColor)
property annotations

List of automatic annotations for the start of this block (read-only)

property arch

Basic block architecture (read-only)

property can_exit

Whether basic block can return or is tagged as ‘No Return’ (read-only)

property disassembly_text

disassembly_text property which returns a list of binaryninja.function.DisassemblyTextLine objects for the current basic block. :Example:

>>> current_basic_block.disassembly_text
[<0x100000f30: _main:>, ...]
property dominance_frontier

Dominance frontier for this basic block (read-only)

property dominator_tree_children

List of child blocks in the dominator tree for this basic block (read-only)

property dominators

List of dominators for this basic block (read-only)

property end

Basic block end (read-only)

property function

Basic block function (read-only)

property has_invalid_instructions

Whether basic block has any invalid instructions (read-only)

property has_undetermined_outgoing_edges

Whether basic block has undetermined outgoing edges (read-only)

property highlight

Gets or sets the highlight color for basic block

Example
>>> current_basic_block.highlight = HighlightStandardColor.BlueHighlightColor
>>> current_basic_block.highlight
<color: blue>
property immediate_dominator

Immediate dominator of this basic block (read-only)

property immediate_post_dominator

Immediate dominator of this basic block (read-only)

property incoming_edges

List of basic block incoming edges (read-only)

property index

Basic block index in list of blocks for the function (read-only)

property instruction_count
property is_il

Whether the basic block contains IL

property is_low_level_il

Whether the basic block contains Low Level IL

property is_medium_level_il

Whether the basic block contains Medium Level IL

property length

Basic block length (read-only)

property outgoing_edges

List of basic block outgoing edges (read-only)

property post_dominance_frontier

Post dominance frontier for this basic block (read-only)

property post_dominator_tree_children

List of child blocks in the post dominator tree for this basic block (read-only)

property post_dominators

List of dominators for this basic block (read-only)

property source_block

Basic block source block (read-only)

property start

Basic block start (read-only)

property strict_dominators

List of strict dominators for this basic block (read-only)

property view

Binary view that contains the basic block (read-only)

class BasicBlockEdge(branch_type, source, target, back_edge, fall_through)[source]

Bases: object

property back_edge
property fall_through
property source
property target
property type