Usage of type code with structs is outdated
See original GitHub issueOnce upon a time in angr, I didn’t understand that there was a difference between the declaration of a struct (struct asdf
) and a global typename for a structure (typedef struct asdf asdf;
), because we all grow and learn things with time, and sometimes while designing a gigantically complicated system you mistake the trees for the forest.
Regardless, there’s some weird inconsistent behavior in angr.sim_type related to structure (and union, but nobody uses those) declarations. angr.sim_type.define_struct
was up until yesterday a function which added to the global type namespace the typename of the struct (asdf
) but not the struct asdf
name. this is bad obviously!!! i just made it so it added both, but really it should just add struct asdf
. I have no idea the extent to which people rely on this behavior, so deprecating it would be weird, except…
Really, define_struct
should not exist at all. I think the only reason it existed was because I thought "oh well the point of simtypes is to make it so you can type state.mem[addr].type
, and you can’t type types there that have spaces in their names, so what’s the point! anyway I later realized I could just add struct
as a special keyword to the mem accessors, so now you can go state.mem[addr].struct.asdf
, so there’s absolutely no need to have a big important function to import struct names as global typenames.
So, a to-do list:
- mark define_struct as deprecated
- fix the docs which tell you to use define_struct and add the
state.mem[addr].struct.name
syntax
Issue Analytics
- State:
- Created 4 years ago
- Comments:22 (22 by maintainers)
Top GitHub Comments
I can do this, so you can focus on more important issues.
Good work. I’ll mark define_struct deprecated and update any examples using it.