diff options
author | dim <dim@FreeBSD.org> | 2015-09-06 14:32:30 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-09-06 14:32:30 +0000 |
commit | 80b639cd40df427b9e325318efeec2d885a65f62 (patch) | |
tree | 94980f450aa3daec3e1fec217374704ad62cfe45 /source/Expression/IRMemoryMap.cpp | |
parent | 8037fa4ee916fa20b3c63cbf531f4ee7e1c76138 (diff) | |
download | FreeBSD-src-80b639cd40df427b9e325318efeec2d885a65f62.zip FreeBSD-src-80b639cd40df427b9e325318efeec2d885a65f62.tar.gz |
Vendor import of (stripped) lldb trunk r242221:
https://llvm.org/svn/llvm-project/lldb/trunk@242221
Diffstat (limited to 'source/Expression/IRMemoryMap.cpp')
-rw-r--r-- | source/Expression/IRMemoryMap.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/Expression/IRMemoryMap.cpp b/source/Expression/IRMemoryMap.cpp index a4fe7a9..4733b16 100644 --- a/source/Expression/IRMemoryMap.cpp +++ b/source/Expression/IRMemoryMap.cpp @@ -418,6 +418,32 @@ IRMemoryMap::Free (lldb::addr_t process_address, Error &error) m_allocations.erase(iter); } +bool +IRMemoryMap::GetAllocSize(lldb::addr_t address, size_t &size) +{ + AllocationMap::iterator iter = FindAllocation(address, size); + if (iter == m_allocations.end()) + return false; + + Allocation &al = iter->second; + + if (address > (al.m_process_start + al.m_size)) + { + size = 0; + return false; + } + + if (address > al.m_process_start) + { + int dif = address - al.m_process_start; + size = al.m_size - dif; + return true; + } + + size = al.m_size; + return true; +} + void IRMemoryMap::WriteMemory (lldb::addr_t process_address, const uint8_t *bytes, size_t size, Error &error) { |