Support for adjusted switch-case values

Open
#4,753 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp

Research direction

Start from HLIL switch-case generation and review related issue #3776. Determine where the subtraction before the switch is represented, then make the adjusted case values appear directly in the output as shown; done means the generated HLIL is readable without the redundant subtraction.

Written by the indexing model from the issue text.

Description

Component: Core Core: HLIL Effort: Medium Impact: Medium

In the HLIL of the following code, the semantics of the output is correct, but it is not very readable. The code subtracts a char with 0x64 ('b'), and then do a switch case for value 0x0-0x11. It would be nice if we can remove the subtraction, and directly convert the switch-case values to 'b', etc

Screenshot 2023-11-15 at 6 01 21 PM

For example, to some code like this:

 switch ( prov[prov_i] )
    {
      case 'd':
        --flag_ck[ck_i];
        break;
      case 'e':
        if ( x <= 0 )
        {
          done = 1;
        }
        else if ( flag_ck[ck_i] <= 0 )

Related to https://github.com/Vector35/binaryninja-api/issues/3776

Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

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.

More from Vector35/binaryninja-api

All issues in Vector35/binaryninja-api

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.