Expose the unique identifier from Type objects
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- api, reverse-engineering
Research direction
Start with the TypeContainer module documentation and the existing TypeContainer.get_type_id(name) entry point, then inspect how Type objects represent unnamed types. Done means an unnamed Type exposes a stable unique identifier that can be used to match it outside its original TypeContainer; clarify the supported hashing behavior as part of the API design.
Written by the indexing model from the issue text.
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
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
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.
More from Vector35/binaryninja-api
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Vector35/binaryninja-api#8540 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Vector35/binaryninja-api#8516 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Vector35/binaryninja-api#8503 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Vector35/binaryninja-api#8446 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Vector35/binaryninja-api#8444 ·
All issues in Vector35/binaryninja-api
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gazebosim/gz-sensors#662 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LadybirdBrowser/ladybird#12123 ·