From 2c38141423f6ed6ec4db641be76f61631366cbb1 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Wed, 4 Nov 2015 20:32:27 +0000 Subject: Add "zero_memory" option to IRMemoryMap::FindSpace & IRMemoryMap::Malloc. Zero out the Expression ResultVariable so it's in a known initial state. llvm-svn: 252072 --- lldb/source/Expression/Materializer.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'lldb/source/Expression/Materializer.cpp') diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp index 3c73f49838a..f69a1cd93f8 100644 --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -87,11 +87,13 @@ public: // Allocate a spare memory area to store the persistent variable's contents. Error allocate_error; + const bool zero_memory = false; lldb::addr_t mem = map.Malloc(m_persistent_variable_sp->GetByteSize(), 8, lldb::ePermissionsReadable | lldb::ePermissionsWritable, IRMemoryMap::eAllocationPolicyMirror, + zero_memory, allocate_error); if (!allocate_error.Success()) @@ -552,8 +554,15 @@ public: byte_align = 1; Error alloc_error; + const bool zero_memory = false; + + m_temporary_allocation = map.Malloc(data.GetByteSize(), + byte_align, + lldb::ePermissionsReadable | lldb::ePermissionsWritable, + IRMemoryMap::eAllocationPolicyMirror, + zero_memory, + alloc_error); - m_temporary_allocation = map.Malloc(data.GetByteSize(), byte_align, lldb::ePermissionsReadable | lldb::ePermissionsWritable, IRMemoryMap::eAllocationPolicyMirror, alloc_error); m_temporary_allocation_size = data.GetByteSize(); m_original_data.reset(new DataBufferHeap(data.GetDataStart(), data.GetByteSize())); @@ -817,8 +826,14 @@ public: byte_align = 1; Error alloc_error; - - m_temporary_allocation = map.Malloc(byte_size, byte_align, lldb::ePermissionsReadable | lldb::ePermissionsWritable, IRMemoryMap::eAllocationPolicyMirror, alloc_error); + const bool zero_memory = true; + + m_temporary_allocation = map.Malloc(byte_size, + byte_align, + lldb::ePermissionsReadable | lldb::ePermissionsWritable, + IRMemoryMap::eAllocationPolicyMirror, + zero_memory, + alloc_error); m_temporary_allocation_size = byte_size; if (!alloc_error.Success()) -- cgit v1.2.3