Open psifertex opened 7 years ago
Should probably change the title of this to be more explanatory
Trying to define a structure like:
struct sha_dma_config __packed
{
union {
uint32_t cfg;
struct {
uint32_t len : 17;
...
}
}
... turns into whatever this is:
struct sha_dma_config __packed
{
union
{
uint32_t cfg;
struct
{
union
{
uint8_t len;
} bitfield_0;
union
{
uint8_t len;
} bitfield_1;
union
{
uint8_t len;
uint8_t irq;
uint8_t eod;
uint8_t loop;
uint8_t mode;
} bitfield_2;
union
{
uint8_t begin;
uint8_t end;
uint8_t op;
uint8_t unk0;
uint8_t enconly;
uint8_t block;
uint8_t err;
uint8_t owner;
} bitfield_3;
};
};
};
which doesn't appear to be equivalent in any meaningful way. Binary Ninja should really warn that it can't handle this instead of just going along with it and ruining type annotation in my pseudo-C. :-1:
Also, I'm surprised this doesn't have more support. Kind of necessary to produce readable abstractions based on bitfield/tightly packed structures.
Agreed with @benjaminmordaunt. The current solution for this is not very helpful. Having a single named union to represent sometimes 16+ different bits worth of data provides very little context, but can still clutter the decompilation view. Can be a very frustrating experience when I run into bitfield packed structs in Binja.
I agree that it would be great if bitfields could be supported completely and be displayed more clearly
Need support for bitwise data structures.