-
Notifications
You must be signed in to change notification settings - Fork 275
Description
What is the feature you'd like to have?
TypeContainer module documentation says:
Types are stored with both a unique id and a unique name.
This phrasing is inaccurate, as
- some types have no names
- I can't see a way to get the ID of a
Typeif it has no name.
I'd expect Type to expose an ID but it doesn't, instead I think I'm supposed to use TypeContainer.get_type_id(name). But I can't do that, because I can't provide a name for unnamed types.
I think Types should simply expose their unique ID so unnamed types can be tracked outside their TypeContainer.
Is your feature request related to a problem?
Suppose I preprocess Types from a TypeContainer without modifying TypeContainer. Then I want to match a preprocessed, unnamed type to a symbol of the original unnamed type. Since the type has no name, I can't look it up by that property and I can't get its ID. The only solution I found is to map the original Type to the preprocessed one (Type is hashable), then use this extra index to look up preprocessed types, but I'm not sure if this is reliable/supported.
Some code may clear things up:
for t in all_types: # all_types may contain unnamed types
processed=process(t)
store_for_me(processed)
my_types[t]=processed # Extra index for matching, will this behave as I expect?
for s in all_symbols:
sym_data_type=bv.data_vars[s.address].type
# I'd like to do something like retrieve_for_me(sym_data_type.id)
my_type_for_sym=my_types[sym_data_type](My more specific use case is this project)
Are any alternative solutions acceptable?
The most convenient solution for me as a user would be if every type had a unique name (even an auto-generated one), but I'm not sure if this would violate the design of the type system.
Additional Information:
N/A