Fixed a dangling pointer bug associated with the
result variable on a "finish" statement. The
ownership of the result value was not being properly
assigned to the newly-created persistent result
variable; now it is.
llvm-svn: 147587
diff --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp
index 950d334..ee82e24 100644
--- a/lldb/source/Core/ValueObjectConstResult.cpp
+++ b/lldb/source/Core/ValueObjectConstResult.cpp
@@ -98,6 +98,13 @@
m_impl(this, address)
{
m_data = data;
+
+ if (!m_data.GetSharedDataBuffer())
+ {
+ DataBufferSP shared_data_buffer(new DataBufferHeap(data.GetDataStart(), data.GetByteSize()));
+ m_data.SetData(shared_data_buffer);
+ }
+
m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
m_value.SetValueType(Value::eValueTypeHostAddress);
m_value.SetContext(Value::eContextTypeClangType, clang_type);