diff options
| author | Glenn Smith <glenn@vector35.com> | 2021-06-25 18:08:55 -0400 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2021-07-01 01:32:28 -0400 |
| commit | 8f0f90294096ed12e099b0572e28b531636e4fd8 (patch) | |
| tree | f0d15a077c4829e7a5ec290c2532f1126eaa71f5 | |
| parent | 78f177679cfacfcfb4f9ff542cb20a04914aed1f (diff) | |
GetAllTagReferenceTypeCounts for optimized all-counts list
| -rw-r--r-- | binaryninjaapi.h | 2 | ||||
| -rw-r--r-- | binaryninjacore.h | 2 | ||||
| -rw-r--r-- | binaryview.cpp | 18 | ||||
| -rw-r--r-- | ui/taglist.h | 1 |
4 files changed, 22 insertions, 1 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 629f4ea8..daaff150 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -1683,6 +1683,7 @@ __attribute__ ((format (printf, 1, 2))) size_t GetTagReferencesOfTypeCount(Ref<TagType> tagType); size_t GetAllTagReferencesOfTypeCount(Ref<TagType> tagType); + std::map<Ref<TagType>, size_t> GetAllTagReferenceTypeCounts(); std::vector<TagReference> GetDataTagReferences(); std::vector<Ref<Tag>> GetDataTags(uint64_t addr); @@ -3290,7 +3291,6 @@ __attribute__ ((format (printf, 1, 2))) std::vector<TagReference> GetAllTagReferences(); std::vector<TagReference> GetTagReferencesOfType(Ref<TagType> tagType); - size_t GetTagReferencesOfTypeCount(Ref<TagType> tagType); std::vector<TagReference> GetAddressTagReferences(); std::vector<Ref<Tag>> GetAddressTags(Architecture* arch, uint64_t addr); diff --git a/binaryninjacore.h b/binaryninjacore.h index 65f86aa9..73b072be 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -3771,6 +3771,8 @@ __attribute__ ((format (printf, 1, 2))) BINARYNINJACOREAPI size_t BNGetTagReferencesOfTypeCount(BNBinaryView* view, BNTagType* tagType); BINARYNINJACOREAPI size_t BNGetAllTagReferencesOfTypeCount(BNBinaryView* view, BNTagType* tagType); + BINARYNINJACOREAPI void BNGetAllTagReferenceTypeCounts(BNBinaryView* view, BNTagType*** tagTypes, size_t** counts, size_t* count); + BINARYNINJACOREAPI void BNFreeTagReferenceTypeCounts(BNTagType** tagTypes, size_t* counts); BINARYNINJACOREAPI BNTagReference* BNGetFunctionAllTagReferences(BNFunction* func, size_t* count); BINARYNINJACOREAPI BNTagReference* BNGetFunctionTagReferencesOfType(BNFunction* func, BNTagType* tagType, size_t* count); diff --git a/binaryview.cpp b/binaryview.cpp index 657a5cd7..b4ed691d 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -2496,6 +2496,24 @@ size_t BinaryView::GetAllTagReferencesOfTypeCount(Ref<TagType> tagType) } +std::map<Ref<TagType>, size_t> BinaryView::GetAllTagReferenceTypeCounts() +{ + BNTagType** types; + size_t* counts; + size_t count; + BNGetAllTagReferenceTypeCounts(m_object, &types, &counts, &count); + + std::map<Ref<TagType>, size_t> result; + for (size_t i = 0; i < count; i ++) + { + result[new TagType(BNNewTagTypeReference(types[i]))] = counts[i]; + } + + BNFreeTagReferenceTypeCounts(types, counts); + return result; +} + + size_t BinaryView::GetTagReferencesOfTypeCount(Ref<TagType> tagType) { return BNGetTagReferencesOfTypeCount(m_object, tagType->GetObject()); diff --git a/ui/taglist.h b/ui/taglist.h index bcd27e7f..19d163dd 100644 --- a/ui/taglist.h +++ b/ui/taglist.h @@ -140,6 +140,7 @@ protected: void selectFirstItem() override; void activateFirstItem() override; + virtual void OnAnalysisFunctionUpdated(BinaryNinja::BinaryView* view, BinaryNinja::Function* func) override; virtual void OnTagAdded(BinaryNinja::BinaryView*, const BinaryNinja::TagReference&) override; virtual void OnTagUpdated(BinaryNinja::BinaryView*, const BinaryNinja::TagReference&) override; virtual void OnTagRemoved(BinaryNinja::BinaryView*, const BinaryNinja::TagReference&) override; |
