summaryrefslogtreecommitdiff
path: root/view/sharedcache
diff options
context:
space:
mode:
authorMark Rowe <mrowe@bdash.net.nz>2025-05-02 11:04:25 -0700
committerMark Rowe <mrowe@bdash.net.nz>2025-05-02 11:07:28 -0700
commitbc9f8871da54a3b5e20135d0452a21ce2bac96d9 (patch)
treeaecf33cb3426a4b59db9c3051871cbb51c3931f4 /view/sharedcache
parente34544ca4c13d3c5794a3eca2eaeb48ee150c765 (diff)
[SharedCache] Have VirtualMemoryReader get the address size from the underlying VirtualMemory
Diffstat (limited to 'view/sharedcache')
-rw-r--r--view/sharedcache/core/ObjC.cpp2
-rw-r--r--view/sharedcache/core/VirtualMemory.cpp5
-rw-r--r--view/sharedcache/core/VirtualMemory.h3
3 files changed, 4 insertions, 6 deletions
diff --git a/view/sharedcache/core/ObjC.cpp b/view/sharedcache/core/ObjC.cpp
index 2e37fd27..98fc42bb 100644
--- a/view/sharedcache/core/ObjC.cpp
+++ b/view/sharedcache/core/ObjC.cpp
@@ -88,7 +88,7 @@ std::shared_ptr<ObjCReader> SharedCacheObjCProcessor::GetReader()
// TODO: This should never happen.
if (!controller)
throw std::runtime_error("SharedCacheController not found for SharedCacheObjCProcessor::GetReader!");
- auto reader = VirtualMemoryReader(controller->GetCache().GetVirtualMemory(), m_data->GetAddressSize());
+ auto reader = VirtualMemoryReader(controller->GetCache().GetVirtualMemory());
return std::make_shared<SharedCacheObjCReader>(reader);
}
diff --git a/view/sharedcache/core/VirtualMemory.cpp b/view/sharedcache/core/VirtualMemory.cpp
index 292cda06..47206467 100644
--- a/view/sharedcache/core/VirtualMemory.cpp
+++ b/view/sharedcache/core/VirtualMemory.cpp
@@ -178,10 +178,9 @@ void VirtualMemory::Read(void* dest, uint64_t address, size_t length)
region->fileAccessor.lock()->Read(dest, offset, length);
}
-VirtualMemoryReader::VirtualMemoryReader(std::shared_ptr<VirtualMemory> memory, uint64_t addressSize)
+VirtualMemoryReader::VirtualMemoryReader(std::shared_ptr<VirtualMemory> memory)
{
m_memory = memory;
- m_addressSize = addressSize;
m_cursor = 0;
}
@@ -265,7 +264,7 @@ uint64_t VirtualMemoryReader::ReadPointer()
uint64_t VirtualMemoryReader::ReadPointer(uint64_t address)
{
- m_cursor = address + m_addressSize;
+ m_cursor = address + m_memory->GetAddressSize();
return m_memory->ReadPointer(address);
}
diff --git a/view/sharedcache/core/VirtualMemory.h b/view/sharedcache/core/VirtualMemory.h
index fcaf5c07..c4eb5a70 100644
--- a/view/sharedcache/core/VirtualMemory.h
+++ b/view/sharedcache/core/VirtualMemory.h
@@ -94,11 +94,10 @@ class VirtualMemoryReader
{
std::shared_ptr<VirtualMemory> m_memory;
uint64_t m_cursor;
- uint64_t m_addressSize;
BNEndianness m_endianness = LittleEndian;
public:
- explicit VirtualMemoryReader(std::shared_ptr<VirtualMemory> memory, uint64_t addressSize = 8);
+ explicit VirtualMemoryReader(std::shared_ptr<VirtualMemory> memory);
void SetEndianness(BNEndianness endianness) { m_endianness = endianness; }