Vector35 / Vector35/binaryninja-api

HLIL Layout: Leverage basic block duplication to improve early returns

Open
#7,551 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Core Core: HLIL Effort: Low Impact: Medium
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

What is the feature you'd like to have?
Load binary, go to 0x004a8c2f in Binja and IDA. Notice that IDA layouts conditions as

if (!b) return 1;
f2();
if (!c) return 2;
f4();
return 0;

Binja:

if (b) {
    f2();
    if (c) {
        f4();
        return 0;
    }
    return 2;
}
return 1;

I'd like Binja to have option to render conditions like IDA.
Is your feature request related to a problem?
If user analyses a huge function like one at 0x004a8f30 then pseudo C renders deeply nested if/else blocks. This causes strong rightward drift, which is unpleasant to look at

Are any alternative solutions acceptable?
It's possible to click Show Condition as Inverted in RMB menu, but this will only invert selected condition

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the HLIL layout and pseudo-C rendering entry points, then reproduce the examples at 0x004a8c2f and 0x004a8f30 from the supplied binary. Compare the current nested output with the requested early-return layout and determine how basic block duplication would affect it. Done means the renderer can produce the flatter condition structure without relying on manual condition inversion.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
reverse-engineering
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.