Skip to content

Printing instructions fails unless you sleep between function creation and printing #2295

@Vasco-jofra

Description

@Vasco-jofra

As seen in the image below, iterating and printing the instructions of a newly created function does not work, unless you sleep between creating the function and printing its instructions.

Screenshot 2021-03-04 at 12 43 59

The code:

from binaryninja import BinaryView, Function, Platform
import time

# Create a binary view from a data buffer
new_bv: BinaryView = BinaryView.new("\x55\x55\x90\x90\xc3")
new_bv.platform = Platform["linux-x86_64"]

# Create a function at the start address
new_bv.create_user_function(0)
func: Function = new_bv.get_function_at(0)

time.sleep(0.1) # <--- remove me and the print below does not work

for instr in func.instructions:
    print(instr)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions