summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/IRMemoryMap.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2013-05-22 22:49:06 +0000
committerSean Callanan <scallanan@apple.com>2013-05-22 22:49:06 +0000
commitfbf5c682cbfce539bba2de06456cd6afcf8c892f (patch)
tree64969f94fd7116f6d881f896bddc219f83c12036 /lldb/source/Expression/IRMemoryMap.cpp
parent682ae15bb92fb05a2fbb7b58a550adffb8538137 (diff)
downloadbcm5719-llvm-fbf5c682cbfce539bba2de06456cd6afcf8c892f.tar.gz
bcm5719-llvm-fbf5c682cbfce539bba2de06456cd6afcf8c892f.zip
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
Diffstat (limited to 'lldb/source/Expression/IRMemoryMap.cpp')
-rw-r--r--lldb/source/Expression/IRMemoryMap.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/lldb/source/Expression/IRMemoryMap.cpp b/lldb/source/Expression/IRMemoryMap.cpp
index 4c4cef41572..9a0f034dc62 100644
--- a/lldb/source/Expression/IRMemoryMap.cpp
+++ b/lldb/source/Expression/IRMemoryMap.cpp
@@ -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);
}
}
}
@@ -369,6 +372,25 @@ IRMemoryMap::Malloc (size_t size, uint8_t alignment, uint32_t permissions, Alloc
}
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)
{
error.Clear();
OpenPOWER on IntegriCloud