Fixed a bug where persistent variables did not
live as long as they needed to. This led to equality tests involving persistent variables often failing or succeeding when they had no business doing so. To do this, I introduced the ability for a memory allocation to "leak" - that is, to persist in the process beyond the lifetime of the expression. Hand-declared persistent variables do this now. <rdar://problem/13956311> llvm-svn: 182528
This commit is contained in:
@@ -38,7 +38,10 @@ IRMemoryMap::~IRMemoryMap ()
|
||||
while ((iter = m_allocations.begin()) != m_allocations.end())
|
||||
{
|
||||
err.Clear();
|
||||
Free(iter->first, err);
|
||||
if (iter->second.m_leak)
|
||||
m_allocations.erase(iter);
|
||||
else
|
||||
Free(iter->first, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -368,6 +371,25 @@ IRMemoryMap::Malloc (size_t size, uint8_t alignment, uint32_t permissions, Alloc
|
||||
return aligned_address;
|
||||
}
|
||||
|
||||
void
|
||||
IRMemoryMap::Leak (lldb::addr_t process_address, Error &error)
|
||||
{
|
||||
error.Clear();
|
||||
|
||||
AllocationMap::iterator iter = m_allocations.find(process_address);
|
||||
|
||||
if (iter == m_allocations.end())
|
||||
{
|
||||
error.SetErrorToGenericError();
|
||||
error.SetErrorString("Couldn't leak: allocation doesn't exist");
|
||||
return;
|
||||
}
|
||||
|
||||
Allocation &allocation = iter->second;
|
||||
|
||||
allocation.m_leak = true;
|
||||
}
|
||||
|
||||
void
|
||||
IRMemoryMap::Free (lldb::addr_t process_address, Error &error)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user