summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binaryninjaapi.h105
-rw-r--r--binaryninjacore.h59
-rw-r--r--binaryview.cpp119
-rw-r--r--examples/triage/byte.cpp37
-rw-r--r--examples/triage/byte.h1
-rw-r--r--python/binaryview.py166
-rw-r--r--rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs2
-rw-r--r--rust/src/binaryview.rs8
-rw-r--r--ui/featuremap.h27
-rw-r--r--ui/logview.h2
-rw-r--r--view/elf/elfview.cpp2
-rw-r--r--view/macho/machoview.cpp2
-rw-r--r--view/pe/peview.cpp2
13 files changed, 297 insertions, 235 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index f7362240..e0fbfb50 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -4218,11 +4218,6 @@ namespace BinaryNinja {
uint32_t GetFlags() const;
bool IsAutoDefined() const;
- std::vector<std::pair<uint64_t, uint64_t>> GetRelocationRanges() const;
- std::vector<std::pair<uint64_t, uint64_t>> GetRelocationRangesAtAddress(uint64_t addr) const;
- std::vector<Ref<Relocation>> GetRelocationsInRange(uint64_t addr, uint64_t size) const;
- uint64_t GetRelocationsCount() const;
-
void SetLength(uint64_t length);
void SetDataOffset(uint64_t dataOffset);
void SetDataLength(uint64_t dataLength);
@@ -4823,7 +4818,29 @@ namespace BinaryNinja {
*/
uint64_t GetNextValidOffset(uint64_t offset) const;
+ /*! GetImageBase queries for the image base in the BinaryView
+
+ \return the image base of the BinaryView
+ */
+ uint64_t GetImageBase() const;
+
+ /*! GetOriginalImageBase queries for the original image base in the BinaryView, unaffected by any rebasing operations
+
+ \return the original image base of the BinaryView
+ */
+ uint64_t GetOriginalImageBase() const;
+
+ /*! SetOriginalBase sets the original image base in the BinaryView, unaffected by any rebasing operations.
+ * This is only intended to be used by Binary View implementations to provide this value. Regular users should
+ * NOT change this value.
+
+ \param imageBase the original image base of the binary view
+ */
+ void SetOriginalImageBase(uint64_t imageBase);
+
+
/*! GetOriginalBase queries for the original image base in the BinaryView, unaffected by any rebasing operations
+ \deprecated This API has been deprecated in favor of GetOriginalImageBase in 4.0.xxxx
\return the original image base of the BinaryView
*/
@@ -4832,6 +4849,7 @@ namespace BinaryNinja {
/*! SetOriginalBase sets the original image base in the BinaryView, unaffected by any rebasing operations.
* This is only intended to be used by Binary View implementations to provide this value. Regular users should
* NOT change this value.
+ \deprecated This API has been deprecated in favor of SetOriginalImageBase in 4.0.xxxx
\param base the original image base of the binary view
*/
@@ -4926,6 +4944,7 @@ namespace BinaryNinja {
void DefineRelocation(Architecture* arch, BNRelocationInfo& info, Ref<Symbol> target, uint64_t reloc);
std::vector<std::pair<uint64_t, uint64_t>> GetRelocationRanges() const;
std::vector<std::pair<uint64_t, uint64_t>> GetRelocationRangesAtAddress(uint64_t addr) const;
+ std::vector<std::pair<uint64_t, uint64_t>> GetRelocationRangesInRange(uint64_t addr, size_t size) const;
bool RangeContainsRelocation(uint64_t addr, size_t size) const;
std::vector<Ref<Relocation>> GetRelocationsAt(uint64_t addr) const;
@@ -6499,6 +6518,25 @@ namespace BinaryNinja {
*/
std::vector<std::string> GetUniqueSectionNames(const std::vector<std::string>& names);
+ /*! Get the list of allocated ranges
+ \deprecated This API has been deprecated in favor of GetMappedAddressRanges in 4.0.xxxx
+
+ \return The list of allocated ranges
+ */
+ std::vector<BNAddressRange> GetAllocatedRanges();
+
+ /*! Get the list of ranges mapped into the address space
+
+ \return The list of mapped ranges
+ */
+ std::vector<BNAddressRange> GetMappedAddressRanges();
+
+ /*! Get the list of ranges that are mapped into the address space and are backed by a target object
+
+ \return The list of backed ranges
+ */
+ std::vector<BNAddressRange> GetBackedAddressRanges();
+
/*! Get the comment placed at an address
\param addr Address at which to check for a comment
@@ -6519,12 +6557,6 @@ namespace BinaryNinja {
*/
void SetCommentForAddress(uint64_t addr, const std::string& comment);
- /*! Get the list of allocated ranges
-
- \return The list of allocated ranges
- */
- std::vector<BNAddressRange> GetAllocatedRanges();
-
void StoreMetadata(const std::string& key, Ref<Metadata> value, bool isAuto = false);
Ref<Metadata> QueryMetadata(const std::string& key);
void RemoveMetadata(const std::string& key);
@@ -6704,19 +6736,19 @@ namespace BinaryNinja {
MemoryMap(BNBinaryView* view): m_object(view) {}
~MemoryMap() = default;
- bool AddBinaryMemoryRegion(const std::string& name, uint64_t start, Ref<BinaryView> source)
+ bool AddBinaryMemoryRegion(const std::string& name, uint64_t start, Ref<BinaryView> source, uint32_t flags = 0)
{
- return BNAddBinaryMemoryRegion(m_object, name.c_str(), start, source->GetObject());
+ return BNAddBinaryMemoryRegion(m_object, name.c_str(), start, source->GetObject(), flags);
}
- bool AddDataMemoryRegion(const std::string& name, uint64_t start, const DataBuffer& source)
+ bool AddDataMemoryRegion(const std::string& name, uint64_t start, const DataBuffer& source, uint32_t flags = 0)
{
- return BNAddDataMemoryRegion(m_object, name.c_str(), start, source.GetBufferObject());
+ return BNAddDataMemoryRegion(m_object, name.c_str(), start, source.GetBufferObject(), flags);
}
- bool AddRemoteMemoryRegion(const std::string& name, uint64_t start, FileAccessor* source)
+ bool AddRemoteMemoryRegion(const std::string& name, uint64_t start, FileAccessor* source, uint32_t flags = 0)
{
- return BNAddRemoteMemoryRegion(m_object, name.c_str(), start, source->GetCallbacks());
+ return BNAddRemoteMemoryRegion(m_object, name.c_str(), start, source->GetCallbacks(), flags);
}
bool RemoveMemoryRegion(const std::string& name)
@@ -6724,19 +6756,37 @@ namespace BinaryNinja {
return BNRemoveMemoryRegion(m_object, name.c_str());
}
- bool IsMemoryRegionEnabled(const std::string& name, uint64_t start)
+ std::string GetActiveMemoryRegionAt(uint64_t addr)
+ {
+ char* name = BNGetActiveMemoryRegionAt(m_object, addr);
+ std::string result = name;
+ BNFreeString(name);
+ return result;
+ }
+
+ bool IsMemoryRegionEnabled(const std::string& name)
+ {
+ return BNIsMemoryRegionEnabled(m_object, name.c_str());
+ }
+
+ bool SetMemoryRegionEnabled(const std::string& name, bool enabled)
+ {
+ return BNSetMemoryRegionEnabled(m_object, name.c_str(), enabled);
+ }
+
+ bool IsMemoryRegionRebaseable(const std::string& name)
{
- return BNIsMemoryRegionEnabled(m_object, name.c_str(), start);
+ return BNIsMemoryRegionRebaseable(m_object, name.c_str());
}
- bool SetMemoryRegionEnabled(const std::string& name, uint64_t start, bool enabled)
+ bool SetMemoryRegionRebaseable(const std::string& name, bool rebaseable)
{
- return BNSetMemoryRegionEnabled(m_object, name.c_str(), start, enabled);
+ return BNSetMemoryRegionRebaseable(m_object, name.c_str(), rebaseable);
}
- bool SetMemoryRegionFill(const std::string& name, uint64_t start, uint8_t fill)
+ bool SetMemoryRegionFill(const std::string& name, uint8_t fill)
{
- return BNSetMemoryRegionFill(m_object, name.c_str(), start, fill);
+ return BNSetMemoryRegionFill(m_object, name.c_str(), fill);
}
void Reset()
@@ -8111,16 +8161,13 @@ namespace BinaryNinja {
// These three binary view type constant APIs are deprecated and should no longer be used. Their implementations
// have been removed, and they now have no effects.
- /*! \deprecated This API has been deprecated. The implementation has been removed, and this function no
- longer has any effect
+ /*! \deprecated This API has been deprecated. The implementation has been removed, and this function no longer has any effect
*/
bool IsBinaryViewTypeConstantDefined(const std::string& type, const std::string& name);
- /*! \deprecated This API has been deprecated. The implementation has been removed, and this function no
- longer has any effect
+ /*! \deprecated This API has been deprecated. The implementation has been removed, and this function no longer has any effect
*/
uint64_t GetBinaryViewTypeConstant(const std::string& type, const std::string& name, uint64_t defaultValue = 0);
- /*! \deprecated This API has been deprecated. The implementation has been removed, and this function no
- longer has any effect
+ /*! \deprecated This API has been deprecated. The implementation has been removed, and this function no longer has any effect
*/
void SetBinaryViewTypeConstant(const std::string& type, const std::string& name, uint64_t value);
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 6c83924a..cc9f2019 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -37,14 +37,14 @@
// Current ABI version for linking to the core. This is incremented any time
// there are changes to the API that affect linking, including new functions,
// new types, or modifications to existing functions or types.
-#define BN_CURRENT_CORE_ABI_VERSION 66
+#define BN_CURRENT_CORE_ABI_VERSION 67
// Minimum ABI version that is supported for loading of plugins. Plugins that
// are linked to an ABI version less than this will not be able to load and
// will require rebuilding. The minimum version is increased when there are
// incompatible changes that break binary compatibility, such as changes to
// existing types or functions.
-#define BN_MINIMUM_CORE_ABI_VERSION 65
+#define BN_MINIMUM_CORE_ABI_VERSION 67
#ifdef __GNUC__
#ifdef BINARYNINJACORE_LIBRARY
@@ -3771,13 +3771,16 @@ extern "C"
// Memory Map
BINARYNINJACOREAPI char* BNGetMemoryMapDescription(BNBinaryView* view);
- BINARYNINJACOREAPI bool BNAddBinaryMemoryRegion(BNBinaryView* view, const char* name, uint64_t start, BNBinaryView* data);
- BINARYNINJACOREAPI bool BNAddDataMemoryRegion(BNBinaryView* view, const char* name, uint64_t start, BNDataBuffer* data);
- BINARYNINJACOREAPI bool BNAddRemoteMemoryRegion(BNBinaryView* view, const char* name, uint64_t start, BNFileAccessor* accessor);
+ BINARYNINJACOREAPI bool BNAddBinaryMemoryRegion(BNBinaryView* view, const char* name, uint64_t start, BNBinaryView* data, uint32_t flags);
+ BINARYNINJACOREAPI bool BNAddDataMemoryRegion(BNBinaryView* view, const char* name, uint64_t start, BNDataBuffer* data, uint32_t flags);
+ BINARYNINJACOREAPI bool BNAddRemoteMemoryRegion(BNBinaryView* view, const char* name, uint64_t start, BNFileAccessor* accessor, uint32_t flags);
BINARYNINJACOREAPI bool BNRemoveMemoryRegion(BNBinaryView* view, const char* name);
- BINARYNINJACOREAPI bool BNIsMemoryRegionEnabled(BNBinaryView* view, const char* name, uint64_t start);
- BINARYNINJACOREAPI bool BNSetMemoryRegionEnabled(BNBinaryView* view, const char* name, uint64_t start, bool enable);
- BINARYNINJACOREAPI bool BNSetMemoryRegionFill(BNBinaryView* view, const char* name, uint64_t start, uint8_t fill);
+ BINARYNINJACOREAPI char* BNGetActiveMemoryRegionAt(BNBinaryView* view, uint64_t addr);
+ BINARYNINJACOREAPI bool BNIsMemoryRegionEnabled(BNBinaryView* view, const char* name);
+ BINARYNINJACOREAPI bool BNSetMemoryRegionEnabled(BNBinaryView* view, const char* name, bool enable);
+ BINARYNINJACOREAPI bool BNIsMemoryRegionRebaseable(BNBinaryView* view, const char* name);
+ BINARYNINJACOREAPI bool BNSetMemoryRegionRebaseable(BNBinaryView* view, const char* name, bool rebaseable);
+ BINARYNINJACOREAPI bool BNSetMemoryRegionFill(BNBinaryView* view, const char* name, uint8_t fill);
BINARYNINJACOREAPI void BNResetMemoryMap(BNBinaryView* view);
// Binary view access
@@ -3817,8 +3820,10 @@ extern "C"
BINARYNINJACOREAPI bool BNIsOffsetExternSemantics(BNBinaryView* view, uint64_t offset);
BINARYNINJACOREAPI bool BNIsOffsetWritableSemantics(BNBinaryView* view, uint64_t offset);
BINARYNINJACOREAPI uint64_t BNGetNextValidOffset(BNBinaryView* view, uint64_t offset);
- BINARYNINJACOREAPI uint64_t BNGetOriginalBase(BNBinaryView* view);
- BINARYNINJACOREAPI void BNSetOriginalBase(BNBinaryView* view, uint64_t base);
+
+ BINARYNINJACOREAPI uint64_t BNGetImageBase(BNBinaryView* view);
+ BINARYNINJACOREAPI uint64_t BNGetOriginalImageBase(BNBinaryView* view);
+ BINARYNINJACOREAPI void BNSetOriginalImageBase(BNBinaryView* view, uint64_t imageBase);
BINARYNINJACOREAPI uint64_t BNGetStartOffset(BNBinaryView* view);
BINARYNINJACOREAPI uint64_t BNGetEndOffset(BNBinaryView* view);
BINARYNINJACOREAPI uint64_t BNGetViewLength(BNBinaryView* view);
@@ -3837,15 +3842,16 @@ extern "C"
BINARYNINJACOREAPI bool BNSaveToFile(BNBinaryView* view, BNFileAccessor* file);
BINARYNINJACOREAPI bool BNSaveToFilename(BNBinaryView* view, const char* filename);
- BINARYNINJACOREAPI void BNDefineRelocation(
- BNBinaryView* view, BNArchitecture* arch, BNRelocationInfo* info, uint64_t target, uint64_t reloc);
- BINARYNINJACOREAPI void BNDefineSymbolRelocation(
- BNBinaryView* view, BNArchitecture* arch, BNRelocationInfo* info, BNSymbol* target, uint64_t reloc);
+
+ BINARYNINJACOREAPI void BNDefineRelocation(BNBinaryView* view, BNArchitecture* arch, BNRelocationInfo* info, uint64_t target, uint64_t reloc);
+ BINARYNINJACOREAPI void BNDefineSymbolRelocation(BNBinaryView* view, BNArchitecture* arch, BNRelocationInfo* info, BNSymbol* target, uint64_t reloc);
BINARYNINJACOREAPI BNRange* BNGetRelocationRanges(BNBinaryView* view, size_t* count);
BINARYNINJACOREAPI BNRange* BNGetRelocationRangesAtAddress(BNBinaryView* view, uint64_t addr, size_t* count);
+ BINARYNINJACOREAPI BNRange* BNGetRelocationRangesInRange(BNBinaryView* view, uint64_t addr, uint64_t size, size_t* count);
BINARYNINJACOREAPI bool BNRangeContainsRelocation(BNBinaryView* view, uint64_t addr, size_t size);
BINARYNINJACOREAPI BNRelocation** BNGetRelocationsAt(BNBinaryView* view, uint64_t addr, size_t* count);
BINARYNINJACOREAPI void BNFreeRelocationList(BNRelocation** relocations, size_t count);
+ BINARYNINJACOREAPI void BNFreeRelocationRanges(BNRange* ranges);
BINARYNINJACOREAPI void BNRegisterDataNotification(BNBinaryView* view, BNBinaryDataNotification* notify);
BINARYNINJACOREAPI void BNUnregisterDataNotification(BNBinaryView* view, BNBinaryDataNotification* notify);
@@ -3903,11 +3909,9 @@ extern "C"
BINARYNINJACOREAPI bool BNSearch(BNBinaryView* view, const char* query, void* context, bool (*callback)(void*, uint64_t, BNDataBuffer*));
BINARYNINJACOREAPI bool BNPerformSearch(const char* query, const uint8_t* buffer, size_t size, bool(*callback)(void*, size_t, size_t), void* context);
- BINARYNINJACOREAPI void BNAddAutoSegment(
- BNBinaryView* view, uint64_t start, uint64_t length, uint64_t dataOffset, uint64_t dataLength, uint32_t flags);
+ BINARYNINJACOREAPI void BNAddAutoSegment(BNBinaryView* view, uint64_t start, uint64_t length, uint64_t dataOffset, uint64_t dataLength, uint32_t flags);
BINARYNINJACOREAPI void BNRemoveAutoSegment(BNBinaryView* view, uint64_t start, uint64_t length);
- BINARYNINJACOREAPI void BNAddUserSegment(
- BNBinaryView* view, uint64_t start, uint64_t length, uint64_t dataOffset, uint64_t dataLength, uint32_t flags);
+ BINARYNINJACOREAPI void BNAddUserSegment(BNBinaryView* view, uint64_t start, uint64_t length, uint64_t dataOffset, uint64_t dataLength, uint32_t flags);
BINARYNINJACOREAPI void BNRemoveUserSegment(BNBinaryView* view, uint64_t start, uint64_t length);
BINARYNINJACOREAPI BNSegment** BNGetSegments(BNBinaryView* view, size_t* count);
BINARYNINJACOREAPI void BNFreeSegmentList(BNSegment** segments, size_t count);
@@ -3936,18 +3940,19 @@ extern "C"
BINARYNINJACOREAPI BNSection** BNGetSectionsAt(BNBinaryView* view, uint64_t addr, size_t* count);
BINARYNINJACOREAPI void BNFreeSectionList(BNSection** sections, size_t count);
BINARYNINJACOREAPI BNSection* BNGetSectionByName(BNBinaryView* view, const char* name);
-
BINARYNINJACOREAPI char** BNGetUniqueSectionNames(BNBinaryView* view, const char** names, size_t count);
+ BINARYNINJACOREAPI BNAddressRange* BNGetAllocatedRanges(BNBinaryView* view, size_t* count);
+ BINARYNINJACOREAPI BNAddressRange* BNGetMappedAddressRanges(BNBinaryView* view, size_t* count);
+ BINARYNINJACOREAPI BNAddressRange* BNGetBackedAddressRanges(BNBinaryView* view, size_t* count);
+ BINARYNINJACOREAPI void BNFreeAddressRanges(BNAddressRange* ranges);
+
BINARYNINJACOREAPI BNNameSpace* BNGetNameSpaces(BNBinaryView* view, size_t* count);
BINARYNINJACOREAPI void BNFreeNameSpaceList(BNNameSpace* nameSpace, size_t count);
BINARYNINJACOREAPI BNNameSpace BNGetExternalNameSpace(void);
BINARYNINJACOREAPI BNNameSpace BNGetInternalNameSpace(void);
BINARYNINJACOREAPI void BNFreeNameSpace(BNNameSpace* name);
- BINARYNINJACOREAPI BNAddressRange* BNGetAllocatedRanges(BNBinaryView* view, size_t* count);
- BINARYNINJACOREAPI void BNFreeAddressRanges(BNAddressRange* ranges);
-
BINARYNINJACOREAPI BNRegisterValueWithConfidence BNGetGlobalPointerValue(BNBinaryView* view);
// Raw binary data view
@@ -6985,17 +6990,11 @@ extern "C"
BINARYNINJACOREAPI uint64_t BNRelocationGetTarget(BNRelocation* reloc);
BINARYNINJACOREAPI uint64_t BNRelocationGetReloc(BNRelocation* reloc);
BINARYNINJACOREAPI BNSymbol* BNRelocationGetSymbol(BNRelocation* reloc);
+
// Segment object methods
- BINARYNINJACOREAPI BNSegment* BNCreateSegment(
- uint64_t start, uint64_t length, uint64_t dataOffset, uint64_t dataLength, uint32_t flags, bool autoDefined);
+ BINARYNINJACOREAPI BNSegment* BNCreateSegment(uint64_t start, uint64_t length, uint64_t dataOffset, uint64_t dataLength, uint32_t flags, bool autoDefined);
BINARYNINJACOREAPI BNSegment* BNNewSegmentReference(BNSegment* seg);
BINARYNINJACOREAPI void BNFreeSegment(BNSegment* seg);
-
- BINARYNINJACOREAPI BNRange* BNSegmentGetRelocationRanges(BNSegment* segment, size_t* count);
- BINARYNINJACOREAPI uint64_t BNSegmentGetRelocationsCount(BNSegment* segment);
- BINARYNINJACOREAPI BNRange* BNSegmentGetRelocationRangesAtAddress(BNSegment* segment, uint64_t addr, size_t* count);
- BINARYNINJACOREAPI bool BNSegmentRangeContainsRelocation(BNSegment* segment, uint64_t addr, size_t size);
- BINARYNINJACOREAPI void BNFreeRelocationRanges(BNRange* ranges);
BINARYNINJACOREAPI uint64_t BNSegmentGetStart(BNSegment* segment);
BINARYNINJACOREAPI uint64_t BNSegmentGetLength(BNSegment* segment);
BINARYNINJACOREAPI uint64_t BNSegmentGetEnd(BNSegment* segment);
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)
diff --git a/examples/triage/byte.cpp b/examples/triage/byte.cpp
index 79e3bd50..3acab281 100644
--- a/examples/triage/byte.cpp
+++ b/examples/triage/byte.cpp
@@ -160,48 +160,13 @@ void ByteView::setSelectionOffsets(BNAddressRange range)
void ByteView::updateRanges()
{
- m_ranges = m_data->GetAllocatedRanges();
- // Remove regions not backed by the file
- for (auto& i : m_data->GetSegments())
- if (i->GetDataLength() < i->GetLength())
- removeRange(i->GetStart() + i->GetDataLength(), i->GetEnd());
+ m_ranges = m_data->GetBackedAddressRanges();
m_allocatedLength = 0;
for (auto& i : m_ranges)
m_allocatedLength += i.end - i.start;
}
-void ByteView::removeRange(uint64_t begin, uint64_t end)
-{
- std::vector<BNAddressRange> newRanges;
- for (auto& i : m_ranges)
- {
- if ((end <= i.start) || (begin >= i.end))
- {
- newRanges.push_back(i);
- }
- else if ((begin <= i.start) && (end >= i.end))
- {
- continue;
- }
- else if ((begin <= i.start) && (end < i.end))
- {
- newRanges.push_back(BNAddressRange {end, i.end});
- }
- else if ((begin > i.start) && (end >= i.end))
- {
- newRanges.push_back(BNAddressRange {i.start, begin});
- }
- else
- {
- newRanges.push_back(BNAddressRange {i.start, begin});
- newRanges.push_back(BNAddressRange {end, i.end});
- }
- }
- m_ranges = newRanges;
-}
-
-
void ByteView::setTopToAddress(uint64_t addr)
{
for (auto& i : m_ranges)
diff --git a/examples/triage/byte.h b/examples/triage/byte.h
index 1c8c20f8..53a037e7 100644
--- a/examples/triage/byte.h
+++ b/examples/triage/byte.h
@@ -40,7 +40,6 @@ class ByteView : public QAbstractScrollArea, public View
QTimer* m_cursorTimer;
void updateRanges();
- void removeRange(uint64_t begin, uint64_t end);
void setTopToAddress(uint64_t addr);
diff --git a/python/binaryview.py b/python/binaryview.py
index a18f8d8d..f1d5ff79 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -1528,36 +1528,9 @@ class Segment:
return core.BNSegmentGetDataEnd(self.handle)
@property
- def relocation_count(self) -> int:
- return core.BNSegmentGetRelocationsCount(self.handle)
-
- @property
def auto_defined(self) -> bool:
return core.BNSegmentIsAutoDefined(self.handle)
- @property
- def relocation_ranges(self) -> List[Tuple[int, int]]:
- """List of relocation range tuples (read-only)"""
-
- count = ctypes.c_ulonglong()
- ranges = core.BNSegmentGetRelocationRanges(self.handle, count)
- assert ranges is not None, "core.BNSegmentGetRelocationRanges returned None"
- try:
- return [(ranges[i].start, ranges[i].end) for i in range(count.value)]
- finally:
- core.BNFreeRelocationRanges(ranges)
-
- def relocation_ranges_at(self, addr: int) -> List[Tuple[int, int]]:
- """List of relocation range tuples (read-only)"""
-
- count = ctypes.c_ulonglong()
- ranges = core.BNSegmentGetRelocationRangesAtAddress(self.handle, addr, count)
- assert ranges is not None, "core.BNSegmentGetRelocationRangesAtAddress returned None"
- try:
- return [(ranges[i].start, ranges[i].end) for i in range(count.value)]
- finally:
- core.BNFreeRelocationRanges(ranges)
-
class Section:
"""
@@ -2135,35 +2108,35 @@ class MemoryMap:
<region: 0x10000 - 0x10004>
size: 0x4
objects:
- 'origin<Mapped>' | Mapped<Absolute>
+ 'origin<Mapped>@0x0' | Mapped<Absolute> | <r-x>
<region: 0xc0000000 - 0xc0001000>
size: 0x1000
objects:
- 'origin<Mapped>' | Unmapped | FILL<0x0>
+ 'origin<Mapped>@0xbfff0000' | Unmapped | <r--> | FILL<0x0>
<region: 0xc0001000 - 0xc0001014>
size: 0x14
objects:
- 'origin<Mapped>' | Unmapped | FILL<0x0>
- >>> view.memory_map.add_memory_region("rom", rom_base, b'\x90' * 4096)
+ 'origin<Mapped>@0xbfff1000' | Unmapped | <---> | FILL<0x0>
+ >>> view.memory_map.add_memory_region("rom", rom_base, b'\x90' * 4096, SegmentFlag.SegmentReadable | SegmentFlag.SegmentExecutable)
True
>>> print(view.memory_map)
<region: 0x10000 - 0x10004>
size: 0x4
objects:
- 'origin<Mapped>' | Mapped<Absolute>
+ 'origin<Mapped>@0x0' | Mapped<Absolute> | <r-x>
<region: 0xc0000000 - 0xc0001000>
size: 0x1000
objects:
- 'rom' | Mapped
- 'origin<Mapped>' | Unmapped | FILL<0x0>
+ 'rom' | Mapped<Relative> | <r-x>
+ 'origin<Mapped>@0xbfff0000' | Unmapped | <r--> | FILL<0x0>
<region: 0xc0001000 - 0xc0001014>
size: 0x14
objects:
- 'origin<Mapped>' | Unmapped | FILL<0x0>
+ 'origin<Mapped>@0xbfff1000' | Unmapped | <---> | FILL<0x0>
>>> view.read(rom_base, 16)
b'\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90'
>>> view.memory_map.add_memory_region("pad", rom_base, b'\xa5' * 8)
@@ -2174,25 +2147,25 @@ class MemoryMap:
<region: 0x10000 - 0x10004>
size: 0x4
objects:
- 'origin<Mapped>' | Mapped<Absolute>
+ 'origin<Mapped>@0x0' | Mapped<Absolute> | <r-x>
<region: 0xc0000000 - 0xc0000008>
size: 0x8
objects:
- 'pad' | Mapped<Relative>
- 'rom' | Mapped<Relative>
- 'origin<Mapped>' | Unmapped | FILL<0x0>
+ 'pad' | Mapped<Relative> | <--->
+ 'rom' | Mapped<Relative> | <r-x>
+ 'origin<Mapped>@0xbfff0000' | Unmapped | <r--> | FILL<0x0>
<region: 0xc0000008 - 0xc0001000>
size: 0xff8
objects:
- 'rom' | Mapped<Relative>
- 'origin<Mapped>' | Unmapped | FILL<0x0>
+ 'rom' | Mapped<Relative> | <r-x>
+ 'origin<Mapped>@0xbfff0000' | Unmapped | <r--> | FILL<0x0>
<region: 0xc0001000 - 0xc0001014>
size: 0x14
objects:
- 'origin<Mapped>' | Unmapped | FILL<0x0>
+ 'origin<Mapped>@0xbfff1000' | Unmapped | <---> | FILL<0x0>
"""
def __repr__(self):
@@ -2211,6 +2184,10 @@ class MemoryMap:
else:
mapped_state = "Unmapped"
formatted_description += f"\t\t'{obj['name']}' | {mapped_state}"
+ r = "r" if obj['flags'] & SegmentFlag.SegmentReadable else "-"
+ w = "w" if obj['flags'] & SegmentFlag.SegmentWritable else "-"
+ x = "x" if obj['flags'] & SegmentFlag.SegmentExecutable else "-"
+ formatted_description += f" | <{r}{w}{x}>"
if not obj['target']:
formatted_description += f" | FILL<{hex(obj['fill'])}>"
if not obj['enabled']:
@@ -2233,7 +2210,7 @@ class MemoryMap:
def description(self):
return json.loads(core.BNGetMemoryMapDescription(self.handle))
- def add_memory_region(self, name: str, start: int, source: Union['os.PathLike', str, bytes, bytearray, 'BinaryView', 'databuffer.DataBuffer', 'fileaccessor.FileAccessor']) -> bool:
+ def add_memory_region(self, name: str, start: int, source: Union['os.PathLike', str, bytes, bytearray, 'BinaryView', 'databuffer.DataBuffer', 'fileaccessor.FileAccessor'], flags: SegmentFlag = 0) -> bool:
"""
Adds a memory region into the memory map. There are three types of memory regions that can be added:
- BinaryMemoryRegion(*** Unimplemented ***): Creates a memory region from a loadable binary format and provides persistence across sessions.
@@ -2272,25 +2249,34 @@ class MemoryMap:
name = ""
if isinstance(source, BinaryView):
- return core.BNAddBinaryMemoryRegion(self.handle, name, start, source.handle)
+ return core.BNAddBinaryMemoryRegion(self.handle, name, start, source.handle, flags)
elif isinstance(source, databuffer.DataBuffer):
- return core.BNAddDataMemoryRegion(self.handle, name, start, source.handle)
+ return core.BNAddDataMemoryRegion(self.handle, name, start, source.handle, flags)
elif isinstance(source, fileaccessor.FileAccessor):
- return core.BNAddRemoteMemoryRegion(self.handle, name, start, source._cb)
+ return core.BNAddRemoteMemoryRegion(self.handle, name, start, source._cb, flags)
else:
raise NotImplementedError
def remove_memory_region(self, name: str) -> bool:
return core.BNRemoveMemoryRegion(self.handle, name)
- def is_memory_region_enabled(self, name: str, start: int) -> bool:
- return core.BNIsMemoryRegionEnabled(self.handle, name, start)
+ def get_active_memory_region_at(self, addr: int) -> str:
+ return core.BNGetActiveMemoryRegionAt(self.handle, addr)
+
+ def is_memory_region_enabled(self, name: str) -> bool:
+ return core.BNIsMemoryRegionEnabled(self.handle, name)
+
+ def set_memory_region_enabled(self, name: str, enabled: bool = True) -> bool:
+ return core.BNSetMemoryRegionEnabled(self.handle, name, enabled)
- def set_memory_region_enabled(self, name: str, start: int, enabled: bool = True) -> bool:
- return core.BNSetMemoryRegionEnabled(self.handle, name, start, enabled)
+ def is_memory_region_rebaseable(self, name: str) -> bool:
+ return core.BNIsMemoryRegionRebaseable(self.handle, name)
- def set_memory_region_fill(self, name: str, start: int, fill: int) -> bool:
- return core.BNSetMemoryRegionFill(self.handle, name, start, fill)
+ def set_memory_region_rebaseable(self, name: str, rebaseable: bool = True) -> bool:
+ return core.BNSetMemoryRegionRebaseable(self.handle, name, rebaseable)
+
+ def set_memory_region_fill(self, name: str, fill: int) -> bool:
+ return core.BNSetMemoryRegionFill(self.handle, name, fill)
def reset(self):
core.BNResetMemoryMap(self.handle)
@@ -2894,14 +2880,29 @@ class BinaryView:
return self._file
@property
- def original_base(self) -> int:
+ def image_base(self) -> int:
+ """Image base of the binary"""
+ return core.BNGetImageBase(self.handle)
+
+ @property
+ def original_image_base(self) -> int:
"""Original image base of the binary"""
- return core.BNGetOriginalBase(self.handle)
+ return core.BNGetOriginalImageBase(self.handle)
+
+ @original_image_base.setter
+ def original_image_base(self, image_base: int) -> None:
+ """Set original image base of the binary. Only intended for binary view implementations"""
+ return core.BNSetOriginalImageBase(self.handle, image_base)
+
+ @property
+ def original_base(self) -> int:
+ """Original image base of the binary Deprecated: 4.0.xxxx Use original_image_base instead."""
+ return core.BNGetOriginalImageBase(self.handle)
@original_base.setter
def original_base(self, base: int) -> None:
- """Set original image base of the binary. Only intended for binary view implementations"""
- return core.BNSetOriginalBase(self.handle, base)
+ """Set original image base of the binary. Only intended for binary view implementations. Deprecated: 4.0.xxxx Use original_image_base instead."""
+ return core.BNSetOriginalImageBase(self.handle, base)
@property
def start(self) -> int:
@@ -3311,7 +3312,7 @@ class BinaryView:
@property
def allocated_ranges(self) -> List['variable.AddressRange']:
- """List of valid address ranges for this view (read-only)"""
+ """List of valid address ranges for this view (read-only) Deprecated: 4.0.xxxx Use mapped_address_ranges instead."""
count = ctypes.c_ulonglong(0)
range_list = core.BNGetAllocatedRanges(self.handle, count)
assert range_list is not None, "core.BNGetAllocatedRanges returned None"
@@ -3324,6 +3325,34 @@ class BinaryView:
core.BNFreeAddressRanges(range_list)
@property
+ def mapped_address_ranges(self) -> List['variable.AddressRange']:
+ """List of mapped address ranges for this view (read-only)"""
+ count = ctypes.c_ulonglong(0)
+ range_list = core.BNGetMappedAddressRanges(self.handle, count)
+ assert range_list is not None, "core.BNGetMappedAddressRanges returned None"
+ result = []
+ try:
+ for i in range(0, count.value):
+ result.append(variable.AddressRange(range_list[i].start, range_list[i].end))
+ return result
+ finally:
+ core.BNFreeAddressRanges(range_list)
+
+ @property
+ def backed_address_ranges(self) -> List['variable.AddressRange']:
+ """List of backed address ranges for this view (read-only)"""
+ count = ctypes.c_ulonglong(0)
+ range_list = core.BNGetBackedAddressRanges(self.handle, count)
+ assert range_list is not None, "core.BNGetBackedAddressRanges returned None"
+ result = []
+ try:
+ for i in range(0, count.value):
+ result.append(variable.AddressRange(range_list[i].start, range_list[i].end))
+ return result
+ finally:
+ core.BNFreeAddressRanges(range_list)
+
+ @property
def session_data(self): # TODO add type hint
"""Dictionary object where plugins can store arbitrary data associated with the view. This data is ephemeral and not saved to a database. Consider using :py:func:`store_metadata` if permanence is needed."""
handle = ctypes.cast(self.handle, ctypes.c_void_p)
@@ -3379,6 +3408,17 @@ class BinaryView:
finally:
core.BNFreeRelocationRanges(ranges)
+ def relocation_ranges_in_range(self, addr: int, size: int) -> List[Tuple[int, int]]:
+ """List of relocation range tuples for a given range"""
+
+ count = ctypes.c_ulonglong()
+ ranges = core.BNGetRelocationRangesInRange(self.handle, addr, size, count)
+ assert ranges is not None, "core.BNGetRelocationRangesInRange returned None"
+ try:
+ return [(ranges[i].start, ranges[i].end) for i in range(count.value)]
+ finally:
+ core.BNFreeRelocationRanges(ranges)
+
def range_contains_relocation(self, addr: int, size: int) -> bool:
"""Checks if the specified range overlaps with a relocation"""
return core.BNRangeContainsRelocation(self.handle, addr, size)
@@ -4177,7 +4217,7 @@ class BinaryView:
if not (isinstance(data, bytes) or isinstance(data, bytearray) or isinstance(data, str)):
raise TypeError("Must be bytes, bytearray, or str")
buf = databuffer.DataBuffer(data)
- if except_on_relocation and self.range_contains_relocation(addr, addr + len(data)):
+ if except_on_relocation and self.range_contains_relocation(addr, len(data)):
raise RelocationWriteException("Attempting to write to a location which has a relocation")
return core.BNWriteViewBuffer(self.handle, addr, buf.handle)
@@ -10206,7 +10246,7 @@ class BinaryWriter:
if address is not None:
self.seek(address)
- if except_on_relocation and self._view.range_contains_relocation(self.offset, self.offset + len(value)):
+ if except_on_relocation and self._view.range_contains_relocation(self.offset, len(value)):
raise RelocationWriteException("Attempting to write to a location which has a relocation")
if isinstance(value, str):
value = value.decode("utf-8")
@@ -10234,7 +10274,7 @@ class BinaryWriter:
if address is not None:
self.seek(address)
- if except_on_relocation and self._view.range_contains_relocation(self.offset, self.offset + 1):
+ if except_on_relocation and self._view.range_contains_relocation(self.offset, 1):
raise RelocationWriteException("Attempting to write to a location which has a relocation")
return core.BNWrite8(self._handle, value)
@@ -10251,7 +10291,7 @@ class BinaryWriter:
if address is not None:
self.seek(address)
- if except_on_relocation and self._view.range_contains_relocation(self.offset, self.offset + 2):
+ if except_on_relocation and self._view.range_contains_relocation(self.offset, 2):
raise RelocationWriteException("Attempting to write to a location which has a relocation")
return core.BNWrite16(self._handle, value)
@@ -10268,7 +10308,7 @@ class BinaryWriter:
if address is not None:
self.seek(address)
- if except_on_relocation and self._view.range_contains_relocation(self.offset, self.offset + 4):
+ if except_on_relocation and self._view.range_contains_relocation(self.offset, 4):
raise RelocationWriteException("Attempting to write to a location which has a relocation")
return core.BNWrite32(self._handle, value)
@@ -10285,7 +10325,7 @@ class BinaryWriter:
if address is not None:
self.seek(address)
- if except_on_relocation and self._view.range_contains_relocation(self.offset, self.offset + 8):
+ if except_on_relocation and self._view.range_contains_relocation(self.offset, 8):
raise RelocationWriteException("Attempting to write to a location which has a relocation")
return core.BNWrite64(self._handle, value)
diff --git a/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs b/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs
index 4cb64138..8a050d80 100644
--- a/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs
+++ b/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs
@@ -536,7 +536,7 @@ impl DebugInfoBuilder {
}
if let Some(address) = func.address.as_mut() {
- let diff = bv.start() - bv.original_base();
+ let diff = bv.start() - bv.original_image_base();
*address += diff; // rebase the address
let existing_functions = bv.functions_at(*address);
match existing_functions.len().cmp(&1) {
diff --git a/rust/src/binaryview.rs b/rust/src/binaryview.rs
index b8bac14a..b20bc59c 100644
--- a/rust/src/binaryview.rs
+++ b/rust/src/binaryview.rs
@@ -267,15 +267,15 @@ pub trait BinaryViewExt: BinaryViewBase {
unsafe { BNIsOffsetWritableSemantics(self.as_ref().handle, offset) }
}
- fn original_base(&self) -> u64 {
+ fn original_image_base(&self) -> u64 {
unsafe {
- BNGetOriginalBase(self.as_ref().handle)
+ BNGetOriginalImageBase(self.as_ref().handle)
}
}
- fn set_original_base(&self, base: u64) {
+ fn set_original_image_base(&self, image_base: u64) {
unsafe {
- BNSetOriginalBase(self.as_ref().handle, base)
+ BNSetOriginalImageBase(self.as_ref().handle, image_base)
}
}
diff --git a/ui/featuremap.h b/ui/featuremap.h
index ec2f562a..e3040831 100644
--- a/ui/featuremap.h
+++ b/ui/featuremap.h
@@ -16,6 +16,7 @@
#include "binaryninjaapi.h"
#include "dockhandler.h"
+#include "notificationsdispatcher.h"
#include "uitypes.h"
class ContextMenuManager;
@@ -38,12 +39,14 @@ class BINARYNINJAUIAPI FeatureMap : public QWidget, public BinaryNinja::BinaryDa
Q_OBJECT
std::vector<uint8_t> m_imageData;
- QImage* m_image = nullptr;
- QImage* m_staticImage = nullptr;
- std::vector<std::pair<uint64_t, uint64_t>> m_regions;
+ std::unique_ptr<QImage> m_image = nullptr;
+ std::unique_ptr<QImage> m_staticImage = nullptr;
+ std::vector<BNAddressRange> m_ranges;
SplitPaneWidget* m_owner = nullptr;
BinaryViewRef m_data;
+ std::unique_ptr<NotificationsDispatcher> m_dispatcher = nullptr;
+ bool m_requestMappedRegionUpdate = false;
bool m_updatesPending = false;
QTimer* m_updateTimer = nullptr;
@@ -65,21 +68,8 @@ class BINARYNINJAUIAPI FeatureMap : public QWidget, public BinaryNinja::BinaryDa
Menu m_menu;
ContextMenuManager* m_contextMenuManager;
- class BackgroundRefresh : public BinaryNinja::RefCountObject
- {
- std::mutex m_mutex;
- bool m_valid;
- QPointer<FeatureMap> m_featureMap;
-
- public:
- BackgroundRefresh(FeatureMap* featureMap);
- void start();
- void abort();
- };
-
- BinaryNinja::Ref<BackgroundRefresh> m_backgroundRefresh = nullptr;
-
void updateCoordinates();
+ void updateMappedRegions();
public:
FeatureMap(SplitPaneWidget* owner, BinaryViewRef data, bool vertical = true);
@@ -120,7 +110,6 @@ protected:
void notifyThemeUpdated();
private Q_SLOTS:
- void refresh();
+ void renderAnalysisData();
void updateThemeInternal();
- void updateTimerEvent();
};
diff --git a/ui/logview.h b/ui/logview.h
index 3d0ce4cd..799eaf17 100644
--- a/ui/logview.h
+++ b/ui/logview.h
@@ -173,7 +173,7 @@ class BINARYNINJAUIAPI LogItemDelegate : public QStyledItemDelegate, public Bina
ViewFrame* m_viewFrame = nullptr;
View* m_view = nullptr;
BinaryViewRef m_data;
- std::vector<std::pair<uint64_t, uint64_t>> m_validRanges;
+ std::vector<BNAddressRange> m_mappedRanges;
QFont m_font;
int m_height;
diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp
index bcfcad7e..32d924f4 100644
--- a/view/elf/elfview.cpp
+++ b/view/elf/elfview.cpp
@@ -463,7 +463,7 @@ bool ElfView::Init()
initialImageBase = i.virtualAddress;
}
- SetOriginalBase(initialImageBase);
+ SetOriginalImageBase(initialImageBase);
uint64_t preferredImageBase = initialImageBase;
Ref<Settings> viewSettings = Settings::Instance();
m_extractMangledTypes = viewSettings->Get<bool>("analysis.extractTypesFromMangledNames", this);
diff --git a/view/macho/machoview.cpp b/view/macho/machoview.cpp
index e26cf2df..40745e0e 100644
--- a/view/macho/machoview.cpp
+++ b/view/macho/machoview.cpp
@@ -1098,7 +1098,7 @@ bool MachoView::Init()
}
}
- SetOriginalBase(initialImageBase);
+ SetOriginalImageBase(initialImageBase);
uint64_t preferredImageBase = initialImageBase;
if (settings)
{
diff --git a/view/pe/peview.cpp b/view/pe/peview.cpp
index 8e172e92..8c2f3020 100644
--- a/view/pe/peview.cpp
+++ b/view/pe/peview.cpp
@@ -590,7 +590,7 @@ bool PEView::Init()
platform = m_arch->GetStandalonePlatform();
m_imageBase = m_peImageBase = opt.imageBase;
- SetOriginalBase(m_peImageBase);
+ SetOriginalImageBase(m_peImageBase);
m_entryPoint = opt.addressOfEntry;
Ref<Settings> viewSettings = Settings::Instance();