Vector35 / Vector35/binaryninja-api
Magic variable "current_basic_block" should return an IL basic block if the currently selected basic block is an IL basic block
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
In light of PR https://github.com/Vector35/binaryninja-api/pull/4765, I notice that when we select an LLIL basic block, the repr of it shows a weird mixture:
>>> current_basic_block
<BasicBlock: x86_64@0xa-0x10>
This is because the current_basic_block object is always the BasicBlock base class. We should really return the LLIL/MLIL/HLIL basic block when appropriate, and maybe remove the current_il_basic_block, since it will always return the same thing.
One problem of not returning a subclass of the BasicBlock is some properties do not work:
>>> current_basic_block.instruction_count
0
In contrast, if we do have a proper LLIL basic block object, we get the correct instruction count value:
>>> current_il_function.basic_blocks[0].instruction_count
7
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing PR 4765 and the API entry points for current_basic_block, current_il_basic_block, and current_il_function. Reproduce the shown LLIL selection and instruction_count behavior; done means current_basic_block returns the appropriate IL basic-block subclass for LLIL, MLIL, or HLIL selections, with current_il_basic_block's behavior considered accordingly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- reverse-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100