Skip to content

Commit bc9f887

Browse files
committed
[SharedCache] Have VirtualMemoryReader get the address size from the underlying VirtualMemory
1 parent e34544c commit bc9f887

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

view/sharedcache/core/ObjC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ std::shared_ptr<ObjCReader> SharedCacheObjCProcessor::GetReader()
8888
// TODO: This should never happen.
8989
if (!controller)
9090
throw std::runtime_error("SharedCacheController not found for SharedCacheObjCProcessor::GetReader!");
91-
auto reader = VirtualMemoryReader(controller->GetCache().GetVirtualMemory(), m_data->GetAddressSize());
91+
auto reader = VirtualMemoryReader(controller->GetCache().GetVirtualMemory());
9292
return std::make_shared<SharedCacheObjCReader>(reader);
9393
}
9494

view/sharedcache/core/VirtualMemory.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,9 @@ void VirtualMemory::Read(void* dest, uint64_t address, size_t length)
178178
region->fileAccessor.lock()->Read(dest, offset, length);
179179
}
180180

181-
VirtualMemoryReader::VirtualMemoryReader(std::shared_ptr<VirtualMemory> memory, uint64_t addressSize)
181+
VirtualMemoryReader::VirtualMemoryReader(std::shared_ptr<VirtualMemory> memory)
182182
{
183183
m_memory = memory;
184-
m_addressSize = addressSize;
185184
m_cursor = 0;
186185
}
187186

@@ -265,7 +264,7 @@ uint64_t VirtualMemoryReader::ReadPointer()
265264

266265
uint64_t VirtualMemoryReader::ReadPointer(uint64_t address)
267266
{
268-
m_cursor = address + m_addressSize;
267+
m_cursor = address + m_memory->GetAddressSize();
269268
return m_memory->ReadPointer(address);
270269
}
271270

view/sharedcache/core/VirtualMemory.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,10 @@ class VirtualMemoryReader
9494
{
9595
std::shared_ptr<VirtualMemory> m_memory;
9696
uint64_t m_cursor;
97-
uint64_t m_addressSize;
9897
BNEndianness m_endianness = LittleEndian;
9998

10099
public:
101-
explicit VirtualMemoryReader(std::shared_ptr<VirtualMemory> memory, uint64_t addressSize = 8);
100+
explicit VirtualMemoryReader(std::shared_ptr<VirtualMemory> memory);
102101

103102
void SetEndianness(BNEndianness endianness) { m_endianness = endianness; }
104103

0 commit comments

Comments
 (0)