`typedef` types can get lost in type propagation
Version and Platform (required):
- Binary Ninja Version: 3.5.4430-dev Personal (79725014)
- OS: Windows
- OS Version: 10.0.23511.1000
- CPU Architecture: x64
Bug Description:
I like to define typedefs for primitive types when they represent something special, such as the ID of a game object, or a Boolean, or whatever:
typedef int64_t S1GameId;
typedef uint32_t BOOL;
Unfortunately, BN's type propagation sometimes loses the typedef and just propagates the underlying type. This happens basically all the time for structure fields, for example; if I have a field typed as BOOL, then local variables typed according to the field become uint32_t.
I vaguely recall other situations where the typedef seemed to have been lost, but I can't recall exactly when. In any case, structure fields is the big one here.
Steps To Reproduce:
Define a typedef, a structure with a field typed as that typedef, and observe the type propagation behavior.
Expected Behavior:
The typedef type should propagate instead of the underlying type.
I guess it's bit worse now, as typedef info is lost for types even it is not within any structures, but for type in general:
This issue even makes some features from objc workflow (ObjectiveNinja) useless. For example: workflow trying to customise rendering of relative offsets which is actually just a typedefs to ints, thus linked code never pass the comparison as this types hasn't any names.
Wanted to upvote this issue, as I'm triggering it in BinSync as well:
- Manually make a typedef:
typedef int my_int; - Grab it in the Python API:
>>> typedef = bv.types["my_int"]
>>> type(typedef)
<class 'binaryninja.types.IntegerType'>
Any info that this was a typedef is lost. registered_name is None as well.