Vector35 / Vector35/binaryninja-api
Prefer user types over built in types
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
Example:
My program is very special; ints are 5 bytes, and unsigned. I can define that very easily:
mySpecialInt = Type.int(5, False)
bv.define_user_type("int", mySpecialInt)
But when I select an argument, press Y, and type int, it gets replaced with a int32_t.
This makes me sad.
If I do:
old = current_function.function_type
current_function.function_type = types.Type.function(old.return_value, [mySpecialInt], old.calling_convention, old.has_variable_arguments, old.stack_adjustment)
The argument does get overwritten with my custom int class, but in this case displays it as uint40_t, which I think is less than ideal (possibly related to #1666, of which I think I disagree with the outcome of).
Perhaps this should be separated into two issues; one for the type-entry box not understanding int to be my user-defined typedef overriding the built-in int, and another for not displaying the type as what I entered and instead mapping it to the base type.
Edit: The solution to the display problem is to define the type as mySpecialInt = Type.int(5, False, "int"), so this issue is only for the remaining UI bug.
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 with the type-entry flow described in the issue: select an argument, press Y, and enter int after defining a user type named int. Trace where that input resolves to the built-in int32_t, then verify that the user-defined type is preferred and remains visible after the change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- devtools, reverse-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100