From 3808f91664f9632eb9d754a1ff99447b50468b36 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Sat, 3 Jul 2021 01:08:47 -0400 Subject: Cleanup tags and comments in many places Fixes #1926 #2374 #2325 #2204 #1652 and possibly others --- binaryview.cpp | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 2 deletions(-) (limited to 'binaryview.cpp') diff --git a/binaryview.cpp b/binaryview.cpp index 139e319c..dd61f0e7 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -2569,6 +2569,22 @@ std::vector BinaryView::GetDataTagReferences() } +std::vector BinaryView::GetAutoDataTagReferences() +{ + size_t count; + BNTagReference* refs = BNGetAutoDataTagReferences(m_object, &count); + return TagReference::ConvertAndFreeTagReferenceList(refs, count); +} + + +std::vector BinaryView::GetUserDataTagReferences() +{ + size_t count; + BNTagReference* refs = BNGetUserDataTagReferences(m_object, &count); + return TagReference::ConvertAndFreeTagReferenceList(refs, count); +} + + std::vector> BinaryView::GetDataTags(uint64_t addr) { size_t count; @@ -2577,6 +2593,22 @@ std::vector> BinaryView::GetDataTags(uint64_t addr) } +std::vector> BinaryView::GetAutoDataTags(uint64_t addr) +{ + size_t count; + BNTag** tags = BNGetAutoDataTags(m_object, addr, &count); + return Tag::ConvertAndFreeTagList(tags, count); +} + + +std::vector> BinaryView::GetUserDataTags(uint64_t addr) +{ + size_t count; + BNTag** tags = BNGetUserDataTags(m_object, addr, &count); + return Tag::ConvertAndFreeTagList(tags, count); +} + + std::vector> BinaryView::GetDataTagsOfType(uint64_t addr, Ref tagType) { size_t count; @@ -2585,14 +2617,46 @@ std::vector> BinaryView::GetDataTagsOfType(uint64_t addr, Ref } -std::vector> BinaryView::GetDataTagsInRange(uint64_t start, uint64_t end) +std::vector> BinaryView::GetAutoDataTagsOfType(uint64_t addr, Ref tagType) +{ + size_t count; + BNTag** tags = BNGetAutoDataTagsOfType(m_object, addr, tagType->GetObject(), &count); + return Tag::ConvertAndFreeTagList(tags, count); +} + + +std::vector> BinaryView::GetUserDataTagsOfType(uint64_t addr, Ref tagType) { size_t count; - BNTag** tags = BNGetDataTagsInRange(m_object, start, end, &count); + BNTag** tags = BNGetUserDataTagsOfType(m_object, addr, tagType->GetObject(), &count); return Tag::ConvertAndFreeTagList(tags, count); } +std::vector BinaryView::GetDataTagsInRange(uint64_t start, uint64_t end) +{ + size_t count; + BNTagReference* refs = BNGetDataTagsInRange(m_object, start, end, &count); + return TagReference::ConvertAndFreeTagReferenceList(refs, count); +} + + +std::vector BinaryView::GetAutoDataTagsInRange(uint64_t start, uint64_t end) +{ + size_t count; + BNTagReference* refs = BNGetAutoDataTagsInRange(m_object, start, end, &count); + return TagReference::ConvertAndFreeTagReferenceList(refs, count); +} + + +std::vector BinaryView::GetUserDataTagsInRange(uint64_t start, uint64_t end) +{ + size_t count; + BNTagReference* refs = BNGetUserDataTagsInRange(m_object, start, end, &count); + return TagReference::ConvertAndFreeTagReferenceList(refs, count); +} + + void BinaryView::AddAutoDataTag(uint64_t addr, Ref tag) { BNAddAutoDataTag(m_object, addr, tag->GetObject()); @@ -2605,6 +2669,12 @@ void BinaryView::RemoveAutoDataTag(uint64_t addr, Ref tag) } +void BinaryView::RemoveAutoDataTagsOfType(uint64_t addr, Ref tagType) +{ + BNRemoveAutoDataTagsOfType(m_object, addr, tagType->GetObject()); +} + + void BinaryView::AddUserDataTag(uint64_t addr, Ref tag) { BNAddUserDataTag(m_object, addr, tag->GetObject()); @@ -2617,6 +2687,12 @@ void BinaryView::RemoveUserDataTag(uint64_t addr, Ref tag) } +void BinaryView::RemoveUserDataTagsOfType(uint64_t addr, Ref tagType) +{ + BNRemoveUserDataTagsOfType(m_object, addr, tagType->GetObject()); +} + + void BinaryView::RemoveTagReference(const TagReference& ref) { BNRemoveTagReference(m_object, (BNTagReference)ref); -- cgit v1.3.1