diff options
Diffstat (limited to 'binaryview.cpp')
| -rw-r--r-- | binaryview.cpp | 119 |
1 files changed, 71 insertions, 48 deletions
diff --git a/binaryview.cpp b/binaryview.cpp index 0fd19d6d..fa3ef646 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -1039,40 +1039,6 @@ Segment::Segment(BNSegment* seg) } -vector<pair<uint64_t, uint64_t>> Segment::GetRelocationRanges() const -{ - size_t count = 0; - BNRange* ranges = BNSegmentGetRelocationRanges(m_object, &count); - vector<pair<uint64_t, uint64_t>> result(count); - for (size_t i = 0; i < count; i++) - { - result.push_back({ranges[i].start, ranges[i].end}); - } - BNFreeRelocationRanges(ranges); - return result; -} - - -vector<pair<uint64_t, uint64_t>> Segment::GetRelocationRangesAtAddress(uint64_t addr) const -{ - size_t count = 0; - BNRange* ranges = BNSegmentGetRelocationRangesAtAddress(m_object, addr, &count); - vector<pair<uint64_t, uint64_t>> result(count); - for (size_t i = 0; i < count; i++) - { - result.push_back({ranges[i].start, ranges[i].end}); - } - BNFreeRelocationRanges(ranges); - return result; -} - - -uint64_t Segment::GetRelocationsCount() const -{ - return BNSegmentGetRelocationsCount(m_object); -} - - uint64_t Segment::GetStart() const { return BNSegmentGetStart(m_object); @@ -1761,6 +1727,21 @@ vector<pair<uint64_t, uint64_t>> BinaryView::GetRelocationRangesAtAddress(uint64 } +vector<pair<uint64_t, uint64_t>> BinaryView::GetRelocationRangesInRange(uint64_t addr, size_t size) const +{ + size_t count = 0; + BNRange* ranges = BNGetRelocationRangesInRange(m_object, addr, size, &count); + vector<pair<uint64_t, uint64_t>> result(count); + for (size_t i = 0; i < count; i++) + { + result.push_back({ranges[i].start, ranges[i].end}); + } + BNFreeRelocationRanges(ranges); + return result; + +} + + bool BinaryView::RangeContainsRelocation(uint64_t addr, size_t size) const { return BNRangeContainsRelocation(m_object, addr, size); @@ -1878,15 +1859,33 @@ uint64_t BinaryView::GetNextValidOffset(uint64_t offset) const } +uint64_t BinaryView::GetImageBase() const +{ + return BNGetImageBase(m_object); +} + + +uint64_t BinaryView::GetOriginalImageBase() const +{ + return BNGetOriginalImageBase(m_object); +} + + +void BinaryView::SetOriginalImageBase(uint64_t imageBase) +{ + return BNSetOriginalImageBase(m_object, imageBase); +} + + uint64_t BinaryView::GetOriginalBase() const { - return BNGetOriginalBase(m_object); + return BNGetOriginalImageBase(m_object); } void BinaryView::SetOriginalBase(uint64_t base) { - return BNSetOriginalBase(m_object, base); + return BNSetOriginalImageBase(m_object, base); } @@ -4885,6 +4884,42 @@ vector<string> BinaryView::GetUniqueSectionNames(const vector<string>& names) } +vector<BNAddressRange> BinaryView::GetAllocatedRanges() +{ + size_t count; + BNAddressRange* ranges = BNGetAllocatedRanges(m_object, &count); + + vector<BNAddressRange> result; + copy(&ranges[0], &ranges[count], back_inserter(result)); + BNFreeAddressRanges(ranges); + return result; +} + + +vector<BNAddressRange> BinaryView::GetMappedAddressRanges() +{ + size_t count; + BNAddressRange* ranges = BNGetMappedAddressRanges(m_object, &count); + + vector<BNAddressRange> result; + copy(&ranges[0], &ranges[count], back_inserter(result)); + BNFreeAddressRanges(ranges); + return result; +} + + +vector<BNAddressRange> BinaryView::GetBackedAddressRanges() +{ + size_t count; + BNAddressRange* ranges = BNGetBackedAddressRanges(m_object, &count); + + vector<BNAddressRange> result; + copy(&ranges[0], &ranges[count], back_inserter(result)); + BNFreeAddressRanges(ranges); + return result; +} + + string BinaryView::GetCommentForAddress(uint64_t addr) const { char* comment = BNGetGlobalCommentForAddress(m_object, addr); @@ -4911,18 +4946,6 @@ void BinaryView::SetCommentForAddress(uint64_t addr, const string& comment) } -vector<BNAddressRange> BinaryView::GetAllocatedRanges() -{ - size_t count; - BNAddressRange* ranges = BNGetAllocatedRanges(m_object, &count); - - vector<BNAddressRange> result; - copy(&ranges[0], &ranges[count], back_inserter(result)); - BNFreeAddressRanges(ranges); - return result; -} - - void BinaryView::StoreMetadata(const std::string& key, Ref<Metadata> inValue, bool isAuto) { if (!inValue) |
